mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-01-22 20:51:26 -05:00
Treat encoder rate multiplier value of 0 in pmem the same as 1 (#1898)
* Double-check encoder rate multiplier is not 0 * Eliminated redundant check in pmem init()
This commit is contained in:
parent
c3add0ce84
commit
8b5adb6bc1
@ -229,7 +229,9 @@ struct data_t {
|
|||||||
uint16_t fake_brightness_level : 4;
|
uint16_t fake_brightness_level : 4;
|
||||||
|
|
||||||
// Encoder rotation rate multiplier for larger increments when rotated rapidly
|
// Encoder rotation rate multiplier for larger increments when rotated rapidly
|
||||||
uint16_t encoder_rate_multiplier : 8;
|
uint16_t encoder_rate_multiplier : 4;
|
||||||
|
|
||||||
|
uint16_t UNUSED : 4;
|
||||||
|
|
||||||
// Headphone volume in centibels.
|
// Headphone volume in centibels.
|
||||||
int16_t headphone_volume_cb;
|
int16_t headphone_volume_cb;
|
||||||
@ -296,6 +298,8 @@ struct data_t {
|
|||||||
encoder_dial_sensitivity(DIAL_SENSITIVITY_NORMAL),
|
encoder_dial_sensitivity(DIAL_SENSITIVITY_NORMAL),
|
||||||
fake_brightness_level(BRIGHTNESS_50),
|
fake_brightness_level(BRIGHTNESS_50),
|
||||||
encoder_rate_multiplier(1),
|
encoder_rate_multiplier(1),
|
||||||
|
UNUSED(0),
|
||||||
|
|
||||||
headphone_volume_cb(-600),
|
headphone_volume_cb(-600),
|
||||||
misc_config(),
|
misc_config(),
|
||||||
ui_config2(),
|
ui_config2(),
|
||||||
@ -457,7 +461,6 @@ void init() {
|
|||||||
|
|
||||||
// Firmware upgrade handling - adjust newly defined fields where 0 is an invalid default
|
// Firmware upgrade handling - adjust newly defined fields where 0 is an invalid default
|
||||||
if (fake_brightness_level() == 0) set_fake_brightness_level(BRIGHTNESS_50);
|
if (fake_brightness_level() == 0) set_fake_brightness_level(BRIGHTNESS_50);
|
||||||
if (encoder_rate_multiplier() == 0) set_encoder_rate_multiplier(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void persist() {
|
void persist() {
|
||||||
@ -989,7 +992,9 @@ void set_encoder_dial_sensitivity(uint8_t v) {
|
|||||||
data->encoder_dial_sensitivity = v;
|
data->encoder_dial_sensitivity = v;
|
||||||
}
|
}
|
||||||
uint8_t encoder_rate_multiplier() {
|
uint8_t encoder_rate_multiplier() {
|
||||||
return data->encoder_rate_multiplier;
|
uint8_t v = data->encoder_rate_multiplier;
|
||||||
|
if (v == 0) v = 1; // minimum value is 1; treat 0 the same as 1
|
||||||
|
return v;
|
||||||
}
|
}
|
||||||
void set_encoder_rate_multiplier(uint8_t v) {
|
void set_encoder_rate_multiplier(uint8_t v) {
|
||||||
data->encoder_rate_multiplier = v;
|
data->encoder_rate_multiplier = v;
|
||||||
|
Loading…
Reference in New Issue
Block a user