mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-22 05:14:46 -07:00
@@ -62,7 +62,8 @@ void render_view_raw_pulses(Canvas* const canvas, ProtoViewApp* app) {
|
||||
canvas_draw_str_with_border(canvas, 97, 63, buf, ColorWhite, ColorBlack);
|
||||
if(app->signal_decoded) {
|
||||
canvas_set_font(canvas, FontPrimary);
|
||||
canvas_draw_str_with_border(canvas, 1, 61, app->msg_info->name, ColorWhite, ColorBlack);
|
||||
canvas_draw_str_with_border(
|
||||
canvas, 1, 61, app->msg_info->decoder->name, ColorWhite, ColorBlack);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,14 +77,15 @@ void process_input_raw_pulses(ProtoViewApp* app, InputEvent input) {
|
||||
app->signal_offset++;
|
||||
else if(input.key == InputKeyLeft)
|
||||
app->signal_offset--;
|
||||
else if(input.key == InputKeyOk) {
|
||||
app->signal_offset = 0;
|
||||
app->us_scale = PROTOVIEW_RAW_VIEW_DEFAULT_SCALE;
|
||||
}
|
||||
} else if(input.type == InputTypeShort) {
|
||||
} else if(input.type == InputTypeLong) {
|
||||
if(input.key == InputKeyOk) {
|
||||
/* Reset the current sample to capture the next. */
|
||||
reset_current_signal(app);
|
||||
}
|
||||
} else if(input.type == InputTypeShort) {
|
||||
if(input.key == InputKeyOk) {
|
||||
app->signal_offset = 0;
|
||||
adjust_raw_view_scale(app, DetectedSamples->short_pulse_dur);
|
||||
} else if(input.key == InputKeyDown) {
|
||||
/* Rescaling. The set becomes finer under 50us per pixel. */
|
||||
uint32_t scale_step = app->us_scale >= 50 ? 50 : 10;
|
||||
@@ -94,3 +96,19 @@ void process_input_raw_pulses(ProtoViewApp* app, InputEvent input) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Adjust raw view scale depending on short pulse duration. */
|
||||
void adjust_raw_view_scale(ProtoViewApp* app, uint32_t short_pulse_dur) {
|
||||
if(short_pulse_dur == 0)
|
||||
app->us_scale = PROTOVIEW_RAW_VIEW_DEFAULT_SCALE;
|
||||
else if(short_pulse_dur < 75)
|
||||
app->us_scale = 10;
|
||||
else if(short_pulse_dur < 145)
|
||||
app->us_scale = 30;
|
||||
else if(short_pulse_dur < 400)
|
||||
app->us_scale = 100;
|
||||
else if(short_pulse_dur < 1000)
|
||||
app->us_scale = 200;
|
||||
else
|
||||
app->us_scale = PROTOVIEW_RAW_VIEW_DEFAULT_SCALE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user