Fixes after merge

This commit is contained in:
Valerio De Benedetto 2024-09-20 14:02:42 +02:00
parent 2def1aa693
commit 6c5ff15b5e
2 changed files with 11 additions and 9 deletions

View File

@ -3,6 +3,7 @@
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <arpa/inet.h>
#include <netdb.h>
@ -164,10 +165,13 @@ void disconnect(void* conn) {
}
// Read/write/sleep platform functions
// Read/write platform functions
int32_t read_fd_linux(uint8_t* buf, uint16_t count, int32_t timeout_ms, void* arg) {
if(!arg) return -1;
if (!arg) {
return -1;
}
int fd = *(int*) arg;
uint16_t total = 0;

View File

@ -220,14 +220,12 @@ int main(int argc, char* argv[]) {
if (conn) {
// Set the next connection handler used by the read/write platform functions
nmbs_set_platform_arg(&nmbs, conn);
}else{
continue;
}
err = nmbs_server_poll(&nmbs);
if (err != NMBS_ERROR_NONE) {
printf("Error on modbus connection - %s\n", nmbs_strerror(err));
// In a more complete example, we would handle this error by checking its nmbs_error value
err = nmbs_server_poll(&nmbs);
if (err != NMBS_ERROR_NONE) {
printf("Error on modbus connection - %s\n", nmbs_strerror(err));
// In a more complete example, we would handle this error by checking its nmbs_error value
}
}
}