Final Modes for WII5 Tasmania Release * Incidental ones - used to transition the modes in the state machine * BOOT * START * Demo / Testing modes - these must not be used in prod, but will have to have just timeouts (these modes do not have Iridium and are unreliable, they must exit) * DEMO * MANUALTEST * SELFTEST * Fully functional modes - each of these has full control, metadata, and Iridium * SLEEP - as deep as possible, basically off. But will come on every 12 hours * LOWBATTERY - Automatically selected, no matter what the mode * POSITION - Send the position over and over * CAPTURE - Full controlled and capture mode Original Notes: Top Level Modes Most of the buoy uses a lot of memory. But can be rebooted to other states. And most of the memory is using MALLOC Boot up stages WII5MODE_BOOT - Boot up only once . Loading configuration from EEPROM etc only needs to be done once . Long processes, like reading the blocks from the SD Cards SET - NA AUTO - Boot up WII5MODE_START - Probably jump here each time waking from sleep etc . GPS, RTC, and other updates that need to be regularly checked can be done here SET - NA AUTO - Start ? WII5MODE_OFF, - OFF - Disable everything and go into deep sleep, don't wake, back to sleep . Really just a mode that allows us to stay here - (e.g. switch is off) SET - NA AUTO - Switch position WII5MODE_SLEEP, - Same as OFF, but will wake with button, alarm, and every 12 hours . Sleep - wake can be from button, network, time is up, alarm hit (RTC), every 12 hours and more . Allowing more complicated decisions, e.g. long press to move to MANUAL TEST mode or Force Capture test -> REPORT - If 12 hoursly updates -> TemporaryMode - If still not expired -> mode would be - POSITION or CAPTURE or SLEEP -> DefaultMode - Otherwise -> mode would be - POSITION or CAPTURE or SLEEP SET - expires val1 = ReportPeriod - How many minutes between reports. Default is 720 (12 hours) NOTE: No way to go back to temporary mode right now. Consider that? AUTO - NA WII5MODE_LOWBATTERY, - Automatically set mode based on Battery Management . A command mode change can force to MANUALTEST, or others but only for a maximum time period SET - NA AUTO - From Battery Module - not saved, recalculated all the time WII5MODE_POSITION, - Position mode - light weight, no Maths, regular updates SET - expires val1 = ReportPeriod - How many minutes between sending position (default 15 minutes) val2 = StrobeModes - e.g. Turn on strobe never, 5 minutes per hour, 1 minute at every send, etc NOTE: No way to go back to temporary mode right now. Consider that? AUTO - NA WII5MODE_REPORT, - Report - this is like position, but a single report, and back to sleep MINI Self Test or Requested Self Test SET - NA AUTO - Done from sleep, returns back to SLEEP - which will test etc WII5MODE_CAPTURE, - Normal full capture mode. SET - expires val1 - RunPeriod - Minutes between - 15 (every 15 mins), 60 (once an hour), 120 (every 2 hours) val2 - Records - How many records do we want (needs to be what is needed by maths) val3 - Predefined sets of data to send back for Iridium - this is going to be a bit mask. So we can have 32 sets of data we can add. Some might be contray to each other. e.g. 1 might be low resolution temperature, but 2 high resolution, so no point adding both. New simpler Binary module - since now we only need to know this 32 bit number, to know what is in the rest of the packet - and new types of data get added to the end..... maybe. AUTO - NA WII5MODE_MANUALTEST - Manual test - each power button, module etc, can be toggled. . Leaving this mode - we should consider a software reboot as the modes and hardware will be in an unknown state SET - (restrict to set from Serial and not Iridium) AUTO - NA WII5MODE_SELFTEST - Self Test mode allows running through all the self tests automatically and rebooting SET - (restrict to set from Serial and not Iridium) val1 - ? AUTO - NA Changing Modes: * Code: - wii5Controler.setMode(WII5MODE_MANUALTEST); // Forever - write to config - wii5Controler.setTemporaryMode(WII5MODE_MANUALTEST); // Until reboot (ie, not to config) - wii5Controler.setTemporaryMode(WII5MODE_MANUALTEST, 300); // 5 minutes * Iridium - mode:ModeName:Seconds(0 forever):option1,option2,option3 (NOTE: Could we support all serial commands here?) (NOTE: Could we make it a specific one line reply is always made) @WII5!,mode,... e.g. it is WII5! for ACK and then the first string, e.g. mode, rest is optional @WII5,hello,From,Here would be therefore @WII5!,hello,My,Reply * Serial - @WII5,mode,ModeName,Seconds,option1,option2,option3 * Modules Logic - WII5Battery - force to LOWBATTERY mode (never saved), switch back to Capture when it can (or what ever default) Boot Mode: (how do we know where to start) (first one to match) * Check the OFF Switch - if it is active, WII5MODE_OFF . We don't actually need to do this one, if OFF switch active in loop, it will set it no matter what the mode. * Check Battery . Special option in config to ignore the battery for a period of time. . If battery too low, switch to low power mode (and not ignored) * Sleeping . Read the sleeping configuration from memory or EEPROM . Check the date / time for it has not yet expired (check time is synced) . Back to sleep * TemporaryMode . Read Temporary mode - from memory or EEPROM . Check the date / time for it has not yet expired (check time is synced) . Use this mode * DefaultMode . Back to default mode Configuration Options Per mode: * WII5MODE_BOOT . NA * WII5MODE_START . NA * WII5MODE_OFF . NA * WII5MODE_SLEEP . When to wake up (time in future, or number of seconds from now) * WII5MODE_WAKE . NA * WII5MODE_REPORT . NA * WII5MODE_LOWBATTERY . NA * WII5MODE_POSITION . Frequency (how many minutes apart) . Strobe Rules - instead of just on/off - strobe can have rules in here * WII5MODE_CAPTURE . Number of seconds/minutes/records to caputre . Process flags - Pass in some optional extra flags on processing and what you want returned via Iridium . When to start (minute in hour or some way of multiple per hour, half hour, quarter hour) . Hours between too . Examples: . Start 5 minutes past the hour, ever 3 hours (ie. 00, 03, 06, 09 ...) . Run every 15 minutes for one hour, then sleep for an hour (00:00, 00:15, 00:30, 00:45, sleep... 02:00, 02:15, ...) . etc. * WII5MODE_MANUALTEST . NA * WII5MODE_SELFTEST . NA - might have some subsets in the future Main Modes: * OFF * A rare mode where the device is completely off. * Exit = ? Physical butto? * Time? * Sleep * Deep down sleep, don't take up much power * WakeUp * Check why we got woken up? * User input button * Back to old mode after sleep (period hit) * Iridium input * Period wake up - send status, che * Exit - always does end of this, back to sleep * LowPower * Special mode, keep everything really short * Send Data * Sleep * Position * Capture * Capture Start will define what is checked, e.g. It might not allow iridium * In that case, Iridium NMEA commands should return correct error to wait * NOTE: This is not capture itself * ManualTest * Stay in this mode (max tme, maybe 4 hours) to test * Allow manual start/stop of processes Exclusive vs Together: * Classic example... * Start capture * In the background the Maths processor is still dealing with the old data. * And it sends Iridium commands * And capture needs metadata such as GPS. * So Sparton serial in, SD writes, Iridium sending data, GPS on. All not kind of related. Sequence: Boot Load up configuration from EEPROM, start devices etc SelfTest A built in self test that takes under 1 minutes. It will just set a Simple error we can use to update the LED Run Sleep Run Modes