Skip to content

Fancy FS led startup sequence#1746

Merged
pfeerick merged 6 commits intoEdgeTX:mainfrom
Batambatam:tpro-startup-leds
Mar 31, 2022
Merged

Fancy FS led startup sequence#1746
pfeerick merged 6 commits intoEdgeTX:mainfrom
Batambatam:tpro-startup-leds

Conversation

@Batambatam
Copy link
Contributor

Summary of changes:

Just a fancy startup Leds sequence, using function switches led.
Only for TPro.

@pfeerick
Copy link
Member

pfeerick commented Mar 29, 2022

That looks really nice. I suppose you didn't add it to shutdown animation also because of the strobing (because FS led state is still being managed by evalFunctionSwitches)? If you're interested in add that also... this should work... feel free to add or improve ;)

diff --git a/radio/src/gui/128x64/startup_shutdown.cpp b/radio/src/gui/128x64/startup_shutdown.cpp
index 6afb2b490..0e87d4301 100644
--- a/radio/src/gui/128x64/startup_shutdown.cpp
+++ b/radio/src/gui/128x64/startup_shutdown.cpp
@@ -67,6 +67,16 @@ void drawShutdownAnimation(uint32_t duration, uint32_t totalDuration, const char
   lcdRefreshWait();
   lcdClear();
 
+#if defined(FUNCTION_SWITCHES)
+  uint8_t index2 = limit<uint8_t>(0, duration / (totalDuration / (NUM_FUNCTIONS_SWITCHES+1)), NUM_FUNCTIONS_SWITCHES);
+
+  for (uint8_t j = 0; j < NUM_FUNCTIONS_SWITCHES; j++) {
+    fsLedOff(j);
+    if (NUM_FUNCTIONS_SWITCHES - index2 > j)
+      fsLedOn(j);
+  }
+ #endif
+
   for (uint8_t i = 0; i < 4; i++) {
     if (4 - index > i) {
       lcdDrawFilledRect(LCD_W / 2 - 18 + 10 * i, LCD_H / 2 - 3, 6, 6, SOLID, 0);
diff --git a/radio/src/switches.cpp b/radio/src/switches.cpp
index 736938b8a..6c2f6c0d1 100644
--- a/radio/src/switches.cpp
+++ b/radio/src/switches.cpp
@@ -145,10 +145,12 @@ void evalFunctionSwitches()
       storageDirty(EE_MODEL);
     }
 
+if (!pwrPressed()) {
     if (getFSLogicalState(i))
       fsLedOn(i);
     else
       fsLedOff(i);
+}
   }
 }
 #endif

@pfeerick pfeerick added this to the 2.7 milestone Mar 29, 2022
@pfeerick pfeerick added the enhancement ✨ New feature or request label Mar 29, 2022
@Batambatam
Copy link
Contributor Author

Batambatam commented Mar 29, 2022

That looks really nice. I suppose you didn't add it to shutdown animation also because of the strobing (because FS led state is still being managed by evalFunctionSwitches)? If you're interested in add that also... this should work... feel free to add or improve ;)
...

Yup, absolutely. I tried some changes for shutdown but too much flickering 😄, it needs more tinkering.

@Batambatam
Copy link
Contributor Author

@pfeerick Man, I spent a few hours searching how to change that evalFunctionSwitches, I really suck 😙
Thanks for your suggestion which is working perfectly for shutdown !

@Batambatam Batambatam changed the title TPro - Fancy led startup seq Fancy FS led startup sequence Mar 29, 2022
@pfeerick
Copy link
Member

Nah, just means I've been poking around in the code too much. For future reference, I was in luck... I just searched for usage of fsOn /fsOff and that was indeed it.

@pfeerick pfeerick merged commit ed7be53 into EdgeTX:main Mar 31, 2022
pfeerick added a commit that referenced this pull request Apr 1, 2022
* TPro - Fancy led startup seq

* Cleanup

* fix define for function switches

* added shutdown sequence @pfeerick

* Formatting

Co-authored-by: Batam <batam@macbook-pro.home>
Co-authored-by: Peter Feerick <peter.feerick@gmail.com>
@Batambatam Batambatam deleted the tpro-startup-leds branch April 4, 2022 21:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement ✨ New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants