Files
libGravity/examples/Gravity/app_state.h
Adam Wonak d12764313b Introduce StateManager to persist state between power cycles (#6)
- add reset state menu option to return all settings back to default values.
- add reverse encoder menu option and save state
- make saving to EEPROM safer by wrapping put calls with noInterrupts()
- improve save state behavior by using a mutex flag and update check with debounce in main loop
- refactor gravity.h global const definitions to be static and more readable.
- improve usage of EncoderDir in ISR with pointer to instance and static isr() method.
- reduce u8g2 memory usage by using single page buffer

Reviewed-on: https://git.pinkduck.xyz/adam/libGravity/pulls/6
Co-authored-by: Adam Wonak <adam.wonak@gmail.com>
Co-committed-by: Adam Wonak <adam.wonak@gmail.com>
2025-06-16 02:47:25 +00:00

21 lines
540 B
C

#ifndef APP_STATE_H
#define APP_STATE_H
#include <gravity.h>
#include "channel.h"
// Global state for settings and app behavior.
struct AppState {
int tempo = Clock::DEFAULT_TEMPO;
bool encoder_reversed = false;
bool refresh_screen = true;
bool editing_param = false;
int selected_param = 0;
int selected_sub_param = 0;
byte selected_channel = 0; // 0=tempo, 1-6=output channel
Clock::Source selected_source = Clock::SOURCE_INTERNAL;
Channel channel[Gravity::OUTPUT_COUNT];
};
#endif // APP_STATE_H