Line calibration fixed

This commit is contained in:
Marvin Martinson 2019-11-08 18:00:06 +02:00
parent 9dd690c5f4
commit 594ca5d54b
5 changed files with 10 additions and 5 deletions

1
.gitignore vendored
View File

@ -4,3 +4,4 @@
esp32*.bin
# ignore the development config file
config-dev.json
nginx-nchan/

View File

@ -6,6 +6,7 @@ SERIAL_PORT=/dev/ttyUSB0
all: flash delay libs config update reset
upload: config update reset console
files: delete libs update config delay reset
delay:
sleep 3
@ -23,6 +24,9 @@ update:
ampy -p $(SERIAL_PORT) put main.py
ampy -p $(SERIAL_PORT) put boot.py
delete:
ampy -p $(SERIAL_PORT) rm main.py
config:
ampy -p $(SERIAL_PORT) put config.json

View File

@ -17,9 +17,9 @@
"left_line_threshold": 4500,
"middle_line_threshold": 4500,
"right_line_threshold": 4500,
"motors_reverse": 1,
"motors_reverse": 0,
"sumo_server": "sumo.koodur.com:80",
"wifis": {
"SSID": "PAROOL"
"sumo": ""
}
}

4
hal.py
View File

@ -49,7 +49,7 @@ class Sumorobot(object):
self.playStop = Pin(self.config["paly/stop_button_pin"], Pin.IN, Pin.PULL_UP)
self.led_power.value(0)
self.led_power.value(1)
self.adc_line_left = ADC(Pin(32))
self.adc_line_middle = ADC(Pin(35))
@ -126,7 +126,7 @@ class Sumorobot(object):
self.config["middle_line_threshold"] = self.adc_line_middle.read()
# Update the config file
with open("config.part", "w") as config_file:
config_file.write(ujson.dumps(config))
config_file.write(ujson.dumps(self.config))
os.rename("config.part", "config.json")
# Function to get light inensity from the phototransistors

View File

@ -86,7 +86,7 @@ def ws_handler():
#print(e)
#if not conn.open:
conn = uwebsockets.connect(url)
#conn = uwebsockets.connect(url)
continue
# When an empty frame was received