@ -135,15 +135,10 @@ void CommonCLI::handleCommand(uint32_t sender_timestamp, const char* command, ch
_callbacks - > sendSelfAdvertisement ( 1500 ) ; // longer delay, give CLI response time to be sent first
_callbacks - > sendSelfAdvertisement ( 1500 ) ; // longer delay, give CLI response time to be sent first
strcpy ( reply , " OK - Advert sent " ) ;
strcpy ( reply , " OK - Advert sent " ) ;
} else if ( memcmp ( command , " clock sync " , 10 ) = = 0 ) {
} else if ( memcmp ( command , " clock sync " , 10 ) = = 0 ) {
uint32_t curr = getRTCClock ( ) - > getCurrentTime ( ) ;
getRTCClock ( ) - > setCurrentTime ( sender_timestamp + 1 ) ;
if ( sender_timestamp > curr ) {
uint32_t now = getRTCClock ( ) - > getCurrentTime ( ) ;
getRTCClock ( ) - > setCurrentTime ( sender_timestamp + 1 ) ;
DateTime dt = DateTime ( now ) ;
uint32_t now = getRTCClock ( ) - > getCurrentTime ( ) ;
sprintf ( reply , " OK - clock set: %02d:%02d - %d/%d/%d UTC " , dt . hour ( ) , dt . minute ( ) , dt . day ( ) , dt . month ( ) , dt . year ( ) ) ;
DateTime dt = DateTime ( now ) ;
sprintf ( reply , " OK - clock set: %02d:%02d - %d/%d/%d UTC " , dt . hour ( ) , dt . minute ( ) , dt . day ( ) , dt . month ( ) , dt . year ( ) ) ;
} else {
strcpy ( reply , " ERR: clock cannot go backwards " ) ;
}
} else if ( memcmp ( command , " start ota " , 9 ) = = 0 ) {
} else if ( memcmp ( command , " start ota " , 9 ) = = 0 ) {
if ( ! _board - > startOTAUpdate ( _prefs - > node_name , reply ) ) {
if ( ! _board - > startOTAUpdate ( _prefs - > node_name , reply ) ) {
strcpy ( reply , " Error " ) ;
strcpy ( reply , " Error " ) ;
@ -154,15 +149,10 @@ void CommonCLI::handleCommand(uint32_t sender_timestamp, const char* command, ch
sprintf ( reply , " %02d:%02d - %d/%d/%d UTC " , dt . hour ( ) , dt . minute ( ) , dt . day ( ) , dt . month ( ) , dt . year ( ) ) ;
sprintf ( reply , " %02d:%02d - %d/%d/%d UTC " , dt . hour ( ) , dt . minute ( ) , dt . day ( ) , dt . month ( ) , dt . year ( ) ) ;
} else if ( memcmp ( command , " time " , 5 ) = = 0 ) { // set time (to epoch seconds)
} else if ( memcmp ( command , " time " , 5 ) = = 0 ) { // set time (to epoch seconds)
uint32_t secs = _atoi ( & command [ 5 ] ) ;
uint32_t secs = _atoi ( & command [ 5 ] ) ;
uint32_t curr = getRTCClock ( ) - > getCurrentTime ( ) ;
getRTCClock ( ) - > setCurrentTime ( secs ) ;
if ( secs > curr ) {
uint32_t now = getRTCClock ( ) - > getCurrentTime ( ) ;
getRTCClock ( ) - > setCurrentTime ( secs ) ;
DateTime dt = DateTime ( now ) ;
uint32_t now = getRTCClock ( ) - > getCurrentTime ( ) ;
sprintf ( reply , " OK - clock set: %02d:%02d - %d/%d/%d UTC " , dt . hour ( ) , dt . minute ( ) , dt . day ( ) , dt . month ( ) , dt . year ( ) ) ;
DateTime dt = DateTime ( now ) ;
sprintf ( reply , " OK - clock set: %02d:%02d - %d/%d/%d UTC " , dt . hour ( ) , dt . minute ( ) , dt . day ( ) , dt . month ( ) , dt . year ( ) ) ;
} else {
strcpy ( reply , " (ERR: clock cannot go backwards) " ) ;
}
} else if ( memcmp ( command , " neighbors " , 9 ) = = 0 ) {
} else if ( memcmp ( command , " neighbors " , 9 ) = = 0 ) {
_callbacks - > formatNeighborsReply ( reply ) ;
_callbacks - > formatNeighborsReply ( reply ) ;
} else if ( memcmp ( command , " neighbor.remove " , 16 ) = = 0 ) {
} else if ( memcmp ( command , " neighbor.remove " , 16 ) = = 0 ) {