More fixes

This commit is contained in:
Stephan Hadinger 2022-09-06 23:02:08 +02:00
parent 18a950f61c
commit dc1221f709
2 changed files with 18 additions and 18 deletions

View File

@ -4,12 +4,12 @@
class Wire class Wire
var bus var bus
def read_bytes(addr,reg,size) def read_bytes(addr,reg,sz)
self._begin_transmission(addr) self._begin_transmission(addr)
self._write(reg) self._write(reg)
self._end_transmission(false) self._end_transmission(false)
self._request_from(addr,size) self._request_from(addr,sz)
var ret=bytes(size) var ret=bytes(sz)
while (self._available()) while (self._available())
ret..self._read() ret..self._read()
end end

View File

@ -15,7 +15,7 @@ uint8 = ctypes.u8
uint16 = ctypes.u16 uint16 = ctypes.u16
uint32 = ctypes.u32 uint32 = ctypes.u32
int32 = ctypes.i32 int32 = ctypes.i32
bool = ctypes.u8 bol = ctypes.u8
energy_struct = [ energy_struct = [
[float, "voltage"], [float, "voltage"],
@ -80,16 +80,16 @@ energy_struct = [
[uint8, "phase_count"], [uint8, "phase_count"],
[bool, "voltage_common"], [bol, "voltage_common"],
[bool, "frequency_common"], [bol, "frequency_common"],
[bool, "use_overtemp"], [bol, "use_overtemp"],
[bool, "today_offset_init_kwh"], [bol, "today_offset_init_kwh"],
[bool, "voltage_available"], [bol, "voltage_available"],
[bool, "current_available"], [bol, "current_available"],
[bool, "type_dc"], [bol, "type_dc"],
[bool, "power_on"], [bol, "power_on"],
# #ifdef USE_ENERGY_MARGIN_DETECTION # #ifdef USE_ENERGY_MARGIN_DETECTION
[uint16, "power_history_0"], [uint16, "power_history_0"],
[uint16, "power_history_0_2"], [uint16, "power_history_0_2"],
@ -103,12 +103,12 @@ energy_struct = [
[uint8, "power_steady_counter"], [uint8, "power_steady_counter"],
[bool, "min_power_flag"], [bol, "min_power_flag"],
[bool, "max_power_flag"], [bol, "max_power_flag"],
[bool, "min_voltage_flag"], [bol, "min_voltage_flag"],
[bool, "max_voltage_flag"], [bol, "max_voltage_flag"],
[bool, "min_current_flag"], [bol, "min_current_flag"],
[bool, "max_current_flag"], [bol, "max_current_flag"],
# #ifdef USE_ENERGY_POWER_LIMIT # #ifdef USE_ENERGY_POWER_LIMIT
[uint16, "mplh_counter"], [uint16, "mplh_counter"],