Skip to content

Commit bb62b93

Browse files
committed
Toggle LED instead of just turning it off.
Map to START+Y.
1 parent d056301 commit bb62b93

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ SELECT+Y - Dump hardware frame output to `/3ds/open_agb_firm/screenshots/YYYY_MM
3333
* The file name is the current date and time from your real-time clock.
3434
* If the screen output freezes, press HOME to fix it. This is a hard to track down bug that will be fixed.
3535

36-
Y+DOWN - Turn off the power LED
36+
START+Y - Toggle power LED on/off.
3737

3838
X+UP/DOWN - Adjust screen brightness up or down by `backlightSteps` units.
3939

source/arm11/open_agb_firm.c

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141

4242

4343
static KHandle g_frameReadyEvent = 0;
44-
44+
static PwrLedPattern g_lastPowerLEDPattern = MCU_PWR_LED_AUTO;
4545

4646

4747
static u32 fixRomPadding(const u32 romFileSize)
@@ -122,9 +122,19 @@ void changeBacklight(s16 amount)
122122
GFX_setLcdLuminance(newVal);
123123
}
124124

125-
void turnOffPowerLED()
125+
void togglePowerLED()
126126
{
127-
MCU_setPowerLedPattern(MCU_PWR_LED_OFF);
127+
PwrLedPattern currentPattern = MCU_getPowerLedPattern();
128+
if (currentPattern == MCU_PWR_LED_OFF)
129+
{
130+
// Restore last know pattern.
131+
MCU_setPowerLedPattern(g_lastPowerLEDPattern);
132+
}
133+
else
134+
{
135+
MCU_setPowerLedPattern(MCU_PWR_LED_OFF);
136+
}
137+
g_lastPowerLEDPattern = currentPattern;
128138
}
129139

130140
static void updateBacklight(void)
@@ -134,9 +144,9 @@ static void updateBacklight(void)
134144
static bool backlightOn = true;
135145
if(hidKeysDown() && kHeld)
136146
{
137-
// Turn off power LED
138-
if (kHeld == (KEY_Y | KEY_DDOWN))
139-
turnOffPowerLED();
147+
// Toggle power LED.
148+
if (kHeld == (KEY_Y | KEY_START))
149+
togglePowerLED();
140150

141151
// Adjust LCD brightness up.
142152
const s16 steps = g_oafConfig.backlightSteps;

0 commit comments

Comments
 (0)