Exemplo n.º 1
0
    error_occured = 1
    print("raised error")

finally:
    update_successful = 0
    if error_occured is 0:
        counter = 0

        for i in range(15):
            print('.', sep=' ', end=' ', flush=True)
            time.sleep(1)

        while (1):
            try:
                sys.stdout = open(os.devnull, 'w')
                fw_ver = api.get_firmware_ver()
                sys.stdout = sys.__stdout__
            except:
                counter += 1
                print('.', sep=' ', end=' ', flush=True)
            else:
                update_successful = 1
            finally:
                if update_successful is 1:
                    print("\nUpdate is Successful to FW Ver: " + str(fw_ver))
                    break
                else:
                    if counter >= 10:
                        print("Update is Failed!")
                        break
Exemplo n.º 2
0
print("System Current: " + str(api.get_system_current()))               #Required delay #default 50
print("System Power: " + str(api.get_system_power()))                   #Required delay #default 50

print("************* Battery **************")
print("Battery Temp: " + str(api.get_battery_temp()))
print("Battery Voltage: " + str(api.get_battery_voltage()))
print("Battery Current: " + str(api.get_battery_current()))
print("Battery Power: " + str(api.get_battery_power()))
print("Battery Level: " + str(api.get_battery_level()))
print("Battery Health: " + str(api.get_battery_health()))
print("Battery Max Charge Level: " + str(api.get_battery_max_charge_level()))
print("Battery Capacity: " + str(api.get_battery_design_capacity()))

print("************* Safe Shutdown **************")
print("Battery Safe Shutdown Battery Level: " + str(api.get_safe_shutdown_battery_level()))
print("Battery Safe Shutdown Battery Status: " + str(api.get_safe_shutdown_battery_status()))

print("************* Fan **************")
print("Fan Health: " + str(api.get_fan_health()))
print("Fan Speed: " + str(api.get_fan_speed()))
print("Fan Fan Automation: " + str(api.get_fan_automation()))

print("************* rtc time **************")
print("RTC Time: " + str(api.get_rtc_time(Definition.TIME_FORMAT_EPOCH)))
print("RTC Time: " + str(api.get_rtc_time(Definition.TIME_FORMAT_DATE_AND_TIME)))

print("************* Firmware Ver **************")
print("Firmware Ver: " + str(api.get_firmware_ver()))

print("************* Event **************")
print("IDs of Scheduled Events: " + str(api.get_scheduled_event_ids()))
Exemplo n.º 3
0
import sys

sys.path.append('./')

from power_api import SixfabPower, Definition, Event
import time

api = SixfabPower()

#api.reset_mcu()

if (not api.get_working_mode()): exit()

print("Time: " + str(api.get_rtc_time(Definition.TIME_FORMAT_DATE_AND_TIME)))

print(api.get_firmware_ver())

print("************* Input Sensors **************")
print("Input Temp: " + str(api.get_input_temp()))
print("Input Voltage: " + str(api.get_input_voltage()))
print("Input Current: " + str(api.get_input_current()))
print("Input Power: " +
      str(api.get_input_power()))  #Required delay #default 50

print("************* System Sensors **************")
print("System Temp: " + str(api.get_system_temp()))
print("System Voltage: " + str(api.get_system_voltage()))
print("System Current: " +
      str(api.get_system_current()))  #Required delay #default 50
print("System Power: " +
      str(api.get_system_power()))  #Required delay #default 50