Commit 6d801de5 authored by Ivan Tyagov's avatar Ivan Tyagov

Do not override initial operational mode of the coupler by

switching from safe to normal modes.
This way both keep-alive safety network implementation and virtual
(testing mode) could co-exists together.
parent 346c845e
...@@ -154,7 +154,8 @@ void handleCLI(int argc, char **argv) { ...@@ -154,7 +154,8 @@ void handleCLI(int argc, char **argv) {
// transfer to global variables (CLI input) // transfer to global variables (CLI input)
COUPLER_ID = arguments.id; COUPLER_ID = arguments.id;
I2C_VIRTUAL_MODE = arguments.mode; OPERATIONAL_MODE = arguments.mode;
I2C_VIRTUAL_MODE = OPERATIONAL_MODE;
I2C_BLOCK_DEVICE_NAME = arguments.device; I2C_BLOCK_DEVICE_NAME = arguments.device;
HEART_BEAT_INTERVAL = arguments.heart_beat_interval; HEART_BEAT_INTERVAL = arguments.heart_beat_interval;
PUBLISHING_INTERVAL = HEART_BEAT_INTERVAL; // we assume that each heart_beat leads to a publish event PUBLISHING_INTERVAL = HEART_BEAT_INTERVAL; // we assume that each heart_beat leads to a publish event
......
...@@ -29,11 +29,11 @@ static int HEART_BEAT_TIMEOUT_INTERVAL = DEFAULT_HEART_BEAT_TIMEOUT_INTERVAL; ...@@ -29,11 +29,11 @@ static int HEART_BEAT_TIMEOUT_INTERVAL = DEFAULT_HEART_BEAT_TIMEOUT_INTERVAL;
// XXX: assume ONLY 8 couplers! // XXX: assume ONLY 8 couplers!
unsigned int HEART_BEAT_ID_LIST[] = {0, 0, 0, 0, 0, 0, 0, 0}; unsigned int HEART_BEAT_ID_LIST[] = {0, 0, 0, 0, 0, 0, 0, 0};
// the interval for publishing messages$ // the interval for publishing messages
static int PUBLISHING_INTERVAL = 10; static int PUBLISHING_INTERVAL = 10;
// a hard coded writer group, data set and publisher ID$ // a hard coded writer group, data set and publisher ID
// (should be same for publisher / subscriber)$ // (should be same for publisher / subscriber)
const int WRITER_GROUP_ID = 100; 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;
...@@ -48,8 +48,12 @@ void gotoSafeMode() { ...@@ -48,8 +48,12 @@ void gotoSafeMode() {
UA_LOGCATEGORY_USERLAND, \ UA_LOGCATEGORY_USERLAND, \
"Go to SAFE MODE"); "Go to SAFE MODE");
// do shutdown all attached I2C slaves (MOD-IO's relays). if (OPERATIONAL_MODE==0) {
safeShutdownI2CSlaveList(); // do shutdown all attached I2C slaves (MOD-IO's relays).
// only if initial operational mode is appropriate.
safeShutdownI2CSlaveList();
}
// set to virtual mode which means that coupler will mimic working but // set to virtual mode which means that coupler will mimic working but
// not set any related relays' state // not set any related relays' state
I2C_VIRTUAL_MODE = 1; I2C_VIRTUAL_MODE = 1;
......
...@@ -15,6 +15,11 @@ int I2C_SLAVE_ADDR_LIST[] = {0, 0}; ...@@ -15,6 +15,11 @@ int I2C_SLAVE_ADDR_LIST[] = {0, 0};
static char *DEFAULT_I2C_BLOCK_DEVICE_NAME = "/dev/i2c-1"; static char *DEFAULT_I2C_BLOCK_DEVICE_NAME = "/dev/i2c-1";
char *I2C_BLOCK_DEVICE_NAME; char *I2C_BLOCK_DEVICE_NAME;
// global coupler mode
// 0 - normal operational mode
// 1 - virtual operational mode (no real I2C to MOD-IO command issued)
bool OPERATIONAL_MODE = 0;
// global virtual mode needed for testing on x86 platform // global virtual mode needed for testing on x86 platform
bool I2C_VIRTUAL_MODE = 0; bool I2C_VIRTUAL_MODE = 0;
......
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