add motors emulation

This commit is contained in:
2026-08-11 16:53:11 +03:00
parent 25d35e2294
commit a996bae853
12 changed files with 165 additions and 39 deletions

View File

@@ -26,6 +26,7 @@
#include "cmdlnopts.h"
#include "sslsock.h"
#ifdef SERVER
#include "motors.h"
#include "server.h"
#else
#include "client.h"
@@ -132,11 +133,17 @@ static SSL_CTX* InitCTX(void){
}
int open_socket(){
int fd;
FNAME();
SSL_library_init();
SSL_CTX *ctx = InitCTX();
fd = OpenConn(atoi(G.port));
int fd = OpenConn(atoi(G.port));
#ifdef SERVER
if(G.emulmode) set_emulation_mode();
if(!modbus_open(G.serialpath, G.serialspeed)){
LOGERR("Can't open %s @%d", G.serialpath, G.serialspeed);
WARNX("Can't open %s @%d", G.serialpath, G.serialspeed);
return 1;
}
serverproc(ctx, fd);
#else
if(G.terminal) terminal(ctx, fd);