Added software timers

Accessory state machine framework functional
This commit is contained in:
2025-06-18 17:53:00 -05:00
parent aaa7f0dc29
commit 658cedfa3b
18 changed files with 614 additions and 580 deletions

View File

@@ -33,7 +33,6 @@
//#define ON 1
uint16_t Sys_Chk_tmr;
extern uint8_t Port_State[];
extern uint16_t Estop_timer;
extern uint8_t Over_Voltage_Flag, LD_Flag;
@@ -248,7 +247,7 @@ void Check_Live_Voltage()
{
if (Compare_Voltage(sys.adc.V_CHK, MAX_OP_VOLTS)) //Potentially fatal voltage
{
Select_Estop(ON); // Fault condition disable output
Select_Estop(ISOLATED); // Fault condition disable output
Select_Bypass(OFF); // Force into blocked state.
// Over_Voltage_Flag = true;
// Estop_timer = DELAY_5S;
@@ -327,7 +326,7 @@ float32_t Get_Power_Limit(void)
}
// if over power, scale amplitude
void Adjust_Output_Power(float32_t New_Power_Limit)
{
if (Watts_Filt > New_Power_Limit)
@@ -355,7 +354,7 @@ void Check_PSU_Short(void) // if output less than 10% of expected PSU voltage
{
if ((sys.adc.V_PSU * 1.2) < Convert_Pot2_Volts(Psu_Pot_Val[1]))
{
Select_Estop(ON); // Disconnect from external threats
Select_Estop(ISOLATED); // Disconnect from external threats
Power_Level = 0; // set demand to minimum to prevent damage
// Update_Amp_Pot();
@@ -376,7 +375,7 @@ void Check_PSU_Short(void) // if output less than 10% of expected PSU voltage
void Estop_Mode(void)
{
Select_Estop(ON);
Select_Estop(ISOLATED);
Task = ESTOP_TASK;
}
@@ -459,7 +458,6 @@ void Chk_Gain(void)
// SPI0_SendBytes(Port_State, 3, EXPANDER);
}
Sys_Chk_tmr = DELAY_1S;
}