@@ -28,6 +28,7 @@ extern volatile bool update_rtc;
28
28
29
29
extern volatile bool log_file_active ;
30
30
31
+ static bool cat_in_progress = false;
31
32
static lfs_file_t file_command_interface ;
32
33
static uint8_t lfs_file_buf [4096 ]; // Must be cache size
33
34
static struct lfs_file_config lfs_file_config ;
@@ -189,7 +190,7 @@ void command_interface_process_byte(char incoming)
189
190
sprintf ((char * )command_response_buffer , "cat,%s" , filename );
190
191
m_ble_tx_logbuffer (command_response_buffer , (size_t )strlen ((const char * )command_response_buffer ));
191
192
bytes_sent = 0 ;
192
- sync_in_progress = true;
193
+ cat_in_progress = true;
193
194
}
194
195
}
195
196
else if (strncmp (command_input_buffer , "rm " , 3 ) == 0 && strlen (command_input_buffer ) > 3 )
@@ -241,7 +242,7 @@ void command_interface_process_byte(char incoming)
241
242
}
242
243
else if (strncmp (command_input_buffer , "version" , 7 ) == 0 )
243
244
{
244
- sprintf ((char * )command_response_buffer , "version,0.9.1 ,beta" );
245
+ sprintf ((char * )command_response_buffer , "version,0.10.0 ,beta" );
245
246
m_ble_tx_logbuffer (command_response_buffer , strlen ((const char * )command_response_buffer ));
246
247
}
247
248
else if (strncmp (command_input_buffer , "getcfg" , 6 ) == 0 )
@@ -346,21 +347,40 @@ void command_interface_process_byte(char incoming)
346
347
347
348
m_ble_tx_logbuffer (command_response_buffer , strlen ((const char * )command_response_buffer ));
348
349
}
350
+ else if (strncmp (command_input_buffer , "syncstart" , 9 ) == 0 )
351
+ {
352
+ // Sync process is starting
353
+ NRF_LOG_INFO ("syncstart command received" );
354
+ NRF_LOG_FLUSH ();
355
+ if (!sync_in_progress )
356
+ {
357
+ sync_in_progress = true;
358
+ NRF_LOG_INFO ("sync_in_progress is now true" );
359
+ NRF_LOG_FLUSH ();
360
+ } else {
361
+ NRF_LOG_INFO ("sync_in_progress was already true" );
362
+ NRF_LOG_FLUSH ();
363
+ }
364
+ }
349
365
else if (strncmp (command_input_buffer , "syncstop" , 8 ) == 0 )
350
366
{
351
367
// Sync process was aborted by the user
352
368
NRF_LOG_INFO ("syncstop command received" );
353
369
NRF_LOG_FLUSH ();
354
370
if (sync_in_progress )
355
371
{
356
- int close_result = lfs_file_close (m_lfs , & file_command_interface );
357
- NRF_LOG_INFO ("lfs close result: %d" , close_result );
358
- NRF_LOG_FLUSH ();
359
372
sync_in_progress = false;
360
373
} else {
361
374
NRF_LOG_INFO ("sync_in_progress was false" );
362
375
NRF_LOG_FLUSH ();
363
376
}
377
+ if (cat_in_progress )
378
+ {
379
+ int close_result = lfs_file_close (m_lfs , & file_command_interface );
380
+ NRF_LOG_INFO ("lfs close result: %d" , close_result );
381
+ NRF_LOG_FLUSH ();
382
+ cat_in_progress = false;
383
+ }
364
384
}
365
385
else if (strncmp (command_input_buffer , "snooze," , 7 ) == 0 )
366
386
{
@@ -439,7 +459,7 @@ void command_interface_continue_transfer(char* command)
439
459
NRF_LOG_INFO ("cat close result: %d" , close_result );
440
460
NRF_LOG_FLUSH ();
441
461
442
- sync_in_progress = false;
462
+ cat_in_progress = false;
443
463
}
444
464
else if (bytes_sent < file_command_interface .ctz .size )
445
465
{
0 commit comments