diff --git a/application/sbc.c b/application/sbc.c index faa1b08..7bbd797 100644 --- a/application/sbc.c +++ b/application/sbc.c @@ -661,6 +661,28 @@ static int sbc_io_process() printf("#GET-STATION: %d\r\n", config_block()->app_cfg.station_number); valid = 1; } + else if (!strcmp(in,"GET-TIMESYNC-INTERVAL")) + { + printf("#GET-TIMESYNC-INTERVAL: %d\r\n", config_block()->app_cfg.timesync_interval); + valid = 1; + } + else if (prefix_matches(in,"SET-TIMESYNC-INTERVAL")) + { + const char * nxt; + int interval; + if (!parse_int(in+sizeof("SET-TIMESYNC-INTERVAL"), &nxt,&interval)) + { + printf("#SET-TIMESYNC-INTERVAL %d\r\n", interval); + config_block()->app_cfg.timesync_interval = interval; + need_sync = 1; + valid = 1; + } + else + { + printf("#ERR: trouble parsing int\r\n"); + } + } + else if (!strcmp(in,"FLUSH")) { flush_buffers(); diff --git a/config/config.h b/config/config.h index 9de97f6..6d3552f 100644 --- a/config/config.h +++ b/config/config.h @@ -24,7 +24,7 @@ #define APP_REV "REVE" #endif -#define APP_VERSION "Summit.061622.2-" APP_REV +#define APP_VERSION "Summit.061722.0-" APP_REV #define MODE_CHANGE_MINTICKS 100 diff --git a/lorawan/lorawan.c b/lorawan/lorawan.c index 10a3d16..b8f0165 100644 --- a/lorawan/lorawan.c +++ b/lorawan/lorawan.c @@ -879,6 +879,7 @@ int lorawan_process(int up) int have_time = get_time() > 1000000000; should_request_time = 1; int delay_in_secs = have_time ? config_block()->app_cfg.timesync_interval : low_power_mode ? 300 : 60; + if (delay_in_secs < 60) delay_in_secs = 60; time_check = up + delay_in_secs ; cant_sleep=1; } diff --git a/shared/config_block.c b/shared/config_block.c index bde26da..de6b986 100644 --- a/shared/config_block.c +++ b/shared/config_block.c @@ -33,6 +33,7 @@ static application_cfg_t dflt_ac = .lte_stats_interval = 60, .lora_stats_interval = 60, .lora_stats_interval_low_power_mode = 600, + .timesync_interval = 1800, #ifdef _RNO_REV_D .turnon_voltage = 13, .turnoff_voltage = 12 @@ -40,7 +41,6 @@ static application_cfg_t dflt_ac = .turnon_voltage = 30, .turnoff_voltage = 20 #endif - }; @@ -106,7 +106,7 @@ int verify_app_cfg(application_cfg_t* ac) #endif if (ac->timesync_interval == -1) { - ac->timesync_interval = 4*3600; + ac->timesync_interval = 1800; } return changed; }