Skip to content

Commit

Permalink
fix: name 'logger' is not defined
Browse files Browse the repository at this point in the history
  • Loading branch information
fl4p committed Feb 18, 2024
1 parent 67f1ec0 commit c594342
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 11 deletions.
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ WORKDIR /app
# RUN apk add --no-cache python3 bluez py-pip git

RUN apk add python3
RUN apk add bluez #< 5.66-r4"
# https://pkgs.alpinelinux.org/packages?name=bluez&branch=v3.16&repo=&arch=aarch64&maintainer=
RUN apk add bluez
#RUN apk add bluez < 5.66-r4"
# https://pkgs.alpinelinux.org/packages?name=bluez&branch=v3.16&repo=&arch=aarch64&maintainer=
RUN apk add py-pip
RUN apk add git
# py3-pip
Expand Down
3 changes: 2 additions & 1 deletion bmslib/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from enum import IntEnum, auto

from bmslib.util import get_logger

logger = get_logger()


def get_bms_model_class(name):
Expand Down
2 changes: 1 addition & 1 deletion bmslib/models/jikong.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ async def fetch(self, wait=True) -> BmsSample:
return self._decode_sample(buf, t_buf)

async def subscribe(self, callback: Callable[[BmsSample], None]):
self._callbacks[0x02].append(lambda buf: callback(self._decode_sample(buf)))
self._callbacks[0x02].append(lambda buf: callback(self._decode_sample(buf, t_buf=time.time())))

async def fetch_voltages(self):
"""
Expand Down
2 changes: 1 addition & 1 deletion bmslib/sampling.py
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ def __init__(self):
self._last: Optional[BmsSample] = None

def __iadd__(self, s: BmsSample):
self._power += s._power
self._power += s.power
self._current += s.current
self._voltage += s.voltage
self._num += 1
Expand Down
8 changes: 4 additions & 4 deletions tools/bit_finder.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
#bytearray(b'\x01\x12\x00\x00u0\x03\xe8'),
#bytearray(b'\x01\x12\x00\x00u0\x03\xe8'),

[ D2 03 04 00 00 00 00 18 FE ],
D203 0400 0000 0018 FE
D203 0400 0000 0018 FE
D203 0400 0000 0018 FE
#[ D2 03 04 00 00 00 00 18 FE ],
#D203 0400 0000 0018 FE
#D203 0400 0000 0018 FE
#D203 0400 0000 0018 FE


"""
Expand Down
2 changes: 1 addition & 1 deletion tools/impedance/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,4 @@ def fetch_batmon_ha_sensors(tr, alias, num_cells, freq='1s'):


if __name__ == "__main__":
fetch_batmon_ha_sensors(("2022-01-05", "2022-02-05"), 'daly_bms')
fetch_batmon_ha_sensors(("2022-01-05", "2022-02-05"), 'daly_bms', num_cells=8)
3 changes: 2 additions & 1 deletion tools/impedance/imp.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import json
import math

import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd

from bmslib.pwmath import EWM

if False: # read from csv files
df = pd.read_csv('mppt_scan_I.csv')
I = pd.Series(df.A.values, index=pd.DatetimeIndex(df.time.values))
Expand Down

0 comments on commit c594342

Please sign in to comment.