Commit 4cb31625 authored by Ivan Tyagov's avatar Ivan Tyagov

Add naive safe mode implementation.

parent b55ee0b9
...@@ -25,3 +25,16 @@ const int WRITER_GROUP_ID = 100; ...@@ -25,3 +25,16 @@ const int WRITER_GROUP_ID = 100;
const int DATASET_WRITER_ID = 62541; const int DATASET_WRITER_ID = 62541;
const int PUBLISHER_ID = 2234; const int PUBLISHER_ID = 2234;
void gotoSafeMode() {
/*
* In this mode coupler will shutdown all
* relays of attached I2C slaves
*/
UA_LOG_INFO(UA_Log_Stdout, \
UA_LOGCATEGORY_USERLAND, \
"Go to SAFE MODE");
// do shutdown all attached I2C slaves (MOD-IO's relays).
safeShutdownI2CSlaveList();
// XXX: should process exit ?
}
...@@ -283,6 +283,8 @@ void callbackCheckHeartBeat() { ...@@ -283,6 +283,8 @@ void callbackCheckHeartBeat() {
UA_LOG_INFO(UA_Log_Stdout, \ UA_LOG_INFO(UA_Log_Stdout, \
UA_LOGCATEGORY_USERLAND, \ UA_LOGCATEGORY_USERLAND, \
"DOWN: %s (delta=%d)", coupler_id_str, timestamp_delta); "DOWN: %s (delta=%d)", coupler_id_str, timestamp_delta);
// go to safe mode as a dependant coupler is DOWN.
gotoSafeMode();
} }
} }
else { else {
......
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