mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-08-05 21:24:27 -04:00
parent
31082c63af
commit
809abb6842
6 changed files with 29 additions and 7 deletions
|
@ -1044,12 +1044,14 @@ SetBatteryView::SetBatteryView(NavigationView& nav) {
|
||||||
add_children({&labels,
|
add_children({&labels,
|
||||||
&button_save,
|
&button_save,
|
||||||
&button_cancel,
|
&button_cancel,
|
||||||
&checkbox_overridebatt});
|
&checkbox_overridebatt,
|
||||||
|
&checkbox_battery_charge_hint});
|
||||||
|
|
||||||
if (i2cdev::I2CDevManager::get_dev_by_model(I2C_DEVMDL::I2CDEVMDL_MAX17055)) add_children({&button_reset, &labels2});
|
if (i2cdev::I2CDevManager::get_dev_by_model(I2C_DEVMDL::I2CDEVMDL_MAX17055)) add_children({&button_reset, &labels2});
|
||||||
|
|
||||||
button_save.on_select = [&nav, this](Button&) {
|
button_save.on_select = [&nav, this](Button&) {
|
||||||
pmem::set_ui_override_batt_calc(checkbox_overridebatt.value());
|
pmem::set_ui_override_batt_calc(checkbox_overridebatt.value());
|
||||||
|
pmem::set_ui_battery_charge_hint(checkbox_battery_charge_hint.value());
|
||||||
battery::BatteryManagement::set_calc_override(checkbox_overridebatt.value());
|
battery::BatteryManagement::set_calc_override(checkbox_overridebatt.value());
|
||||||
send_system_refresh();
|
send_system_refresh();
|
||||||
nav.pop();
|
nav.pop();
|
||||||
|
@ -1064,6 +1066,7 @@ SetBatteryView::SetBatteryView(NavigationView& nav) {
|
||||||
};
|
};
|
||||||
|
|
||||||
checkbox_overridebatt.set_value(pmem::ui_override_batt_calc());
|
checkbox_overridebatt.set_value(pmem::ui_override_batt_calc());
|
||||||
|
checkbox_battery_charge_hint.set_value(pmem::ui_battery_charge_hint());
|
||||||
|
|
||||||
button_cancel.on_select = [&nav, this](Button&) {
|
button_cancel.on_select = [&nav, this](Button&) {
|
||||||
nav.pop();
|
nav.pop();
|
||||||
|
|
|
@ -978,9 +978,13 @@ class SetBatteryView : public View {
|
||||||
int32_t selected = 0;
|
int32_t selected = 0;
|
||||||
Labels labels{
|
Labels labels{
|
||||||
{{1 * 8, 1 * 16}, "Override batt calculation", Theme::getInstance()->fg_light->foreground},
|
{{1 * 8, 1 * 16}, "Override batt calculation", Theme::getInstance()->fg_light->foreground},
|
||||||
{{1 * 8, 2 * 16}, "method to voltage based", Theme::getInstance()->fg_light->foreground}};
|
{{1 * 8, 2 * 16}, "method to voltage based", Theme::getInstance()->fg_light->foreground},
|
||||||
Labels labels2{
|
/**/
|
||||||
{{1 * 8, 6 * 16}, "Reset IC's learned params.", Theme::getInstance()->fg_light->foreground}};
|
{{1 * 8, 6 * 16}, "Display a hint to remind you", Theme::getInstance()->fg_light->foreground},
|
||||||
|
{{1 * 8, 7 * 16}, "when you charge", Theme::getInstance()->fg_light->foreground}};
|
||||||
|
|
||||||
|
Labels labels2{{{1 * 8, 11 * 16}, "Reset IC's learned params.", Theme::getInstance()->fg_light->foreground}};
|
||||||
|
|
||||||
Button button_save{
|
Button button_save{
|
||||||
{2 * 8, 16 * 16, 12 * 8, 32},
|
{2 * 8, 16 * 16, 12 * 8, 32},
|
||||||
"Save"};
|
"Save"};
|
||||||
|
@ -990,13 +994,18 @@ class SetBatteryView : public View {
|
||||||
23,
|
23,
|
||||||
"Override"};
|
"Override"};
|
||||||
|
|
||||||
|
Checkbox checkbox_battery_charge_hint{
|
||||||
|
{2 * 8, 9 * 16},
|
||||||
|
23,
|
||||||
|
"Charge hint"};
|
||||||
|
|
||||||
Button button_cancel{
|
Button button_cancel{
|
||||||
{16 * 8, 16 * 16, 12 * 8, 32},
|
{16 * 8, 16 * 16, 12 * 8, 32},
|
||||||
"Cancel",
|
"Cancel",
|
||||||
};
|
};
|
||||||
|
|
||||||
Button button_reset{
|
Button button_reset{
|
||||||
{2 * 8, 8 * 16, 12 * 8, 32},
|
{2 * 8, 13 * 16, 12 * 8, 32},
|
||||||
"Reset",
|
"Reset",
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -128,6 +128,7 @@ bool DebugDumpView::debug_dump_func() {
|
||||||
pmem_dump_file.write_line("ui_config2 button_repeat_delay: " + to_string_dec_uint(ui_button_repeat_delay()));
|
pmem_dump_file.write_line("ui_config2 button_repeat_delay: " + to_string_dec_uint(ui_button_repeat_delay()));
|
||||||
pmem_dump_file.write_line("ui_config2 button_repeat_speed: " + to_string_dec_uint(ui_button_repeat_speed()));
|
pmem_dump_file.write_line("ui_config2 button_repeat_speed: " + to_string_dec_uint(ui_button_repeat_speed()));
|
||||||
pmem_dump_file.write_line("ui_config2 button_long_press_delay: " + to_string_dec_uint(ui_button_long_press_delay()));
|
pmem_dump_file.write_line("ui_config2 button_long_press_delay: " + to_string_dec_uint(ui_button_long_press_delay()));
|
||||||
|
pmem_dump_file.write_line("ui_config2 battery_charge_hint: " + to_string_dec_uint(ui_battery_charge_hint()));
|
||||||
|
|
||||||
// misc_config bits
|
// misc_config bits
|
||||||
pmem_dump_file.write_line("misc_config config_audio_mute: " + to_string_dec_int(config_audio_mute()));
|
pmem_dump_file.write_line("misc_config config_audio_mute: " + to_string_dec_int(config_audio_mute()));
|
||||||
|
|
|
@ -343,7 +343,7 @@ void SystemStatusView::on_battery_data(const BatteryStateMessage* msg) {
|
||||||
|
|
||||||
// Check if charging state changed to charging
|
// Check if charging state changed to charging
|
||||||
static bool was_charging = false;
|
static bool was_charging = false;
|
||||||
if (msg->on_charger && !was_charging) {
|
if (msg->on_charger && !was_charging && pmem::ui_battery_charge_hint()) {
|
||||||
// Only show charging modal when transitioning to charging state
|
// Only show charging modal when transitioning to charging state
|
||||||
nav_.display_modal(
|
nav_.display_modal(
|
||||||
"CHARGING",
|
"CHARGING",
|
||||||
|
|
|
@ -137,9 +137,9 @@ struct ui_config2_t {
|
||||||
bool button_repeat_delay : 1;
|
bool button_repeat_delay : 1;
|
||||||
bool button_repeat_speed : 1;
|
bool button_repeat_speed : 1;
|
||||||
bool button_long_press_delay : 1;
|
bool button_long_press_delay : 1;
|
||||||
|
bool battery_charge_hint : 1;
|
||||||
|
|
||||||
uint8_t theme_id;
|
uint8_t theme_id;
|
||||||
uint8_t PLACEHOLDER_3;
|
|
||||||
};
|
};
|
||||||
static_assert(sizeof(ui_config2_t) == sizeof(uint32_t));
|
static_assert(sizeof(ui_config2_t) == sizeof(uint32_t));
|
||||||
|
|
||||||
|
@ -981,6 +981,9 @@ bool ui_button_repeat_speed() {
|
||||||
bool ui_button_long_press_delay() {
|
bool ui_button_long_press_delay() {
|
||||||
return data->ui_config2.button_long_press_delay;
|
return data->ui_config2.button_long_press_delay;
|
||||||
}
|
}
|
||||||
|
bool ui_battery_charge_hint() {
|
||||||
|
return data->ui_config2.battery_charge_hint;
|
||||||
|
}
|
||||||
|
|
||||||
void set_ui_hide_speaker(bool v) {
|
void set_ui_hide_speaker(bool v) {
|
||||||
data->ui_config2.hide_speaker = v;
|
data->ui_config2.hide_speaker = v;
|
||||||
|
@ -1035,6 +1038,9 @@ void set_ui_button_repeat_speed(bool v) {
|
||||||
void set_ui_button_long_press_delay(bool v) {
|
void set_ui_button_long_press_delay(bool v) {
|
||||||
data->ui_config2.button_long_press_delay = v;
|
data->ui_config2.button_long_press_delay = v;
|
||||||
}
|
}
|
||||||
|
void set_ui_battery_charge_hint(bool v) {
|
||||||
|
data->ui_config2.battery_charge_hint = v;
|
||||||
|
}
|
||||||
|
|
||||||
/* Converter */
|
/* Converter */
|
||||||
bool config_converter() {
|
bool config_converter() {
|
||||||
|
|
|
@ -350,6 +350,8 @@ bool ui_override_batt_calc();
|
||||||
bool ui_button_repeat_delay();
|
bool ui_button_repeat_delay();
|
||||||
bool ui_button_repeat_speed();
|
bool ui_button_repeat_speed();
|
||||||
bool ui_button_long_press_delay();
|
bool ui_button_long_press_delay();
|
||||||
|
bool ui_battery_charge_hint();
|
||||||
|
|
||||||
void set_ui_hide_speaker(bool v);
|
void set_ui_hide_speaker(bool v);
|
||||||
void set_ui_hide_mute(bool v);
|
void set_ui_hide_mute(bool v);
|
||||||
void set_ui_hide_converter(bool v);
|
void set_ui_hide_converter(bool v);
|
||||||
|
@ -367,6 +369,7 @@ void set_ui_override_batt_calc(bool v);
|
||||||
void set_ui_button_repeat_delay(bool v);
|
void set_ui_button_repeat_delay(bool v);
|
||||||
void set_ui_button_repeat_speed(bool v);
|
void set_ui_button_repeat_speed(bool v);
|
||||||
void set_ui_button_long_press_delay(bool v);
|
void set_ui_button_long_press_delay(bool v);
|
||||||
|
void set_ui_battery_charge_hint(bool v);
|
||||||
|
|
||||||
// sd persisting settings
|
// sd persisting settings
|
||||||
bool should_use_sdcard_for_pmem();
|
bool should_use_sdcard_for_pmem();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue