mirror of
https://github.com/eried/portapack-mayhem.git
synced 2024-10-01 01:26:06 -04:00
Allow 3 boot failures before Config Mode starts (#1816)
* Allow 3 boot attempts before Config Mode starts * Add files via upload
This commit is contained in:
parent
a2f6d14b15
commit
df47490d85
@ -27,14 +27,19 @@
|
|||||||
void config_mode_blink_until_dfu();
|
void config_mode_blink_until_dfu();
|
||||||
|
|
||||||
void config_mode_set() {
|
void config_mode_set() {
|
||||||
portapack::persistent_memory::set_config_mode_storage_direct(CONFIG_MODE_GUARD_VALUE);
|
uint32_t cms = portapack::persistent_memory::config_mode_storage_direct();
|
||||||
|
if ((cms >= CONFIG_MODE_GUARD_VALUE) && (cms < CONFIG_MODE_LIMIT_VALUE))
|
||||||
|
cms += 1;
|
||||||
|
else
|
||||||
|
cms = CONFIG_MODE_GUARD_VALUE;
|
||||||
|
portapack::persistent_memory::set_config_mode_storage_direct(cms);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool config_mode_should_enter() {
|
bool config_mode_should_enter() {
|
||||||
if (portapack::persistent_memory::config_disable_config_mode_direct())
|
if (portapack::persistent_memory::config_disable_config_mode_direct())
|
||||||
return false;
|
return false;
|
||||||
else
|
else
|
||||||
return portapack::persistent_memory::config_mode_storage_direct() == CONFIG_MODE_GUARD_VALUE;
|
return portapack::persistent_memory::config_mode_storage_direct() == CONFIG_MODE_LIMIT_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void config_mode_clear() {
|
void config_mode_clear() {
|
||||||
|
@ -28,6 +28,13 @@
|
|||||||
#include "portapack_shared_memory.hpp"
|
#include "portapack_shared_memory.hpp"
|
||||||
#include "portapack_persistent_memory.hpp"
|
#include "portapack_persistent_memory.hpp"
|
||||||
|
|
||||||
|
// number of boot failures before entering config menu mode
|
||||||
|
#define BOOT_FAILURES_BEFORE_CONFIG_MODE 3
|
||||||
|
|
||||||
|
#define CONFIG_MODE_GUARD_VALUE 0xbadb0000
|
||||||
|
#define CONFIG_MODE_LIMIT_VALUE (CONFIG_MODE_GUARD_VALUE + BOOT_FAILURES_BEFORE_CONFIG_MODE - 1)
|
||||||
|
#define CONFIG_MODE_NORMAL_VALUE 0x000007cf
|
||||||
|
|
||||||
void config_mode_set();
|
void config_mode_set();
|
||||||
bool config_mode_should_enter();
|
bool config_mode_should_enter();
|
||||||
void config_mode_clear();
|
void config_mode_clear();
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
#include "modems.hpp"
|
#include "modems.hpp"
|
||||||
#include "serializer.hpp"
|
#include "serializer.hpp"
|
||||||
#include "volume.hpp"
|
#include "volume.hpp"
|
||||||
|
#include "config_mode.hpp"
|
||||||
|
|
||||||
// persistent memory from/to sdcard flag file
|
// persistent memory from/to sdcard flag file
|
||||||
#define PMEM_FILEFLAG u"/SETTINGS/PMEM_FILEFLAG"
|
#define PMEM_FILEFLAG u"/SETTINGS/PMEM_FILEFLAG"
|
||||||
@ -242,8 +243,6 @@ void set_disable_touchscreen(bool v);
|
|||||||
uint8_t config_encoder_dial_sensitivity();
|
uint8_t config_encoder_dial_sensitivity();
|
||||||
void set_encoder_dial_sensitivity(uint8_t v);
|
void set_encoder_dial_sensitivity(uint8_t v);
|
||||||
|
|
||||||
#define CONFIG_MODE_GUARD_VALUE 0x000007d1
|
|
||||||
#define CONFIG_MODE_NORMAL_VALUE 0x000007cf
|
|
||||||
uint32_t config_mode_storage_direct();
|
uint32_t config_mode_storage_direct();
|
||||||
void set_config_mode_storage_direct(uint32_t v);
|
void set_config_mode_storage_direct(uint32_t v);
|
||||||
bool config_disable_config_mode_direct();
|
bool config_disable_config_mode_direct();
|
||||||
|
Loading…
Reference in New Issue
Block a user