Fix ootx up detection for older saves/tests
@@ -48,11 +48,11 @@ static void ootx_packet_clbk_d_gen2(ootx_decoder_context *ct, ootx_packet *packe
BaseStationData *b = &ctx->bsd[id];
b->OOTXChecked |= true;
FLT accel[3] = {v15.accel_dir[0], v15.accel_dir[1], v15.accel_dir[2]};
- bool upChanged = dist3d(b->accel, accel) > 1e-3;
-
- b->OOTXSet = 1;
+ bool upChanged = norm3d(b->accel) != 0.0 && dist3d(b->accel, accel) > 1e-3;
+ SV_VERBOSE(10, "OOTX up direction changed for %x (%f)", b->BaseStationID, norm3d(b->accel));
bool doSave = b->BaseStationID != v15.id || b->OOTXSet == false || upChanged;
+ b->OOTXSet = 1;
if (doSave) {
SV_INFO("Got OOTX packet %d %08x", ctx->bsd[id].mode, (unsigned)v15.id);
@@ -93,7 +93,7 @@ static void ootx_packet_cblk_d_gen1(ootx_decoder_context *ct, ootx_packet *packe
BaseStationData *b = &ctx->bsd[id];
b->OOTXChecked = true;
FLT accel[3] = {v6.accel_dir_x, v6.accel_dir_y, v6.accel_dir_z};
- bool upChanged = dist3d(b->accel, accel) > 1e-3;
+ bool upChanged = norm3d(b->accel) != 0.0 && dist3d(b->accel, accel) > 1e-3;
bool doSave = b->BaseStationID != v6.id || b->OOTXSet == false || upChanged || b->mode != v6.mode_current;
b->sys_unlock_count = v6.sys_unlock_count;
