PPK2 based power measurements seem to approximately work

This commit is contained in:
Kevin Hester
2024-06-25 15:19:21 -07:00
parent ff20ad5d05
commit 231bc25255
6 changed files with 95 additions and 28 deletions

View File

@@ -9,8 +9,8 @@ from .power_supply import PowerSupply
class SimPowerSupply(PowerSupply):
"""A simulated power supply for testing."""
def getAverageWatts(self) -> float:
"""Get the total amount of power that is currently being consumed."""
def get_average_current_mA(self) -> float:
"""Returns average current of last measurement in mA (since last call to this method)"""
# Sim a 20mW load that varies sinusoidally
return (20 + 5 * math.sin(time.time())) / 1000
return (20.0 + 5 * math.sin(time.time()))