diff options
author | fishsoupisgood <github@madingley.org> | 2020-11-08 00:44:09 +0000 |
---|---|---|
committer | fishsoupisgood <github@madingley.org> | 2020-11-08 00:44:09 +0000 |
commit | 6a27a521f99c7babc9d000465b661f66b54ee101 (patch) | |
tree | cafd3f2b11534b84d5aebe7a03746e92c04b39df /arm.c | |
parent | 8531610431c4f0f60cbe64ed8ae362219e7f6520 (diff) | |
download | galaxy_tools-6a27a521f99c7babc9d000465b661f66b54ee101.tar.gz galaxy_tools-6a27a521f99c7babc9d000465b661f66b54ee101.tar.bz2 galaxy_tools-6a27a521f99c7babc9d000465b661f66b54ee101.zip |
add wait until disarmed
Diffstat (limited to 'arm.c')
-rw-r--r-- | arm.c | 14 |
1 files changed, 11 insertions, 3 deletions
@@ -122,12 +122,13 @@ static const char *ready_to_str (int i) -int show_state (int fd) +int show_state (int fd, int zone) { int i, l = SIA_MAX_DATA_LENGTH; unsigned char armed[SIA_MAX_DATA_LENGTH]; unsigned char state[SIA_MAX_DATA_LENGTH]; unsigned char ready[SIA_MAX_DATA_LENGTH]; + int s = 0; i = get_thing (fd, "SA", armed); @@ -161,12 +162,19 @@ int show_state (int fd) printf ("%-6s | %-15s | %-15s | %-15s\n", "Zone", "Armed", "State", "Ready"); printf ("-------+-----------------+-----------------+----------------\n"); - for (i = 0; i < l; ++i) + if (zone > 0) { + s = zone; + l = zone + 1; + } + + for (i = s; i < l; ++i) printf ("%6d | %-15s | %-15s | %-15s\n", i + 1, armed_to_str (armed[i]), state_to_str (state[i]), ready_to_str (ready[i])); printf ("\n"); - return armed[0] - '0'; + if (zone < 0) zone = 0; + + return armed[zone] - '0'; } |