Commit 3fbb86ee authored by Ivan Tyagov's avatar Ivan Tyagov

Always start and end program with all relays OFF. This is consistent and...

Always start and end program with all relays OFF. This is consistent and leaves nothing to previous run where certain processes can leaver coupler in an inconsistent state.
parent 2104da9b
......@@ -138,7 +138,7 @@ static void afterWriteTime(UA_Server *server,
if (data->value.type == &UA_TYPES[UA_TYPES_INT32]) {
UA_Int32 hrValue = *(UA_Int32 *)data->value.data;
printf("int32Value %u\n", hrValue);
//printf("int32Value %u\n", hrValue);
if (hrValue > 0){
setRelayState(0x0F);
}
......@@ -222,7 +222,9 @@ static void stopHandler(int sign) {
}
int main(void) {
// set all relays to OFF at startup
setRelayState(0x00);
signal(SIGINT, stopHandler);
signal(SIGTERM, stopHandler);
......@@ -241,5 +243,9 @@ int main(void) {
UA_StatusCode retval = UA_Server_run(server, &running);
UA_Server_delete(server);
// set all relays to OFF at startup
setRelayState(0x00);
return retval == UA_STATUSCODE_GOOD ? EXIT_SUCCESS : EXIT_FAILURE;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment