Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Usermod for Power Measurement using esp's adc #4108

Draft
wants to merge 176 commits into
base: 0_15
Choose a base branch
from

Conversation

Tomas-Kuchta-FPV
Copy link

Hi WLED community,

As an intermediate coder and someone who has benefited from this project, I wanted to contribute by creating a usermod that measures power consumption using a voltage divider and a Hall current sensor.

Summary of Changes

  • Implemented functions to measure power consumption.
  • Introduced support for voltage and current measurement using ESP32 ADC.

There are still some issues that I would need some help with

  • I'm having trouble getting the pin manager to work correctly.
  • There may be other issues I'm not aware of.

Any feedback, suggestions, or assistance would be greatly appreciated!

Thank you for your support!

- Implement functions to measure power consumption
@blazoncek
Copy link
Collaborator

Please rebase your PR for 0_15 branch.

- Implement functions to measure power consumption
@Tomas-Kuchta-FPV
Copy link
Author

Hey there,

I'm not very familiar with Git, and it seems like I've messed something up. I was following your guide on how to properly submit a PR in the wiki, but I think I missed forking the other branches. I'd like to start over from scratch.
Thanks for your patience. I'm sorry for any inconvinience.

@blazoncek blazoncek changed the base branch from main to 0_15 August 19, 2024 09:19
@Tomas-Kuchta-FPV
Copy link
Author

Thank you so much for your help should I reverse the 712b72d commit?

@blazoncek
Copy link
Collaborator

Thank you so much for your help should I reverse the 712b72d commit?

No.

itCarl and others added 22 commits August 19, 2024 22:07
…pdate

Update usermod "Battery" improved MQTT support
- disable JSON live
- WS error string
- button irelevant check
- provide LED types from BusManager for settings
Credit: @netmindz for the idea.
Demystified some byte definitions of WiZmote ESP-NOW message
- move macros to constexpr methods
- introduce type capabilities for UI
- add phase shifting (POC) to PWM
- replace PWM CIE LUT with calculated curve
CIE & phase shifting credit @DedeHai
- LEDC: allocate same timer for CCT PWM
- use SOC constants
BusManager update
- use allocateMultiplePins for BusPwm
- phase shifting correction (limit to PWM CCT)
Clarifications
Add semaphoring
Determine CCT overlap
softhack007 and others added 30 commits October 22, 2024 16:19
added `-D sqrt_internal=sqrtf` -> needed for good performance
Detect IRAM pointers if we can't be sure.
This is a platform feature that asks forgiveness for PROGMEM misuse:
it adds a handler such that incorrectly used PROGMEM will work without
crashing, just really, *really* inefficiently.

Given that most of our real-world use cases for PROGMEM strings are
relatively infrequent text calls, we can err on the side of developer
convenience and address performance problems if and when they arise.
Replace with F() or PSTR() as appropriate.
Since oappend() is now strongly typed, pass the correct type.  This is a
step towards removing the extra shim logic on ESP8266.
Since oappend() is now strongly typed, pass the correct type.  This is a
step towards removing the extra shim logic on ESP8266.
Fix for LED and Scenes uncontrollable using Alexa.
Weird behavior regarding to the device names and shared scenes fixed with this.

Seen in issue Aircoookie/Espalexa#228 and fixed from @ams-hh
Tested by myself and works just fine. Created second pull request here because the library seems to be a bit different from the official Espalexa repo.

---------
Co-authored-by: Frank <[email protected]>
Co-authored-by: Blaz Kristan <[email protected]>
- increase WLED_MAX_BUSSES for C3 (fixes Aircoookie#4215)
- fix for Aircoookie#4228
- fix for very long running effect (strip.now, strip.timebase)
- C++ API change to allow `seg.setColor().setOpacity()`
- fix for Aircoookie#4172
- fix for Aircoookie#4230
- /json/live enabled when WS disabled
this chip has 16MB or 32MB flash, and requires .memory_type = opi_opi
Avoiding name collisions with the 'delay' function.
Fixed point calculation for improved accuracy, dithering in debug builds only.
Averaging and optional multiplier can be set as compile flags, example for speed testing with long averaging and a 10x multiplier:

-D FPS_CALC_AVG=200
-D FPS_MULTIPLIER=10

The calculation resolution is limited (9.7bit fixed point) so values larger than 200 can hit resolution limit and get stuck before reaching the final value.

If WLED_DEBUG is defined, dithering is added to the returned value so sub-frame accuracy is possible in post-processingwithout enabling the multiplier.
bitshift was still set from testing, forgot to update
dithering is not really needed, the FPS_MULTIPLIER is a much better option.
- Implement functions to measure power consumption
- Implement functions to measure power consumption
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
usermod usermod related
Projects
None yet
Development

Successfully merging this pull request may close these issues.