-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathconfig.py
More file actions
101 lines (86 loc) · 2.86 KB
/
Copy pathconfig.py
File metadata and controls
101 lines (86 loc) · 2.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
"""
config.py - Hardware configuration and game constants
"""
# ============================================================================
# BOARD SELECTION - Change this to match your ESP32 board
# ============================================================================
# Supported boards: "ESP32-C6", "ESP32-C3"
BOARD_TYPE = "ESP32-C6" # Change to "ESP32-C3" if using ESP32-C3 board
# ============================================================================
# Board-Specific Pin Configurations
# ============================================================================
# ESP32-C6 Pin Configuration (SuperMini)
_ESP32_C6_CONFIG = {
'I2C_SDA': 4,
'I2C_SCL': 7,
'BTN_UP': 14,
'BTN_DOWN': 18,
'BTN_LEFT': 20,
'BTN_RIGHT': 19,
'BTN_A': 1,
'BTN_B': 0,
'BTN_MENU1': 3,
'BTN_MENU2': 2,
}
# ESP32-C3 Pin Configuration
# Uses lower GPIO pins that are commonly available on ESP32-C3 boards
# Avoids strapping pins (GPIO2, GPIO8, GPIO9)
_ESP32_C3_CONFIG = {
'I2C_SDA': 6,
'I2C_SCL': 7,
'BTN_UP': 0,
'BTN_DOWN': 1,
'BTN_LEFT': 2,
'BTN_RIGHT': 3,
'BTN_A': 4,
'BTN_B': 5,
'BTN_MENU1': 10,
'BTN_MENU2': 11,
}
# Select configuration based on board type
if BOARD_TYPE == "ESP32-C3":
_CONFIG = _ESP32_C3_CONFIG
elif BOARD_TYPE == "ESP32-C6":
_CONFIG = _ESP32_C6_CONFIG
else:
raise ValueError(f"Unknown BOARD_TYPE: {BOARD_TYPE}. Supported: 'ESP32-C6', 'ESP32-C3'")
# Display Configuration
DISPLAY_WIDTH = 128
DISPLAY_HEIGHT = 64
I2C_SDA = _CONFIG['I2C_SDA']
I2C_SCL = _CONFIG['I2C_SCL']
I2C_FREQ = 400000
# Button Pin Mappings
BTN_UP = _CONFIG['BTN_UP']
BTN_DOWN = _CONFIG['BTN_DOWN']
BTN_LEFT = _CONFIG['BTN_LEFT']
BTN_RIGHT = _CONFIG['BTN_RIGHT']
BTN_A = _CONFIG['BTN_A']
BTN_B = _CONFIG['BTN_B']
BTN_MENU1 = _CONFIG['BTN_MENU1']
BTN_MENU2 = _CONFIG['BTN_MENU2']
# Free the raw config dicts — all values have been extracted above
del _ESP32_C6_CONFIG, _ESP32_C3_CONFIG, _CONFIG
# WiFi Features
# Disable if wlan.scan() causes hard freezes on your firmware/board combination.
WIFI_ENABLED = True
# Debug Features
SHOW_DEBUG_MENUS = True
# Software Version
VERSION = "0.9.1"
# Game Constants
FPS = 12 # Target frames per second
FRAME_TIME_MS = 1000 // FPS # Milliseconds per frame
# Transition Settings
TRANSITION_DURATION = 0.25 # seconds per half-transition (total is 2x this)
# Panning Settings
PAN_SPEED = 4 # pixels per frame when D-pad held
# Sleep / Power Saving
# SLEEP_MODE controls the device sleep behaviour when idle:
# None - sleep disabled
# "basic" - screen off, reduced game tick rate, CPU still running
# "deep" - (not yet implemented) true deep sleep with hardware wake-up
SLEEP_MODE = "basic"
SLEEP_TIMEOUT_SEC = 900 # Seconds of inactivity before sleeping (15 minutes)
SLEEP_FPS = 2 # Game update rate while in basic sleep
SLEEP_FRAME_TIME_MS = 1000 // SLEEP_FPS