Skip to content

Commit

Permalink
Fix 84/89 cyclotron overheat
Browse files Browse the repository at this point in the history
This fixes the erratic behavior from the outer cyclotron when overheating in 84/89 mode by asserting a red colour scheme if we are in one of the two colour-shift firing modes, and then only using the special fade code if we are not overheating.
  • Loading branch information
nomakewan committed Aug 1, 2024
1 parent a4f18b5 commit ffb493a
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions source/ProtonPack/ProtonPack.ino
Original file line number Diff line number Diff line change
Expand Up @@ -2364,19 +2364,24 @@ void cyclotronFade() {
case SYSTEM_1984:
case SYSTEM_1989:
if(b_fade_cyclotron_led == true) {
if(b_overheating && (STREAM_MODE == HOLIDAY || STREAM_MODE == SPECTRAL)) {
// When overheating in 84/89 and in Holiday/Spectral mode, revert to red cyclotron.
i_colour_scheme = C_RED;
}

for(uint8_t i = 0; i < i_cyclotron_leds_total; i++) {
if(r_cyclotron_led_fade_in[i].isRunning()) {
b_cyclotron_led_fading_in[i] = true;
uint8_t i_curr_brightness = r_cyclotron_led_fade_in[i].update();

pack_leds[i + i_cyclotron_led_start] = getHueAsRGB(CYCLOTRON_OUTER, i_colour_scheme, i_curr_brightness, false, true);
pack_leds[i + i_cyclotron_led_start] = getHueAsRGB(CYCLOTRON_OUTER, i_colour_scheme, i_curr_brightness, false, !b_overheating);
i_cyclotron_led_value[i] = i_curr_brightness;
}

uint8_t i_new_brightness = getBrightness(i_cyclotron_brightness);

if(r_cyclotron_led_fade_in[i].isFinished() && i_cyclotron_led_value[i] > (i_new_brightness - 1) && b_cyclotron_led_fading_in[i] == true) {
pack_leds[i + i_cyclotron_led_start] = getHueAsRGB(CYCLOTRON_OUTER, i_colour_scheme, i_new_brightness, false, true);
pack_leds[i + i_cyclotron_led_start] = getHueAsRGB(CYCLOTRON_OUTER, i_colour_scheme, i_new_brightness, false, !b_overheating);
i_cyclotron_led_value[i] = i_new_brightness;
}

Expand All @@ -2391,7 +2396,7 @@ void cyclotronFade() {
b_cyclotron_led_fading_in[i] = true;
}
else {
pack_leds[i + i_cyclotron_led_start] = getHueAsRGB(CYCLOTRON_OUTER, i_colour_scheme, i_curr_brightness, false, true);
pack_leds[i + i_cyclotron_led_start] = getHueAsRGB(CYCLOTRON_OUTER, i_colour_scheme, i_curr_brightness, false, !b_overheating);
i_cyclotron_led_value[i] = i_curr_brightness;
b_cyclotron_led_fading_in[i] = false;
}
Expand Down

0 comments on commit ffb493a

Please sign in to comment.