From 594ca5d54bce5803f3722e0263a69b6355ea32c0 Mon Sep 17 00:00:00 2001 From: Marvin Martinson Date: Fri, 8 Nov 2019 18:00:06 +0200 Subject: [PATCH] Line calibration fixed --- .gitignore | 1 + Makefile | 4 ++++ config.json | 4 ++-- hal.py | 4 ++-- main.py | 2 +- 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 61efa50..a2df348 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ esp32*.bin # ignore the development config file config-dev.json +nginx-nchan/ diff --git a/Makefile b/Makefile index 5af2a5f..05ea955 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/config.json b/config.json index fc19260..198d917 100644 --- a/config.json +++ b/config.json @@ -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": "" } } diff --git a/hal.py b/hal.py index 7e4f36b..42a246f 100644 --- a/hal.py +++ b/hal.py @@ -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 diff --git a/main.py b/main.py index a82e7e7..428462c 100644 --- a/main.py +++ b/main.py @@ -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