Skip to content

Commit

Permalink
fix oled
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon Dawson committed Sep 1, 2024
1 parent b81393b commit e85f19f
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
Binary file modified build/picorx.uf2
Binary file not shown.
1 change: 1 addition & 0 deletions rx_dsp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,7 @@ void rx_dsp :: set_cw_sidetone_Hz(uint16_t val)
void rx_dsp :: set_gain_cal_dB(uint16_t val)
{
amplifier_gain_dB = val;
s9_threshold = full_scale_signal_strength*powf(10.0f, (S9 - full_scale_dBm + amplifier_gain_dB)/20.0f);
}

//volume settings 0 to 9
Expand Down
1 change: 1 addition & 0 deletions rx_dsp.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ class rx_dsp

//squelch
int16_t squelch_threshold=0;
int16_t s9_threshold=0;

//used in AGC
uint8_t attack_factor;
Expand Down
13 changes: 6 additions & 7 deletions ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -474,11 +474,10 @@ void ui::autorestore()
}

apply_settings(false);
ssd1306_flip(&disp, settings[idx_hw_setup] >> flag_flip_oled);
uint8_t display_timeout_setting = (settings[idx_hw_setup] & mask_display_timeout) >> flag_display_timeout;
display_timer = timeout_lookup[display_timeout_setting];
ssd1306_flip(&disp, settings_to_apply.flip_oled );
ssd1306_type(&disp, settings_to_apply.oled_type );
ssd1306_flip(&disp, (settings[idx_hw_setup] >> flag_flip_oled) & 1);
ssd1306_type(&disp, (settings[idx_hw_setup] >> flag_oled_type) & 1);

}

Expand Down Expand Up @@ -1082,12 +1081,12 @@ bool ui::configuration_menu()

case 5:
rx_settings_changed = bit_entry("Flip Oled", "Off#On#", flag_flip_oled, &settings[idx_hw_setup]);
ssd1306_flip(&disp, settings[idx_hw_setup] >> flag_flip_oled);
ssd1306_flip(&disp, (settings[idx_hw_setup] >> flag_flip_oled) & 1);
break;

case 6:
rx_settings_changed = bit_entry("Oled Type", "SSD1306#SH1106#", flag_oled_type, &settings[idx_hw_setup]);
ssd1306_type(&disp, settings[idx_hw_setup] >> flag_oled_type);
ssd1306_type(&disp, (settings[idx_hw_setup] >> flag_oled_type) & 1);
break;

case 7:
Expand Down Expand Up @@ -1123,7 +1122,7 @@ void ui::do_ui(void)
uint32_t encoder_change = get_encoder_change();

//automatically switch off display after a period of inactivity
if(!display_timeout(encoder_change)) return false;
if(!display_timeout(encoder_change)) return;

//update frequency if encoder changes
switch(button_state)
Expand Down Expand Up @@ -1207,7 +1206,7 @@ void ui::do_ui(void)

//top level menu
uint32_t setting = 0;
if(!enumerate_entry("menu:", "Frequency#Recall#Store#Volume#Mode#AGC Speed#Bandwidth#Squelch#Frequency Step#CW Sidetone Frequency#Configuration", 10, &setting)) return 1;
if(!enumerate_entry("menu:", "Frequency#Recall#Store#Volume#Mode#AGC Speed#Bandwidth#Squelch#Frequency Step#CW Sidetone Frequency#Configuration", 10, &setting)) return;

switch(setting)
{
Expand Down
2 changes: 1 addition & 1 deletion ui.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const uint8_t PIN_DISPLAY_SCL = 19;
#define flag_flip_oled 2
#define flag_oled_type 3
#define flag_display_timeout 4
#define mask_display_timeout (0x7 << 3)
#define mask_display_timeout (0x7 << flag_display_timeout)

// define wait macros
#define WAIT_10MS sleep_us(10000);
Expand Down

0 comments on commit e85f19f

Please sign in to comment.