mirror of
https://github.com/OpenEPaperLink/OpenEPaperLink.git
synced 2026-03-21 00:04:28 +01:00
[PR #77] [MERGED] ESP: Fix Powermanagement for non-configured POWER #1510
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/OpenEPaperLink/OpenEPaperLink/pull/77
Author: @Mimoja
Created: 7/3/2023
Status: ✅ Merged
Merged: 7/4/2023
Merged by: @jjwbruijn
Base:
master← Head:powerPins📝 Commits (1)
a60bc91ESP: Fix Powermanagement for non-configured POWER📊 Changes
7 files changed (+38 additions, -11 deletions)
View changed files
📝
ESP32_AP-Flasher/include/zbs_interface.h(+1 -1)📝
ESP32_AP-Flasher/platformio.ini(+5 -0)📝
ESP32_AP-Flasher/src/flasher.cpp(+14 -3)📝
ESP32_AP-Flasher/src/powermgt.cpp(+2 -1)📝
ESP32_AP-Flasher/src/serialap.cpp(+5 -2)📝
ESP32_AP-Flasher/src/usbflasher.cpp(+7 -3)📝
ESP32_AP-Flasher/src/zbs_interface.cpp(+4 -1)📄 Description
We currently have two ways of undefining the PowerPin in software for the ESP32 For once we can set POWER_NO_SOFT_POWER which will lead to some helpful screen messages but will still require the definition of the FLASHER_AP_POWER pin.
The second way (which was replaced with POWER_NO_SOFT_POWER) allowed to set the powerPin array to {-1} to indicate that the pin is undefined. This would then be handled in pretty far down the call stack right before toggeling the pin in powerControl:
This however is leading to an error: pin is n pointer (here an array with additional length) to an uint8_t which can never be -1. Therefore the check wont ever be reached and an invalid gpio number is passed to the gpio hal.
This caused the error:
to show up in the logs.
We are now proposing three seperate changes to mitigate this behaviour: 1) We are addng the POWER_NO_SOFT_POWER to the Wemos and the M5Stack boards default configs for new users to find.
2) We are replacing the pin[0] check in powerControl with a check on the pincount and a nullptr check as the zbs_interface->begin() allows for no powerPin to be passed in which case we are dereferencing a nullptr.
3) ZBS_interface->begin() is losing its powerPin related default configurations and sanity checks are put in place before every calling.
We have opted to do 3) in this way and not adding the checked into the ZBS_interface->begin() function which is also passed an uint8_t pointer to keep the API of the class stable for reuse in other projects. Changing the interface however would be ideal here
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.