mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-01-25 14:08:23 -05:00
Pmem reset (#1115)
* reset config when holding down select durring boot it still need to be tripple checked if adc or control init really doesnt use any pmem * one less magic number :) * dual key action left+right for pmem reset --------- Co-authored-by: Eisenberger Tamas <e.tamas@iwstudio.hu>
This commit is contained in:
parent
d3a7414e51
commit
3ddc753c88
@ -233,20 +233,23 @@ static PortaPackModel portapack_model() {
|
|||||||
|
|
||||||
if (!model.is_valid()) {
|
if (!model.is_valid()) {
|
||||||
const auto switches_state = get_switches_state();
|
const auto switches_state = get_switches_state();
|
||||||
if (switches_state[(size_t)ui::KeyEvent::Up]) {
|
// Only save config if no other multi key boot action is triggered (like pmem reset)
|
||||||
save_config(1);
|
if (switches_state.count() == 1) {
|
||||||
// model = PortaPackModel::R2_20170522; // Commented these out as they should be set down below anyway
|
if (switches_state[(size_t)ui::KeyEvent::Up]) {
|
||||||
} else if (switches_state[(size_t)ui::KeyEvent::Down]) {
|
save_config(1);
|
||||||
save_config(2);
|
// model = PortaPackModel::R2_20170522; // Commented these out as they should be set down below anyway
|
||||||
// model = PortaPackModel::R1_20150901;
|
} else if (switches_state[(size_t)ui::KeyEvent::Down]) {
|
||||||
} else if (switches_state[(size_t)ui::KeyEvent::Left]) {
|
save_config(2);
|
||||||
save_config(3);
|
// model = PortaPackModel::R1_20150901;
|
||||||
// model = PortaPackModel::R1_20150901;
|
} else if (switches_state[(size_t)ui::KeyEvent::Left]) {
|
||||||
} else if (switches_state[(size_t)ui::KeyEvent::Right]) {
|
save_config(3);
|
||||||
save_config(4);
|
// model = PortaPackModel::R1_20150901;
|
||||||
// model = PortaPackModel::R2_20170522;
|
} else if (switches_state[(size_t)ui::KeyEvent::Right]) {
|
||||||
} else if (switches_state[(size_t)ui::KeyEvent::Select]) {
|
save_config(4);
|
||||||
save_config(0);
|
// model = PortaPackModel::R2_20170522;
|
||||||
|
} else if (switches_state[(size_t)ui::KeyEvent::Select]) {
|
||||||
|
save_config(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (load_config() == 1) {
|
if (load_config() == 1) {
|
||||||
@ -469,13 +472,13 @@ bool init() {
|
|||||||
i2c0.start(i2c_config_fast_clock);
|
i2c0.start(i2c_config_fast_clock);
|
||||||
chThdSleepMilliseconds(10);
|
chThdSleepMilliseconds(10);
|
||||||
|
|
||||||
/* Cache some configuration data from persistent memory. */
|
|
||||||
persistent_memory::cache::init();
|
|
||||||
|
|
||||||
touch::adc::init();
|
touch::adc::init();
|
||||||
controls_init();
|
controls_init();
|
||||||
chThdSleepMilliseconds(10);
|
chThdSleepMilliseconds(10);
|
||||||
|
|
||||||
|
/* Cache some configuration data from persistent memory. */
|
||||||
|
persistent_memory::cache::init();
|
||||||
|
|
||||||
clock_manager.set_reference_ppb(persistent_memory::correction_ppb());
|
clock_manager.set_reference_ppb(persistent_memory::correction_ppb());
|
||||||
clock_manager.enable_if_clocks();
|
clock_manager.enable_if_clocks();
|
||||||
clock_manager.enable_codec_clocks();
|
clock_manager.enable_codec_clocks();
|
||||||
|
@ -39,6 +39,8 @@
|
|||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include "file.hpp"
|
#include "file.hpp"
|
||||||
|
|
||||||
|
#include "irq_controls.hpp"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
namespace portapack {
|
namespace portapack {
|
||||||
@ -445,7 +447,8 @@ void defaults() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void init() {
|
void init() {
|
||||||
if (backup_ram->is_valid()) {
|
const auto switches_state = get_switches_state();
|
||||||
|
if (!(switches_state[(size_t)ui::KeyEvent::Left] && switches_state[(size_t)ui::KeyEvent::Right]) && backup_ram->is_valid()) {
|
||||||
// Copy valid persistent data into cache.
|
// Copy valid persistent data into cache.
|
||||||
cached_backup_ram = *backup_ram;
|
cached_backup_ram = *backup_ram;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user