add sending battery charge indication

This commit is contained in:
Silver Kuusik 2019-04-14 16:39:19 +02:00
parent 6892e0d3bc
commit df39bd642c
2 changed files with 4 additions and 2 deletions

View File

@ -2,8 +2,8 @@
"status_led_pin": 22, "status_led_pin": 22,
"battery_coeff": 2.25, "battery_coeff": 2.25,
"sumo_id": "xxxxxxxx", "sumo_id": "xxxxxxxx",
"firmware_timestamp": "2019.04.07 14:44:00", "firmware_timestamp": "2019.04.14 16:34:00",
"firmware_version": "0.4.1", "firmware_version": "0.4.2",
"left_servo_tuning": 33, "left_servo_tuning": 33,
"right_servo_tuning": 33, "right_servo_tuning": 33,
"ultrasonic_distance": 40, "ultrasonic_distance": 40,

2
hal.py
View File

@ -57,6 +57,7 @@ class Sumorobot(object):
self.bat_status = 4.3 self.bat_status = 4.3
self.move_counter = 0 self.move_counter = 0
self.adc_battery = ADC(Pin(32)) self.adc_battery = ADC(Pin(32))
self.bat_charge = Pin(25, Pin.IN)
# The pullups for the phototransistors # The pullups for the phototransistors
Pin(19, Pin.IN, Pin.PULL_UP) Pin(19, Pin.IN, Pin.PULL_UP)
@ -282,6 +283,7 @@ class Sumorobot(object):
left_line = self.get_line(LEFT), left_line = self.get_line(LEFT),
right_line = self.get_line(RIGHT), right_line = self.get_line(RIGHT),
opponent = self.get_opponent_distance(), opponent = self.get_opponent_distance(),
battery_charge = self.bat_charge.value(),
battery_voltage = self.get_battery_voltage() battery_voltage = self.get_battery_voltage()
) )