Commit a022805e authored by Ivan Tyagov's avatar Ivan Tyagov

Parse CLI option.

parent 2d578a7c
...@@ -10,7 +10,7 @@ const int DEFAULT_HEART_BEAT_INTERVAL = 250; ...@@ -10,7 +10,7 @@ const int DEFAULT_HEART_BEAT_INTERVAL = 250;
static int HEART_BEAT_INTERVAL = DEFAULT_HEART_BEAT_INTERVAL; static int HEART_BEAT_INTERVAL = DEFAULT_HEART_BEAT_INTERVAL;
// the list of couplers onto which we depend for properly running // the list of couplers onto which we depend for properly running
static char *HEART_BEAT_ID_LIST[20]; unsigned int HEART_BEAT_ID_LIST[] = {0, 0, 0, 0, 0, 0, 0, 0};
// the interval for publishing messages // the interval for publishing messages
const int PUBLISHING_INTERVAL = 100; const int PUBLISHING_INTERVAL = 100;
......
...@@ -194,6 +194,17 @@ int main(int argc, char **argv) ...@@ -194,6 +194,17 @@ int main(int argc, char **argv)
token = strtok(NULL, ","); token = strtok(NULL, ",");
} }
// convert arguments.heart_beat_id_list -> HEART_BEAT_ID_LIST
i = 0;
char *tk= strtok(arguments.heart_beat_id_list, ",");
while (tk != NULL)
{
// from CLI we get a comma separated list on INTs representing coupler' ID
result = strtol(tk, &eptr, 16);
HEART_BEAT_ID_LIST[i++] = result;
tk = strtok(NULL, ",");
}
// always start attached slaves from a know safe shutdown state // always start attached slaves from a know safe shutdown state
safeShutdownI2CSlaveList(); safeShutdownI2CSlaveList();
......
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