Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix encoder setting p.mem issue #2475

Merged
merged 2 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion firmware/application/apps/ui_flash_utility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,4 +177,4 @@ void FlashUtilityView::focus() {
menu_view.focus();
}

} /* namespace ui */
} /* namespace ui */
4 changes: 2 additions & 2 deletions firmware/application/apps/ui_settings.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -615,8 +615,8 @@ class SetEncoderDialView : public View {
OptionsField field_encoder_dial_direction{
{18 * 8, 14 * 16},
7,
{{"NORMAL", encoder_dial_direction::DIAL_DIRECTION_NORMAL},
{"REVERSE", encoder_dial_direction::DIAL_DIRECTION_REVERSE}}};
{{"NORMAL", false},
{"REVERSE", true}}};

Button button_dial_sensitivity_plus{
{20 * 8, 2 * 16, 16, 16},
Expand Down
4 changes: 2 additions & 2 deletions firmware/application/hw/encoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ int_fast8_t Encoder::update(const uint_fast8_t phase_bits) {
if ((sensitivity_map[portapack::persistent_memory::encoder_dial_sensitivity()] & (1 << state)) == 0)
return 0;

// true: normal, false: reverse
if (!portapack::persistent_memory::encoder_dial_direction())
// false: normal, true: reverse
if (portapack::persistent_memory::encoder_dial_direction())
direction = -direction;

return direction;
Expand Down
8 changes: 4 additions & 4 deletions firmware/common/portapack_persistent_memory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ struct data_t {
bool updown_frequency_rx_correction;
bool updown_frequency_tx_correction;
bool lcd_inverted_mode : 1;
bool encoder_dial_direction : 1; // true = normal, false = reverse
bool encoder_dial_direction : 1; // false = normal, true = reverse
bool UNUSED_6 : 1;
bool UNUSED_7 : 1;

Expand Down Expand Up @@ -417,8 +417,8 @@ void defaults() {
set_config_splash(true);
set_config_disable_external_tcxo(false);
set_encoder_dial_sensitivity(DIAL_SENSITIVITY_NORMAL);
set_encoder_dial_direction(true);
set_config_speaker_disable(true); // Disable AK4951 speaker by default (in case of OpenSourceSDRLab H2)
set_encoder_dial_direction(false); // false = normal, true = reverse
set_config_speaker_disable(true); // Disable AK4951 speaker by default (in case of OpenSourceSDRLab H2)
set_menu_color(Color::grey());
set_ui_hide_numeric_battery(true); // hide the numeric battery by default - no space to display it

Expand Down Expand Up @@ -1254,7 +1254,7 @@ bool debug_dump() {
pmem_dump_file.write_line("frequency_tx_correction: " + to_string_dec_uint(data->frequency_tx_correction));
pmem_dump_file.write_line("encoder_dial_sensitivity: " + to_string_dec_uint(data->encoder_dial_sensitivity));
pmem_dump_file.write_line("encoder_rate_multiplier: " + to_string_dec_uint(data->encoder_rate_multiplier));
pmem_dump_file.write_line("encoder_dial_direction: " + to_string_dec_uint(data->encoder_dial_direction));
pmem_dump_file.write_line("encoder_dial_direction: " + to_string_dec_uint(data->encoder_dial_direction)); // 0 = normal, 1 = reverse
pmem_dump_file.write_line("headphone_volume_cb: " + to_string_dec_int(data->headphone_volume_cb));
pmem_dump_file.write_line("config_mode_storage: 0x" + to_string_hex(data->config_mode_storage, 8));
pmem_dump_file.write_line("dst_config: 0x" + to_string_hex((uint32_t)data->dst_config.v, 8));
Expand Down
5 changes: 0 additions & 5 deletions firmware/common/portapack_persistent_memory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,6 @@ enum encoder_dial_sensitivity {
NUM_DIAL_SENSITIVITY
};

enum encoder_dial_direction {
DIAL_DIRECTION_NORMAL = true,
DIAL_DIRECTION_REVERSE = false,
};

typedef union {
uint32_t v;
struct {
Expand Down
Loading