Переглянути джерело

Smooth red LED blinking

Avoid to an epilepsis crisis to happen.
DricomDragon 5 роки тому
батько
коміт
6dbaf8232d
1 змінених файлів з 10 додано та 4 видалено
  1. 10 4
      prog/sources/fault-handlers-assertion.cpp

+ 10 - 4
prog/sources/fault-handlers-assertion.cpp

@@ -1,5 +1,7 @@
 #include "all-headers.h"
 
+#define LED_DELAY 1000
+
 
 static void configureFaultRegisters (BOOT_MODE) {
 	// ACTLR register (reset value: 0)
@@ -30,13 +32,15 @@ static void endlessLoop (FAULT_MODE) {
 	pinMode (L2_LED, DigitalMode::OUTPUT) ;
 	pinMode (L3_LED, DigitalMode::OUTPUT) ;
 	pinMode (L4_LED, DigitalMode::OUTPUT) ;
+
+	digitalWrite (L0_LED, true) ;
+	digitalWrite (L1_LED, true) ;
 	while (1) {
 		digitalToggle (L0_LED) ;
 		digitalToggle (L1_LED) ;
-		digitalToggle (L2_LED) ;
 		digitalToggle (L3_LED) ;
 		digitalToggle (L4_LED) ;
-		busyWaitDuring_faultMode (MODE_ 200);
+		busyWaitDuring_faultMode (MODE_ LED_DELAY);
 	}
 }
 
@@ -61,6 +65,9 @@ static void handleFault (FAULT_MODE_ const char * inTitle,  const uint32_t inLin
 	pinMode (L2_LED, DigitalMode::OUTPUT) ;
 	pinMode (L3_LED, DigitalMode::OUTPUT) ;
 	pinMode (L4_LED, DigitalMode::OUTPUT) ;
+
+	digitalWrite (L0_LED, true) ;
+	digitalWrite (L1_LED, true) ;
 	uint32_t displayedPage = 0 ;
 	uint32_t displayCounter = 0 ;
 	bool encoderA = false ;
@@ -85,10 +92,9 @@ static void handleFault (FAULT_MODE_ const char * inTitle,  const uint32_t inLin
 		if (displayCounter > 0) {
 			displayCounter -= 1 ;
 		}else{
-			displayCounter = 200 ;
+			displayCounter = LED_DELAY;
 			digitalToggle (L0_LED) ;
 			digitalToggle (L1_LED) ;
-			digitalToggle (L2_LED) ;
 			digitalToggle (L3_LED) ;
 			digitalToggle (L4_LED) ;
 			if (display) {