Refactored/rewritten controller firmware

Hi,
I’ve significantly refactored/rewritten the OpenPPG controller firmware. I’d be very interested in feedback, suggestions, or bug reports!

Highlights include:

  • Simplified code, easier to make changes in future!
  • Streamlined display code (no more flickering/glitches)
  • Tweaked display layout (see photos)
  • Consistent timing (reduced latency spikes due to blocking code)
  • Fixed a few small bugs
  • Alert beeps if no ESC telemetry has been received in the last 2 seconds
  • Improved boot screen, including the OpenPPG logo (see photos)

NOTE: This is a community branch of the official OpenPPG firmware: it is not supported by OpenPPG. Use it at your own risk!

I have also only been able to test it on the RP2040 (since that’s what I have).

Instructions for building/installing are here: GitHub - thandal/eppg-controller: Firmware for SP140 paramotor handheld controller

First release is 6.0Rt: Release [6.0Rt] Major rewrite · thandal/eppg-controller · GitHub

Boot screen:

Armed and spinning:

7 Likes

This is very interesting! Thank you for putting the time into updating the code. I’m going to give it a try!

Ah well. Unfortunately, it doesn’t compile for the CM0 chipset, and I’m not a good enough programmer to fix it.

In case you’re interested, the compile error is:

Compiling .pio/build/OpenPPG-CM0-SP140/libb8f/AceButton/ace_button/testing/EventTracker.cpp.o
src/web_usb.cpp: In function 'String chipId()':
src/web_usb.cpp:41:17: error: invalid conversion from 'const char*' to 'size_t' {aka 'unsigned int'} [-fpermissive]
   41 |   snprintf(buf, "%08x%08x%08x%08x",
      |                 ^~~~~~~~~~~~~~~~~~
      |                 |
      |                 const char*
In file included from /Users/Scott/.platformio/packages/framework-arduino-samd-adafruit/cores/arduino/Print.h:23,
                 from /Users/Scott/.platformio/packages/framework-arduino-samd-adafruit/cores/arduino/Stream.h:26,
                 from /Users/Scott/.platformio/packages/framework-arduino-samd-adafruit/cores/arduino/HardwareSerial.h:24,
                 from /Users/Scott/.platformio/packages/framework-arduino-samd-adafruit/cores/arduino/Arduino.h:77,
                 from src/web_usb.cpp:4:
/Users/Scott/.platformio/packages/toolchain-gccarmnoneeabi/arm-none-eabi/include/stdio.h:266:33: note:   initializing argument 2 of 'int snprintf(char*, size_t, const char*, ...)'
  266 | int snprintf (char *__restrict, size_t, const char *__restrict, ...)
      |                                 ^~~~~~
src/web_usb.cpp:42:11: error: invalid conversion from 'unsigned int' to 'const char*' [-fpermissive]
   42 |           (unsigned int)val1,
      |           ^~~~~~~~~~~~~~~~~~
      |           |
      |           unsigned int
In file included from /Users/Scott/.platformio/packages/framework-arduino-samd-adafruit/cores/arduino/Print.h:23,
                 from /Users/Scott/.platformio/packages/framework-arduino-samd-adafruit/cores/arduino/Stream.h:26,
                 from /Users/Scott/.platformio/packages/framework-arduino-samd-adafruit/cores/arduino/HardwareSerial.h:24,
                 from /Users/Scott/.platformio/packages/framework-arduino-samd-adafruit/cores/arduino/Arduino.h:77,
                 from src/web_usb.cpp:4:
/Users/Scott/.platformio/packages/toolchain-gccarmnoneeabi/arm-none-eabi/include/stdio.h:266:41: note:   initializing argument 3 of 'int snprintf(char*, size_t, const char*, ...)'
  266 | int snprintf (char *__restrict, size_t, const char *__restrict, ...)
      |                                         ^~~~~~~~~~~~
Compiling .pio/build/OpenPPG-CM0-SP140/lib332/Thread/Thread.cpp.o
*** [.pio/build/OpenPPG-CM0-SP140/src/web_usb.cpp.o] Error 1
Compiling .pio/build/OpenPPG-CM0-SP140/lib332/Thread/ThreadController.cpp.o
==================================================== [FAILED] Took 3.16 seconds ====================================================

Environment        Status    Duration
-----------------  --------  ------------
OpenPPG-CM0-SP140  FAILED    00:00:03.156
============================================== 1 failed, 0 succeeded in 00:00:03.156 ==============================================

Fixed! Please sync and try again.

Cool! Thank you! I might have time later this week to give it another try.

I’ve flashed the firmware and it’s definitely an improvement, the one bug that I’ve seen so far is the kwh display doesn’t seem to work, it starts out at .5 kwh and through the course of a full flight goes up to about .6 or .7 kwh

Glad you got it flashed!

Two things:

  1. I released v6.1 with a fix for that issue (and another small bug) Release 6.1Rt · thandal/eppg-controller · GitHub

  2. I’m in the middle of testing changes to improve robustness to RFI (see my other thread Random Throttle Controller resets? - #7 by nfairfield) – I have some promising results by shifting CPU and/or flash frequencies. Hope to have a new release coming soon!

Awesome!! With regards to the random controller resets, I have had that problem quite a few times too which has resulted in a broken prop. It hasn’t happened for a while but when it does happen it’s usually right on launch which can be a problem because it usually results in a hard landing. I didn’t realize the flash chip being an issue but it seems like you might be onto something.

A few things I’ve tried to correct the reset problem is switching to a more robust connector between the controller and the ESC, upgrading the ESC firmware as well as the controller firmware and increasing the amp cutoff threshold on the BMS. Again I haven’t had the issue in a while and haven’t had it while running your firmware but it’s something that I haven’t found a concrete solution for.