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

Berry add energy.update_total() to call EnergyUpdateTotal() from energy driver #19117

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ All notable changes to this project will be documented in this file.
- Partition Wizard is now able to convert to safeboot from Shelly partition layout (#19034)
- Matter mini-profiler (#19075)
- Berry `_class` can be used in `static var` initialization code (#19088)
- Berry add `energy.update_total()` to call `EnergyUpdateTotal()` from energy driver

### Breaking Changed

Expand Down
3 changes: 3 additions & 0 deletions lib/libesp32/berry_tasmota/src/be_energylib.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#ifdef USE_ENERGY_SENSOR

extern struct ENERGY Energy;
extern int energy_update_total(bvm *vm);

#include "solidify/solidified_energy.h"
#include "be_fixed_energy.h"
Expand All @@ -24,6 +25,8 @@ module energy (scope: global) {
read, closure(energy_read_closure)
member, closure(energy_member_closure)
setmember, closure(energy_setmember_closure)

update_total, func(energy_update_total)
}

@const_object_info_end */
Expand Down
9 changes: 9 additions & 0 deletions tasmota/tasmota_xdrv_driver/xdrv_52_3_berry_energy.ino
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,15 @@
*
\*********************************************************************************************/
extern "C" {

int32_t energy_update_total(struct bvm *vm);
int32_t energy_update_total(struct bvm *vm) {
EnergyUpdateTotal();
be_return_nil(vm);
}



#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Winvalid-offsetof" // avoid warnings since we're using offsetof() in a risky way

Expand Down