Skip to content

Commit 6e52c26

Browse files
committed
use pwm for purge valve
1 parent e2ad668 commit 6e52c26

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

src/stateMachine/HotFire/HotFireStateMachine.cpp

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,10 @@ STATE_DEFINE(HotFireStateMachine, Init, UOSMData)
243243
interface->createNewGpioPwmOutput(FILL_NAME, FILL_PIN, FILL_SAFE, FILL_SOFTPWM);
244244
#endif
245245

246+
#if USE_PURGE
247+
interface->createNewGpioPwmOutput(PURGE_NAME, PURGE_PIN, PURGE_SAFE, PURGE_SOFTPWM);
248+
#endif
249+
246250
#endif
247251
NoEventData eventData;
248252
InternalEvent(ST_WAIT_FOR_INIT, eventData);
@@ -312,7 +316,7 @@ STATE_DEFINE(HotFireStateMachine, WaitForPurge, UOSMData)
312316
#endif
313317

314318
#if USE_PURGE
315-
gpioData.stepperMotor = PURGE_CLOSE;
319+
gpioData.pwmOutputMap.insert({PURGE_NAME, PURGE_CLOSE});
316320
#endif
317321

318322
#endif
@@ -361,7 +365,7 @@ STATE_DEFINE(HotFireStateMachine, Purge, UOSMData)
361365
#endif
362366

363367
#if USE_PURGE
364-
gpioData.stepperMotor = PURGE_OPEN;
368+
gpioData.pwmOutputMap.insert({PURGE_NAME, PURGE_OPEN});
365369
#endif
366370

367371
#endif
@@ -410,7 +414,7 @@ STATE_DEFINE(HotFireStateMachine, Filling, UOSMData)
410414
#endif
411415

412416
#if USE_PURGE
413-
gpioData.stepperMotor = PURGE_OPEN;
417+
gpioData.pwmOutputMap.insert({PURGE_NAME, PURGE_OPEN});
414418
#endif
415419

416420
#endif
@@ -459,7 +463,7 @@ STATE_DEFINE(HotFireStateMachine, WaitForIgnition, UOSMData)
459463
#endif
460464

461465
#if USE_PURGE
462-
gpioData.stepperMotor = PURGE_OPEN;
466+
gpioData.pwmOutputMap.insert({PURGE_NAME, PURGE_OPEN});
463467
#endif
464468

465469
#endif
@@ -508,7 +512,7 @@ STATE_DEFINE(HotFireStateMachine, Ignition, UOSMData)
508512
#endif
509513

510514
#if USE_PURGE
511-
gpioData.stepperMotor = PURGE_OPEN;
515+
gpioData.pwmOutputMap.insert({PURGE_NAME, PURGE_OPEN});
512516
#endif
513517

514518
#endif
@@ -557,7 +561,7 @@ STATE_DEFINE(HotFireStateMachine, IgnitionBurn, UOSMData)
557561
#endif
558562

559563
#if USE_PURGE
560-
gpioData.stepperMotor = PURGE_OPEN;
564+
gpioData.pwmOutputMap.insert({PURGE_NAME, PURGE_OPEN});
561565
#endif
562566

563567
#endif
@@ -607,7 +611,7 @@ STATE_DEFINE(HotFireStateMachine, FullBurn, UOSMData)
607611
#endif
608612

609613
#if USE_PURGE
610-
gpioData.stepperMotor = PURGE_OPEN;
614+
gpioData.pwmOutputMap.insert({PURGE_NAME, PURGE_OPEN});
611615
#endif
612616

613617
#endif
@@ -656,7 +660,7 @@ STATE_DEFINE(HotFireStateMachine, FinalVenting, UOSMData)
656660
#endif
657661

658662
#if USE_PURGE
659-
gpioData.stepperMotor = PURGE_OPEN;
663+
gpioData.pwmOutputMap.insert({PURGE_NAME, PURGE_OPEN});
660664
#endif
661665

662666
#endif
@@ -706,7 +710,7 @@ STATE_DEFINE(HotFireStateMachine, Done, UOSMData)
706710
#endif
707711

708712
#if USE_PURGE
709-
gpioData.stepperMotor = PURGE_CLOSE;
713+
gpioData.pwmOutputMap.insert({PURGE_NAME, PURGE_CLOSE});
710714
#endif
711715

712716
#endif
@@ -750,7 +754,7 @@ STATE_DEFINE(HotFireStateMachine, AbortFilling, UOSMData)
750754
#endif
751755

752756
#if USE_PURGE
753-
gpioData.stepperMotor = PURGE_OPEN;
757+
gpioData.pwmOutputMap.insert({PURGE_NAME, PURGE_OPEN});
754758
#endif
755759

756760
#endif
@@ -794,7 +798,7 @@ STATE_DEFINE(HotFireStateMachine, AbortBurn, UOSMData)
794798
#endif
795799

796800
#if USE_PURGE
797-
gpioData.stepperMotor = PURGE_OPEN;
801+
gpioData.pwmOutputMap.insert({PURGE_NAME, PURGE_OPEN});
798802
#endif
799803

800804
#endif
@@ -897,7 +901,7 @@ STATE_DEFINE(HotFireStateMachine, ServoControl, UOSMData)
897901
{
898902
bool open = (eventNbr & PURGE_EVENT_ENABLE_MASK) > 0;
899903

900-
gpioData.stepperMotor = open ? PURGE_OPEN : PURGE_CLOSE;
904+
gpioData.pwmOutputMap.insert({PURGE_NAME, open ? PURGE_OPEN : PURGE_CLOSE});
901905

902906
logValveStatus(PURGE_NAME, open);
903907
}

0 commit comments

Comments
 (0)