comparison Discovery/Src/base.c @ 270:2e58a4094770 write-from-sim

feature, debug: make simulator write a logbook entry When compiling the code with -DSIM_WRITES_LOGBOOK, the simulator writes to the logbook. This is for debug purpose only. This commit does *not* define this SIM_WRITES_LOGBOOK, so when compiled, things are functionally unchanged. Caveat 1: a simulator generated log cannot be advanced with +5 min. It needs to run in real time. Caveat 2: The generated log is currently not "complete". For example, CCR setpoint switches are not logged. There are likely more small events not logged. This means that a sim generated log is not a full replacement for real dive testing. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
author Jan Mulder <jlmulder@xs4all.nl>
date Wed, 24 Apr 2019 17:10:51 +0200
parents a6c0375bc950
children 74a8296a2318
comparison
equal deleted inserted replaced
269:6e78137952af 270:2e58a4094770
506 if(DoDisplayRefresh) 506 if(DoDisplayRefresh)
507 { 507 {
508 DoDisplayRefresh = 0; 508 DoDisplayRefresh = 0;
509 RefreshDisplay(); 509 RefreshDisplay();
510 510
511 // Enable this to make the simulator write a logbook entry
512 // #define SIM_WRITES_LOGBOOK 1
513
514 if(stateUsed == stateSimGetPointer())
515 {
516 #ifdef SIM_WRITES_LOGBOOK
517 logbook_InitAndWrite(stateUsed);
518 #endif
519 }
520
511 if(stateUsed == stateRealGetPointer()) /* Handle log entries while in dive mode*/ 521 if(stateUsed == stateRealGetPointer()) /* Handle log entries while in dive mode*/
512 logbook_InitAndWrite(); 522 logbook_InitAndWrite(stateUsed);
513 } 523 }
514 524
515 #ifdef DEBUG_RUNTIME 525 #ifdef DEBUG_RUNTIME
516 translateTime(stateUsed->lifeData.timeBinaryFormat, &Stime); 526 translateTime(stateUsed->lifeData.timeBinaryFormat, &Stime);
517 if(lastsecond == 0xFF) 527 if(lastsecond == 0xFF)