adding storage manager

This commit is contained in:
phyto 2019-04-29 17:46:14 +02:00
parent a65e28aa67
commit a4104e21f7
3 changed files with 26 additions and 3 deletions

View File

@ -70,6 +70,7 @@ prtln("");
static void clihelp() static void clihelp()
{ {
prtln("x\texit cli"); prtln("x\texit cli");
prtln("I\tinit storage");
} }
/* --------------------------------------------------------------- */ /* --------------------------------------------------------------- */
void phytocli(void) void phytocli(void)
@ -94,6 +95,7 @@ do {
switch(key) { switch(key) {
case 'x': flag_exit=1; break; case 'x': flag_exit=1; break;
case '?': clihelp(); break; case '?': clihelp(); break;
case 'I': init_storage(); break;
} }
} while (!flag_exit); } while (!flag_exit);

View File

@ -14,7 +14,7 @@ void setup() {
Serial.print("\n"); Serial.print("\n");
phytocli(); phytocli(); /* XXX */
/* XXX */ /* XXX */
/* changing the voltage reference of the ADC /* changing the voltage reference of the ADC
@ -90,7 +90,14 @@ void loop() {
if (foo++ > 5) { if (foo++ > 5) {
readlight(); foo = 0; readlight(); foo = 0;
} }
/* check for CLI request */
if (Serial.available() && 0x55==Serial.read())
{
Serial.println("M cli request");
phytocli();
}
delay(DELAI); delay(DELAI);
} }

View File

@ -0,0 +1,14 @@
/* --------------------------------------------------------------- */
#include <EEPROM.h>
/* --------------------------------------------------------------- */
int init_storage(void)
{
Serial.println(__func__);
Serial.print("eeprom length: ");
Serial.println(EEPROM.length());
}
/* --------------------------------------------------------------- */
/* --------------------------------------------------------------- */