Skip to content

Commit

Permalink
Berry add energy.update_total() to call EnergyUpdateTotal() from …
Browse files Browse the repository at this point in the history
…energy driver (#19117)
  • Loading branch information
s-hadinger authored Jul 15, 2023
1 parent ebca2f0 commit ada754c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
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

0 comments on commit ada754c

Please sign in to comment.