There is presently an unsigned 16-bit integer underflow error in powercellLoop() (and potentially other areas of the code relating to ramping actions, such as the cyclotron). This underflow is a direct result of r_2021_ramp.update() calls which are then used to set other timer delays between both the cyclotron and power cell. The most obvious error condition can be replicated by performing the following sequence:
Start with the Proton Pack in Afterlife or Frozen Empire mode.
With the pack on, shut down the pack.
Flip the year switch inside the cyclotron cavity to 1984.
Wait for the ramp down sequence to complete so that the year change will take effect.
Power the pack back up.
This will cause the first LED of the power cell to come on solid and appear to be frozen. However, it is not frozen. If you wait 64 seconds from the moment you flipped the ion arm switch, the power cell will resume normal functionality. This indicates that the initial startup timer delay was set to some 64000 milliseconds, which is in line with a 16-bit unsigned integer underflow (subtracting 1050--the value of i_1984_delay--from 75--the value of i_powercell_delay in 1984 mode--would result in a value of 64560).
PR #293 includes some cleanup of the code around this and other locations, but as I am not intimately familiar with the functionality of the Ramp library or how the powercell/cyclotron timers are set and reset, I felt it best to get some assistance with this issue.
The likely location of this underflow from my investigation is the line in powercellLoop() that triggers if waiting for the initial ramp up on start or ramp down on power-down:
The Afterlife-to-1984 switch results in a 64-second underflow, but I imagine the 1.4s lag before the first LED of the powercell ramps after switching from 1984/1989 to Afterlife has something to do with a math error as well. May be worth confirming all of the initial values for the Powercell and Cyclotron are what they are expected to be and not underflowing.
There is presently an unsigned 16-bit integer underflow error in powercellLoop() (and potentially other areas of the code relating to ramping actions, such as the cyclotron). This underflow is a direct result of
r_2021_ramp.update()
calls which are then used to set other timer delays between both the cyclotron and power cell. The most obvious error condition can be replicated by performing the following sequence:This will cause the first LED of the power cell to come on solid and appear to be frozen. However, it is not frozen. If you wait 64 seconds from the moment you flipped the ion arm switch, the power cell will resume normal functionality. This indicates that the initial startup timer delay was set to some 64000 milliseconds, which is in line with a 16-bit unsigned integer underflow (subtracting 1050--the value of i_1984_delay--from 75--the value of i_powercell_delay in 1984 mode--would result in a value of 64560).
PR #293 includes some cleanup of the code around this and other locations, but as I am not intimately familiar with the functionality of the Ramp library or how the powercell/cyclotron timers are set and reset, I felt it best to get some assistance with this issue.
The likely location of this underflow from my investigation is the line in powercellLoop() that triggers if waiting for the initial ramp up on start or ramp down on power-down:
i_pc_delay = i_powercell_delay + (r_2021_ramp.update() - i_1984_delay);
The Afterlife-to-1984 switch results in a 64-second underflow, but I imagine the 1.4s lag before the first LED of the powercell ramps after switching from 1984/1989 to Afterlife has something to do with a math error as well. May be worth confirming all of the initial values for the Powercell and Cyclotron are what they are expected to be and not underflowing.