#pragma once // ── Buttons ─────────────────────────────────────────────────────────────────── #define BTN_FORWARD_GPIO 23 #define BTN_LEFT_GPIO 4 #define BTN_RIGHT_GPIO 5 #define BTN_BACK_GPIO 19 // ── RGB LED ─────────────────────────────────────────────────────────────────── #define LED_R_GPIO 13 #define LED_G_GPIO 14 #define LED_B_GPIO 27 // ── I2C / OLED ──────────────────────────────────────────────────────────────── #define I2C_PORT I2C_NUM_0 #define I2C_SDA_GPIO 21 #define I2C_SCL_GPIO 22 #define I2C_FREQ_HZ 400000 #define OLED_ADDR 0x3C #define OLED_WIDTH 128 #define OLED_PAGES 8 #define HEADER_PAGES 2 // ── Button timing ───────────────────────────────────────────────────────────── #define HOLD_DELAY 50 #define HOLD_REPEAT 10 #define COMBO_HOLD_MENU 50 #define COMBO_HOLD_SETTINGS 100 #define COMBO_HOLD_SLEEP 500 // 500 × 10ms = 5s #define SLEEP_CONTRAST 0x01 // ── BLE ─────────────────────────────────────────────────────────────────────── #define BLE_MFR_MAGIC_0 0xC0 #define BLE_MFR_MAGIC_1 0xDE #define BLE_GAME_ID_0 0x42 #define BLE_GAME_ID_1 0x42 #define MAX_BLE_PEERS 4 #define BLE_PEER_TIMEOUT 3000 // ── Menus ───────────────────────────────────────────────────────────────────── #define NUM_MENUS 5 #define MENU_LIFE 0 #define MENU_CMDR 1 #define MENU_COUNTERS 2 #define MENU_DICE 3 #define MENU_SETTINGS 4 extern const int menu_slot[NUM_MENUS]; // ── Dice ────────────────────────────────────────────────────────────────────── #define DICE_CSV_LEN 128 #define NUM_DICE_SIDES 7 extern const int die_sides[NUM_DICE_SIDES]; // ── Settings ────────────────────────────────────────────────────────────────── #define NUM_SETTINGS 13 #define SET_BRIGHTNESS 0 #define SET_START_LIFE 1 #define SET_NUM_OPP 2 #define SET_BLE 3 #define SET_RESET 4 #define SET_RESET_ALL 5 #define SET_PLAYER_NAME 7 #define SET_GAME_ID 6 #define SET_MENU_HOLD 8 #define SET_LR_HOLD 9 #define SET_DISPLAY_FLIP 10 #define SET_DELTA_TIMEOUT 11 #define SET_AUTO_SLEEP 12 #define HOLD_MS_MIN 50 #define HOLD_MS_MAX 2000 #define DELTA_TIMEOUT_MIN 100 #define DELTA_TIMEOUT_MAX 5000 #define BRIGHTNESS_MIN 1 #define BRIGHTNESS_MAX 100 #define PLAYER_NAME_LEN 8 #define GAME_ID_DIGITS 4 extern const char *setting_names[NUM_SETTINGS]; extern const int start_life_opts[]; #define NUM_LIFE_OPTS 3 extern const char NAME_CHARS[]; #define NUM_NAME_CHARS 37 #define NUM_HEX_CHARS 16 // ── Counters ────────────────────────────────────────────────────────────────── #define NUM_COUNTERS 5 #define COUNTER_POISON 0 #define COUNTER_STORM 4 extern const char *counter_names[NUM_COUNTERS]; // ── Opponents ───────────────────────────────────────────────────────────────── #define MAX_OPPONENTS 4 // ── Font / display ──────────────────────────────────────────────────────────── #define SCALE 5 #define CHAR_WIDTH (5 * SCALE + SCALE) #define CHAR_PAGES 5 #define START_PAGE (HEADER_PAGES + (OLED_PAGES - HEADER_PAGES - CHAR_PAGES + 1) / 2) #define SEG_W 16 #define ICON_W 16 #define FONT_BASE 0x20 #define FONT_MAX 0x5A // ── Battery ADC (GPIO34, ADC1 Channel 6) ────────────────────────────────────── #define BATT_LOW_PCT 10 // flash battery indicator below this #define BATT_SAMPLE_TICKS 500 // sample every 500 × 10ms = 5s // ── Auto-sleep ──────────────────────────────────────────────────────────────── #define SLEEP_TIMEOUT_DEF 60 // default auto-sleep timeout (minutes) #define SLEEP_TIMEOUT_MAX 120 // maximum timeout (minutes) // ── NVS ─────────────────────────────────────────────────────────────────────── #define NVS_NS "settings" #define SAVE_DELAY 300