i3detroit/Automatic-IoT-module-programming

some devices need two rounds of commands

Closed this issue · 1 comments

Some devices need two rounds of backlog commands to fully set them up. Example, for a device with a MCP23017 I2C expander, we want to run this, but the sensor29 commands (for the IO settings for the 16 pins on the chip) will fail:
cmnd/i3/inside/b-side/alarm-panel/backlog GPIO4 6; GPIO5 5; sensor29 0,2,1,2; sensor29 1,2,1,2; sensor29 2,2,1,2; sensor29 3,2,1,2; sensor29 4,2,1,2; sensor29 5,2,1,2; sensor29 6,2,1,2; sensor29 7,2,1,2; sensor29 8,2,1,2; sensor29 9,2,1,2; sensor29 10,2,1,2; sensor29 11,2,1,2; sensor29 12,2,1,2; sensor29 13,2,1,2; sensor29 14,2,1,2; sensor29 15,2,1,2; restart 1

The first two GPIO commands enable I2C pins, and a reboot is needed after this before the sensor29 commands are run. Otherwise, the sensor29 commands will fail because I2C isn't set up and the MCP23017 hasn't been detected yet.

fixed by allowing for arbitrary number of commands