Skip to content

Commit

Permalink
Fix standby on spectrum, plus some other improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrej committed Sep 10, 2024
1 parent 3b5620f commit 45bf835
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion openrtx/include/core/input.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
/**
* Time interval in milliseconds after which a keypress is considered a long-press
*/
static const uint16_t input_longPressTimeout = 25;
static const uint16_t input_longPressTimeout = 500;

/**
* Structure that represents a keyboard event payload
Expand Down
2 changes: 1 addition & 1 deletion openrtx/src/core/state.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ void state_task()
// Update radio state once every 100ms (or faster for spectrum)
if(state.rtxStatus != RTX_SPECTRUM && (getTick() - lastUpdate) < 150)
return;
if((getTick() - lastUpdate) < 20)
if((getTick() - lastUpdate) < 30)
return;

lastUpdate = getTick();
Expand Down
2 changes: 2 additions & 0 deletions openrtx/src/ui/default/ui.c
Original file line number Diff line number Diff line change
Expand Up @@ -1836,6 +1836,8 @@ void ui_updateFSM(bool *sync_rtx)
state.ui_screen = MENU_SPECTRUM;
state.rtxStatus = RTX_SPECTRUM;
state.spectrum_currentPart = 0;
// Fill the waterfall with blue, to make it less jarring
gfx_drawRect((point_t){88, 0}, 44, 128, (color_t){0,0,255}, true);
break;
#endif
case M_SETTINGS:
Expand Down
6 changes: 4 additions & 2 deletions openrtx/src/ui/default/ui_menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -754,6 +754,7 @@ void _ui_drawMenuSpectrum(ui_state_t* ui_state)
state.spectrum_currentWFLine = (state.spectrum_currentWFLine + 1) % 44;
display_scroll(state.spectrum_currentWFLine);
gfx_clearWindow(0,0,128,116);

// Draw all the bars in the spectrum
for (int i = 0; i < NUMBER_BARS; i++)
{
Expand Down Expand Up @@ -802,6 +803,7 @@ void _ui_drawMenuSpectrum(ui_state_t* ui_state)
}
int16_t rssi = bk4819_get_rssi();
uint8_t height = (rssi + 160)/2;
height = height*exp((2*height-60)/80);
// Don't draw, just store the values in a buffer
state.spectrum_data[i] = height;
// If the current value is higher than the last peak, update the peak
Expand Down Expand Up @@ -840,12 +842,12 @@ color_t spectrum_getColorFromLevel(uint16_t Level) {
G = 255;
B = 255;
} else if (Level <= 50) {
Level = (Level * 100) / 70;
Level = (Level * 100) / 50;
R = 0; // Blue_R + ((Green_R - Blue_R) * Level / 100);
G = Blue_G + ((Green_G - Blue_G) * Level / 100);
B = Blue_B + ((Green_B - Blue_B) * Level / 100);
} else {
Level = ((Level - 70) * 100) / 30;
Level = ((Level - 50) * 100) / 3;
R = Green_R + ((Red_R - Green_R) * Level / 100);
G = Green_G + ((Red_G - Green_G) * Level / 100);
B = 0; // Green_B + ((Red_B - Green_B) * Level / 100);
Expand Down

0 comments on commit 45bf835

Please sign in to comment.