Skip to content

Commit 94cbfda

Browse files
authored
Merge pull request #208 from uorocketry/AddIgniterGPIO
Add an Igniter on Pin 12
2 parents 367cb2a + 4ca0784 commit 94cbfda

File tree

2 files changed

+61
-1
lines changed

2 files changed

+61
-1
lines changed

src/stateMachine/HotFire/HotFireGpioConfig.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
#define USE_VENT 1
1010

11+
#define USE_IGNITER 1
12+
1113
#define USE_PWM_MAIN 1
1214

1315
#define USE_PWM_PINHOLE 1
@@ -27,6 +29,14 @@
2729
#define VENT_EVENT_ENABLE_MASK 0b10
2830
#endif
2931

32+
#if USE_IGNITER
33+
#define IGNITER_NAME "IGNITER"
34+
#define IGNITER_PIN 12
35+
#define IGNITER_ON 1
36+
#define IGNITER_OFF 0
37+
#define IGNITER_EVENT_ENABLE_MASK 0b100
38+
#endif
39+
3040
#if USE_PWM_MAIN
3141
#define MAIN_NAME "MAIN"
3242
#define MAIN_PIN 3

src/stateMachine/HotFire/HotFireStateMachine.cpp

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,10 @@ STATE_DEFINE(HotFireStateMachine, Init, UOSMData)
197197
interface->createNewGpioOutput(HEATER_NAME, HEATER_PIN);
198198
#endif
199199

200+
#if USE_IGNITER
201+
interface->createNewGpioOutput(IGNITER_NAME, IGNITER_PIN);
202+
#endif
203+
200204
#if USE_PWM_MAIN
201205
interface->createNewGpioPwmOutput(MAIN_NAME, MAIN_PIN, MAIN_SAFE, MAIN_SOFTPWM);
202206
#endif
@@ -281,6 +285,10 @@ STATE_DEFINE(HotFireStateMachine, WaitForFilling, UOSMData)
281285
gpioData.digitalOutputMap.insert({VENT_NAME, VENT_CLOSE});
282286
#endif
283287

288+
#if USE_IGNITER
289+
gpioData.digitalOutputMap.insert({IGNITER_NAME, IGNITER_OFF});
290+
#endif
291+
284292
#if USE_PWM_MAIN
285293
gpioData.pwmOutputMap.insert({MAIN_NAME, MAIN_CLOSE});
286294
#endif
@@ -322,6 +330,10 @@ STATE_DEFINE(HotFireStateMachine, Filling, UOSMData)
322330
gpioData.digitalOutputMap.insert({VENT_NAME, VENT_CLOSE});
323331
#endif
324332

333+
#if USE_IGNITER
334+
gpioData.digitalOutputMap.insert({IGNITER_NAME, IGNITER_OFF});
335+
#endif
336+
325337
#if USE_PWM_MAIN
326338
gpioData.pwmOutputMap.insert({MAIN_NAME, MAIN_CLOSE});
327339
#endif
@@ -363,6 +375,10 @@ STATE_DEFINE(HotFireStateMachine, WaitForIgnition, UOSMData)
363375
gpioData.digitalOutputMap.insert({VENT_NAME, VENT_CLOSE});
364376
#endif
365377

378+
#if USE_IGNITER
379+
gpioData.digitalOutputMap.insert({IGNITER_NAME, IGNITER_OFF});
380+
#endif
381+
366382
#if USE_PWM_MAIN
367383
gpioData.pwmOutputMap.insert({MAIN_NAME, MAIN_CLOSE});
368384
#endif
@@ -404,6 +420,10 @@ STATE_DEFINE(HotFireStateMachine, Ignition, UOSMData)
404420
gpioData.digitalOutputMap.insert({VENT_NAME, VENT_CLOSE});
405421
#endif
406422

423+
#if USE_IGNITER
424+
gpioData.digitalOutputMap.insert({IGNITER_NAME, IGNITER_ON});
425+
#endif
426+
407427
#if USE_PWM_MAIN
408428
gpioData.pwmOutputMap.insert({MAIN_NAME, MAIN_IGNITION});
409429
#endif
@@ -446,6 +466,10 @@ STATE_DEFINE(HotFireStateMachine, FullBurn, UOSMData)
446466
gpioData.digitalOutputMap.insert({VENT_NAME, VENT_CLOSE});
447467
#endif
448468

469+
#if USE_IGNITER
470+
gpioData.digitalOutputMap.insert({IGNITER_NAME, IGNITER_OFF});
471+
#endif
472+
449473
#if USE_PWM_MAIN
450474
gpioData.pwmOutputMap.insert({MAIN_NAME, MAIN_OPEN});
451475
#endif
@@ -487,6 +511,10 @@ STATE_DEFINE(HotFireStateMachine, FinalVenting, UOSMData)
487511
gpioData.digitalOutputMap.insert({VENT_NAME, VENT_OPEN});
488512
#endif
489513

514+
#if USE_IGNITER
515+
gpioData.digitalOutputMap.insert({IGNITER_NAME, IGNITER_OFF});
516+
#endif
517+
490518
#if USE_PWM_MAIN
491519
gpioData.pwmOutputMap.insert({MAIN_NAME, MAIN_CLOSE});
492520
#endif
@@ -529,6 +557,10 @@ STATE_DEFINE(HotFireStateMachine, Done, UOSMData)
529557
gpioData.digitalOutputMap.insert({VENT_NAME, VENT_CLOSE});
530558
#endif
531559

560+
#if USE_IGNITER
561+
gpioData.digitalOutputMap.insert({IGNITER_NAME, IGNITER_OFF});
562+
#endif
563+
532564
#if USE_PWM_MAIN
533565
gpioData.pwmOutputMap.insert({MAIN_NAME, MAIN_OPEN});
534566
#endif
@@ -565,6 +597,10 @@ STATE_DEFINE(HotFireStateMachine, AbortFilling, UOSMData)
565597
gpioData.digitalOutputMap.insert({VENT_NAME, VENT_CLOSE});
566598
#endif
567599

600+
#if USE_IGNITER
601+
gpioData.digitalOutputMap.insert({IGNITER_NAME, IGNITER_OFF});
602+
#endif
603+
568604
#if USE_PWM_MAIN
569605
gpioData.pwmOutputMap.insert({MAIN_NAME, MAIN_CLOSE});
570606
#endif
@@ -601,6 +637,10 @@ STATE_DEFINE(HotFireStateMachine, AbortBurn, UOSMData)
601637
gpioData.digitalOutputMap.insert({VENT_NAME, VENT_CLOSE});
602638
#endif
603639

640+
#if USE_IGNITER
641+
gpioData.digitalOutputMap.insert({IGNITER_NAME, IGNITER_OFF});
642+
#endif
643+
604644
#if USE_PWM_MAIN
605645
gpioData.pwmOutputMap.insert({MAIN_NAME, MAIN_CLOSE});
606646
#endif
@@ -649,7 +689,7 @@ STATE_DEFINE(HotFireStateMachine, ServoControl, UOSMData)
649689
* 0 0 0 0 0 0
650690
* | | | | | ^--------- Enable bit
651691
* | | | | ^----------- USE_VENT
652-
* | | | ^------------- USE_SV02
692+
* | | | ^------------- USE_IGNITER
653693
* | | ^--------------- USE_PWM_MAIN
654694
* | ^----------------- USE_PWM_PINHOLE
655695
* ^------------------- USE_PWM_FILL
@@ -669,6 +709,16 @@ STATE_DEFINE(HotFireStateMachine, ServoControl, UOSMData)
669709
}
670710
#endif
671711

712+
#if USE_IGNITER == 1
713+
{
714+
bool open = (eventNbr & IGNITER_EVENT_ENABLE_MASK) > 0;
715+
716+
gpioData.digitalOutputMap.insert({IGNITER_NAME, open ? IGNITER_ON : IGNITER_OFF});
717+
718+
logValveStatus(IGNITER_NAME, open);
719+
}
720+
#endif
721+
672722
#if USE_PWM_MAIN == 1
673723
{
674724
bool open = (eventNbr & MAIN_EVENT_ENABLE_MASK) > 0;

0 commit comments

Comments
 (0)