X-Git-Url: http://git.droids-corp.org/?p=aversive.git;a=blobdiff_plain;f=projects%2Fmicrob2010%2Fmainboard%2Fcommands_mainboard.c;h=ee0ffa4524f71377431343dd4e71e0036bf0c76c;hp=adec77f47182729e8e85dd9767c93b9f0bfbbff0;hb=d776dc0dab6dd3ddf92041f1ad42e521847ea9cf;hpb=19cd41f7920628a962928580cd1618a1ee5750aa diff --git a/projects/microb2010/mainboard/commands_mainboard.c b/projects/microb2010/mainboard/commands_mainboard.c index adec77f..ee0ffa4 100644 --- a/projects/microb2010/mainboard/commands_mainboard.c +++ b/projects/microb2010/mainboard/commands_mainboard.c @@ -779,7 +779,7 @@ static void cmd_cobboard_setmode2_parsed(void *parsed_result, void *data) } else if (!strcmp_P(res->arg1, PSTR("harvest"))) { i2c_cobboard_set_mode(I2C_COBBOARD_MODE_HARVEST); - i2c_cobboard_harvest(side); + i2c_cobboard_autoharvest(side); } else if (!strcmp_P(res->arg1, PSTR("pack"))) { i2c_cobboard_set_mode(I2C_COBBOARD_MODE_HARVEST); @@ -1123,6 +1123,47 @@ parse_pgm_inst_t cmd_clitoid = { }, }; +/**********************************************************/ +/* Time_Monitor */ + +/* this structure is filled when cmd_time_monitor is parsed successfully */ +struct cmd_time_monitor_result { + fixed_string_t arg0; + fixed_string_t arg1; +}; + +/* function called when cmd_time_monitor is parsed successfully */ +static void cmd_time_monitor_parsed(void *parsed_result, void *data) +{ +#ifndef HOST_VERSION + struct cmd_time_monitor_result *res = parsed_result; + uint16_t seconds; + + if (!strcmp_P(res->arg1, PSTR("reset"))) { + eeprom_write_word(EEPROM_TIME_ADDRESS, 0); + } + seconds = eeprom_read_word(EEPROM_TIME_ADDRESS); + printf_P(PSTR("Running since %d mn %d\r\n"), seconds/60, seconds%60); +#endif +} + +prog_char str_time_monitor_arg0[] = "time_monitor"; +parse_pgm_token_string_t cmd_time_monitor_arg0 = TOKEN_STRING_INITIALIZER(struct cmd_time_monitor_result, arg0, str_time_monitor_arg0); +prog_char str_time_monitor_arg1[] = "show#reset"; +parse_pgm_token_string_t cmd_time_monitor_arg1 = TOKEN_STRING_INITIALIZER(struct cmd_time_monitor_result, arg1, str_time_monitor_arg1); + +prog_char help_time_monitor[] = "Show since how long we are running"; +parse_pgm_inst_t cmd_time_monitor = { + .f = cmd_time_monitor_parsed, /* function to call */ + .data = NULL, /* 2nd arg of func */ + .help_str = help_time_monitor, + .tokens = { /* token list, NULL terminated */ + (prog_void *)&cmd_time_monitor_arg0, + (prog_void *)&cmd_time_monitor_arg1, + NULL, + }, +}; + /**********************************************************/ /* Test */