mirror of
https://github.com/meshtastic/python.git
synced 2026-01-03 13:28:02 -05:00
17 lines
435 B
Python
17 lines
435 B
Python
"""code logging power consumption of meshtastic devices."""
|
|
|
|
import math
|
|
import time
|
|
|
|
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."""
|
|
|
|
# Sim a 20mW load that varies sinusoidally
|
|
return (20 + 5 * math.sin(time.time())) / 1000
|