Skip to content

Commit

Permalink
multiBitFlag rollover to 0 once max is reached (#87)
Browse files Browse the repository at this point in the history
Co-authored-by: Nate Gay <[email protected]>
Co-authored-by: Alan De La Torre <[email protected]>
  • Loading branch information
3 people authored Jan 18, 2025
1 parent fc514a3 commit eea2381
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
4 changes: 2 additions & 2 deletions lib/pysquared/bitflags.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ def __get__(self, obj, objtype=None):
return (obj.micro.nvm[self.byte] & self.bit_mask) >> self.lowest_bit

def __set__(self, obj, value):
if value >= self.maxval:
value = self.maxval
if value > self.maxval:
value = 0
value <<= self.lowest_bit
reg = obj.micro.nvm[self.byte]
reg &= ~self.bit_mask
Expand Down
6 changes: 1 addition & 5 deletions lib/pysquared/pysquared.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,7 @@ def debug_print(self, statement: Any) -> None:
print(co("[pysquared]" + str(statement), "green", "bold"))

def error_print(self, statement: Any) -> None:
self.c_error_count: multiBitFlag = (
self.c_error_count + 1
) & 0xFF # Limited to 255 errors
self.c_error_count += 1 # Limited to 255 errors
if self.debug:
print(co("[pysquared]" + str(statement), "red", "bold"))

Expand Down Expand Up @@ -204,8 +202,6 @@ def __init__(self) -> None:
"""
NVM Parameter Resets
"""
if self.c_boot > 200:
self.c_boot = 0

if self.f_softboot:
self.f_softboot = False
Expand Down

0 comments on commit eea2381

Please sign in to comment.