Skip to content

Commit fd21a11

Browse files
microbit-carlosmbrossard
authored andcommitted
microbitv2: Remove unused main_shutdown_state states.
Also removed `initial_fade_brightness` a static global that was just a constant value.
1 parent 9f83e78 commit fd21a11

File tree

3 files changed

+2
-14
lines changed

3 files changed

+2
-14
lines changed

source/board/microbitv2/i2c_commands.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ typedef enum userEventType_tag {
7171

7272
/*! property Id type enumeration */
7373
typedef enum errorCode_tag {
74-
gErrorSuccess = 0x30,
7574
gErrorIncompleteCommand_c = 0x31,
7675
gErrorUnknownCommand_c = 0x32,
7776
gErrorCommandDisallowed_c = 0x33,

source/board/microbitv2/microbitv2.c

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ static uint32_t read_file_data_txt(uint32_t sector_offset, uint8_t *data, uint32
7474
static uint8_t shutdown_led_dc = PWR_LED_ON_MAX_BRIGHTNESS;
7575
static uint8_t final_fade_led_dc = 0;
7676
static uint8_t power_led_max_duty_cycle = PWR_LED_ON_MAX_BRIGHTNESS;
77-
static uint8_t initial_fade_brightness = PWR_LED_INIT_FADE_BRIGHTNESS;
7877
// reset button state count
7978
static uint16_t gpio_reset_count = 0;
8079
// button state
@@ -250,16 +249,11 @@ void board_30ms_hook()
250249
switch (main_shutdown_state) {
251250
case MAIN_LED_FULL_BRIGHTNESS:
252251
// Jump power LED to initial fade brightness
253-
shutdown_led_dc = initial_fade_brightness;
254-
break;
255-
case MAIN_SHUTDOWN_CANCEL:
256-
main_shutdown_state = MAIN_SHUTDOWN_WAITING;
257-
// Set the PWM value back to max duty cycle
258-
shutdown_led_dc = power_led_max_duty_cycle;
252+
shutdown_led_dc = PWR_LED_INIT_FADE_BRIGHTNESS;
259253
break;
260254
case MAIN_SHUTDOWN_PENDING:
261255
// Fade the PWM until the board is about to be shut down
262-
shutdown_led_dc = initial_fade_brightness - gpio_reset_count * (initial_fade_brightness - PWR_LED_FADEOUT_MIN_BRIGHTNESS)/(RESET_MID_PRESS);
256+
shutdown_led_dc = PWR_LED_INIT_FADE_BRIGHTNESS - gpio_reset_count * (PWR_LED_INIT_FADE_BRIGHTNESS - PWR_LED_FADEOUT_MIN_BRIGHTNESS)/(RESET_MID_PRESS);
263257
break;
264258
case MAIN_SHUTDOWN_REACHED:
265259
// Hold LED in min brightness
@@ -325,9 +319,6 @@ void board_30ms_hook()
325319
// Set the PWM value back to max duty cycle
326320
shutdown_led_dc = power_led_max_duty_cycle;
327321
break;
328-
case MAIN_SHUTDOWN_WAITING_OFF:
329-
shutdown_led_dc = 0;
330-
break;
331322
case MAIN_LED_BLINKING:
332323
// Blink the LED to indicate standby mode
333324
if (shutdown_led_dc < 10) {

source/board/microbitv2/microbitv2.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040

4141
typedef enum main_shutdown_state {
4242
MAIN_SHUTDOWN_WAITING = 0,
43-
MAIN_SHUTDOWN_WAITING_OFF,
4443
MAIN_SHUTDOWN_PENDING,
4544
MAIN_SHUTDOWN_REACHED,
4645
MAIN_SHUTDOWN_REACHED_FADE,
@@ -49,7 +48,6 @@ typedef enum main_shutdown_state {
4948
MAIN_LED_BLINK_ONCE,
5049
MAIN_LED_BLINKING,
5150
MAIN_LED_FULL_BRIGHTNESS,
52-
MAIN_SHUTDOWN_CANCEL
5351
} main_shutdown_state_t;
5452

5553
#endif /* MICROBITV2_H_ */

0 commit comments

Comments
 (0)