diff --git a/app/src/main/rs/decoder.rs b/app/src/main/rs/decoder.rs index 72c1614..07eadfa 100644 --- a/app/src/main/rs/decoder.rs +++ b/app/src/main/rs/decoder.rs @@ -140,13 +140,13 @@ void decode(int samples) { int sync_pulse = !sync_level && sync_counter >= sync_length; sync_counter = sync_level ? sync_counter + 1 : 0; - if (mode != mode_raw) { + if (current_mode != mode_raw) { int detected_mode = calibration_detector(dat_value, cnt_active, cnt_quantized); if (detected_mode >= 0) reset(); switch_mode(detected_mode); int estimated_mode = scanline_estimator(sync_level); - if (estimated_mode >= 0 && estimated_mode != mode) + if (estimated_mode >= 0 && estimated_mode != current_mode) reset(); switch_mode(estimated_mode); } @@ -162,7 +162,7 @@ void decode(int samples) { seperator_counter = 0; continue; } - switch (mode) { + switch (current_mode) { case mode_robot36: robot36_decoder(); break; diff --git a/app/src/main/rs/modes.rsh b/app/src/main/rs/modes.rsh index f4002b4..201d79d 100644 --- a/app/src/main/rs/modes.rsh +++ b/app/src/main/rs/modes.rsh @@ -24,7 +24,7 @@ void debug_sync() { save_cnt = 1; save_dat = 0; - mode = mode_raw; + current_mode = mode_raw; sync_length = minimum_sync_length; maximum_length = buffer_length; scanline_length = maximum_length; @@ -33,7 +33,7 @@ void debug_image() { save_dat = 1; save_cnt = 0; - mode = mode_raw; + current_mode = mode_raw; sync_length = minimum_sync_length; maximum_length = buffer_length; scanline_length = maximum_length; @@ -42,7 +42,7 @@ void debug_both() { save_cnt = 1; save_dat = 1; - mode = mode_raw; + current_mode = mode_raw; sync_length = minimum_sync_length; maximum_length = buffer_length; scanline_length = maximum_length; @@ -51,7 +51,7 @@ void robot36_mode() { save_dat = 1; save_cnt = 0; - mode = mode_robot36; + current_mode = mode_robot36; const float tolerance = 0.8f; const float settling_time = 0.0011f; const float sync_len = 0.009f; @@ -80,7 +80,7 @@ void robot72_mode() { save_dat = 1; save_cnt = 0; - mode = mode_robot72; + current_mode = mode_robot72; const float tolerance = 0.8f; const float settling_time = 0.0011f; const float sync_len = 0.009f; @@ -109,7 +109,7 @@ void martin1_mode() { save_cnt = 0; save_dat = 1; - mode = mode_martin1; + current_mode = mode_martin1; const float tolerance = 0.5f; const float sync_len = 0.004862f; const float sync_porch_len = 0.000572f; @@ -132,7 +132,7 @@ void martin2_mode() { save_cnt = 0; save_dat = 1; - mode = mode_martin2; + current_mode = mode_martin2; const float tolerance = 0.5f; const float sync_len = 0.004862f; const float sync_porch_len = 0.000572f; @@ -155,7 +155,7 @@ void scottie1_mode() { save_cnt = 0; save_dat = 1; - mode = mode_scottie1; + current_mode = mode_scottie1; const float tolerance = 0.8f; const float settling_time = 0.0011f; const float sync_len = 0.009f; @@ -179,7 +179,7 @@ void scottie2_mode() { save_cnt = 0; save_dat = 1; - mode = mode_scottie2; + current_mode = mode_scottie2; const float tolerance = 0.8f; const float settling_time = 0.0011f; const float sync_len = 0.009f; @@ -203,7 +203,7 @@ void scottieDX_mode() { save_cnt = 0; save_dat = 1; - mode = mode_scottieDX; + current_mode = mode_scottieDX; const float tolerance = 0.8f; const float settling_time = 0.0011f; const float sync_len = 0.009f; @@ -226,7 +226,7 @@ void scottieDX_mode() static void switch_mode(int new_mode) { - if (new_mode == mode) + if (new_mode == current_mode) return; switch (new_mode) { case mode_robot36: diff --git a/app/src/main/rs/state.rsh b/app/src/main/rs/state.rsh index fecf11d..c20c538 100644 --- a/app/src/main/rs/state.rsh +++ b/app/src/main/rs/state.rsh @@ -20,7 +20,7 @@ limitations under the License. static ema_t avg_power, leader_lowpass; static ddc_t cnt_ddc, dat_ddc; static fmd_t cnt_fmd, dat_fmd; -static int sample_rate, mode, even_hpos; +static int sample_rate, current_mode, even_hpos; static int maximum_variance, minimum_sync_length; static int scanline_length, minimum_length, maximum_length; static int vis_timeout, vis_length, bit_length;