Skip to content

Commit

Permalink
Improved Slave Devices code
Browse files Browse the repository at this point in the history
  • Loading branch information
thiagoralves authored Nov 12, 2018
1 parent 13455c7 commit d2c33ba
Show file tree
Hide file tree
Showing 3 changed files with 215 additions and 155 deletions.
2 changes: 1 addition & 1 deletion webserver/core/ladder.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ void mapUnusedIO();

//modbus_master.cpp
void initializeMB();
void querySlaveDevices();
void *querySlaveDevices(void *arg);
void updateBuffersIn_MB();
void updateBuffersOut_MB();

Expand Down
9 changes: 5 additions & 4 deletions webserver/core/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ void disableOutputs()
//-----------------------------------------------------------------------------
void handleSpecialFunctions()
{
//current time
//current time [%ML1024]
struct tm *current_time;
time_t rawtime;

Expand All @@ -168,9 +168,12 @@ void handleSpecialFunctions()

if (special_functions[0] != NULL) *special_functions[0] = rawtime;

//number of cycles
//number of cycles [%ML1025]
cycle_counter++;
if (special_functions[1] != NULL) *special_functions[1] = cycle_counter;

//comm error counter [%ML1026]
/* Implemented in modbus_master.cpp */

//insert other special functions below
}
Expand Down Expand Up @@ -252,8 +255,6 @@ int main(int argc,char **argv)
//attached to the user variables
glueVars();

querySlaveDevices(); //query data from all slave devices

updateBuffersIn(); //read input image

pthread_mutex_lock(&bufferLock); //lock mutex
Expand Down
Loading

0 comments on commit d2c33ba

Please sign in to comment.