Added RNode battery info to rnstatus output

This commit is contained in:
Mark Qvist 2024-10-01 17:25:44 +02:00
parent 560c8e164c
commit b5bde99322
2 changed files with 14 additions and 0 deletions

View File

@ -1319,6 +1319,13 @@ class Reticulum:
if hasattr(interface, "r_channel_load_long"): if hasattr(interface, "r_channel_load_long"):
ifstats["channel_load_long"] = interface.r_channel_load_long ifstats["channel_load_long"] = interface.r_channel_load_long
if hasattr(interface, "r_battery_state"):
if interface.r_battery_state != 0x00:
ifstats["battery_state"] = interface.r_battery_state
if hasattr(interface, "r_battery_percent"):
ifstats["battery_percent"] = interface.r_battery_percent
if hasattr(interface, "bitrate"): if hasattr(interface, "bitrate"):
if interface.bitrate != None: if interface.bitrate != None:
ifstats["bitrate"] = interface.bitrate ifstats["bitrate"] = interface.bitrate

View File

@ -292,6 +292,13 @@ def program_setup(configdir, dispall=False, verbosity=0, name_filter=None, json=
if "bitrate" in ifstat and ifstat["bitrate"] != None: if "bitrate" in ifstat and ifstat["bitrate"] != None:
print(" Rate : {ss}".format(ss=speed_str(ifstat["bitrate"]))) print(" Rate : {ss}".format(ss=speed_str(ifstat["bitrate"])))
if "battery_percent" in ifstat and ifstat["battery_percent"] != None:
try:
bpi = int(ifstat["battery_percent"])
print(" Battery : {bp}%".format(bp=bpi))
except:
pass
if "airtime_short" in ifstat and "airtime_long" in ifstat: if "airtime_short" in ifstat and "airtime_long" in ifstat:
print(" Airtime : {ats}% (15s), {atl}% (1h)".format(ats=str(ifstat["airtime_short"]),atl=str(ifstat["airtime_long"]))) print(" Airtime : {ats}% (15s), {atl}% (1h)".format(ats=str(ifstat["airtime_short"]),atl=str(ifstat["airtime_long"])))