comparison Discovery/Src/data_central.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 2bb1db22b5f5
children 1303747b5ba2
comparison
equal deleted inserted replaced
269:6e78137952af 270:2e58a4094770
773 return stateUsed->vpm.deco_zone_reached; 773 return stateUsed->vpm.deco_zone_reached;
774 774
775 } 775 }
776 776
777 777
778 void resetEvents(void) 778 void resetEvents(const SDiveState *pStateUsed)
779 { 779 {
780 SDiveState * pStateUsed; 780 memset((void *)&pStateUsed->events, 0, sizeof(SEvents));
781 if(stateUsed == stateRealGetPointer())
782 {
783 pStateUsed = stateRealGetPointerWrite();
784 }
785 else
786 {
787 pStateUsed = stateSimGetPointerWrite();
788 }
789 memset(&pStateUsed->events,0, sizeof(SEvents));
790 } 781 }
791 782
792 783
793 /* This is derived from crc32b but does table lookup. First the table 784 /* This is derived from crc32b but does table lookup. First the table
794 itself is calculated, if it has not yet been set up. 785 itself is calculated, if it has not yet been set up.