From b2245f83f6a0dc2246f3f4fcecfbef318f4a283e Mon Sep 17 00:00:00 2001 From: Fisch Date: Sun, 14 Jul 2024 10:34:29 +0200 Subject: [PATCH] add command documentation --- controller_teensy/README.md | 60 +++++++++++++++++++++++++++++ controller_teensy/include/logging.h | 46 +++++++++++----------- 2 files changed, 83 insertions(+), 23 deletions(-) create mode 100644 controller_teensy/README.md diff --git a/controller_teensy/README.md b/controller_teensy/README.md new file mode 100644 index 0000000..b17b979 --- /dev/null +++ b/controller_teensy/README.md @@ -0,0 +1,60 @@ +# Bobbycar Controller + +## Serial Commands + +If Vusb jumper on PCB is soldered, do not connect USB while LiPo is connected! + +**echo off** +Turn off serial command echo. +Useful for automated transfer. + +**echo on** +Turns on serial command echo. +Useful for manual command execution. + +**test** +Returns "OK" + +**ls** +List files on SD card in a machine readable way. +One file per line with full path. + +**la -a** +List files tab formatted. With file sizes. + +**cat FILENAME** +Print out the contents of a specified file. +If no filename given, the current active logfile is used. + +**get FILENAME** +Sends the contents of a specified file in chunks. +Waits for the checksum of the send chunks before sending the next chunk. +Exits with an error message when checksum does not match. +Used for automated transfer of files. + +**sizeof FILENAME** +Returns the size in bytes of the specified file. + +**chunksize SIZE** +Sets the size of chunks for file transmission. See **get** command. +Default is 128. + +**rm FILENAME** +Deletes file from sd card. + +**log off** +Turns off logging flag. + +**log on** +Turns on logging flag. + +**show stats** +Prints some current stats values. +One variable per line. +Format: parameternamevalue + +**show sensors** +Prints some sensor values that are useful in standstill. +One variable per line. +Format: parameternamevalue + diff --git a/controller_teensy/include/logging.h b/controller_teensy/include/logging.h index 3e4e792..cfd8c9f 100644 --- a/controller_teensy/include/logging.h +++ b/controller_teensy/include/logging.h @@ -356,30 +356,30 @@ void serialCommandLoop(unsigned long loopmillis,ESCSerialComm& escFront, ESCSeri writeLogComment(loopmillis, "Datalogging enabled by serial command"); Serial.print("Log enabled: "); Serial.println(datalogging_filename); }else if(smessage.equals("show stats")) { - Serial.print("overallTrip="); Serial.println(overallTrip); - Serial.print("overallCurrentConsumed="); Serial.println(overallCurrentConsumed); - Serial.print("overallWatthoursConsumed="); Serial.println(overallWatthoursConsumed); - Serial.print("voltage="); Serial.println(getBatteryVoltage(escFront,escRear)); + Serial.print("overallTrip\t"); Serial.println(overallTrip); + Serial.print("overallCurrentConsumed\t"); Serial.println(overallCurrentConsumed); + Serial.print("overallWatthoursConsumed\t"); Serial.println(overallWatthoursConsumed); + Serial.print("voltage\t"); Serial.println(getBatteryVoltage(escFront,escRear)); }else if(smessage.equals("show sensors")) { - Serial.print("loopmillis(s) \t"); Serial.println(loopmillis/1000.0,3); - Serial.print("temp_ESCFront \t"); Serial.println(escFront.getFeedback_boardTemp()); - Serial.print("temp_ESCRear \t"); Serial.println(escRear.getFeedback_boardTemp()); - Serial.print("vbat_Front \t"); Serial.println(escFront.getFeedback_batVoltage()); - Serial.print("vbat_Rear \t"); Serial.println(escRear.getFeedback_batVoltage()); - Serial.print("throttle \t"); Serial.println(throttle_pos); - Serial.print("brake \t"); Serial.println(brake_pos); - Serial.print("trip_Front \t"); Serial.println(escFront.getTrip()); - Serial.print("trip_Rear \t"); Serial.println(escRear.getTrip()); - Serial.print("trip \t"); Serial.println(trip); - Serial.print("currentConsumed_Front \t"); Serial.println(escFront.getCurrentConsumed(),3); - Serial.print("currentConsumed_Rear \t"); Serial.println(escRear.getCurrentConsumed(),3); - Serial.print("currentConsumed \t"); Serial.println(currentConsumed,3); - Serial.print("watthoursConsumed \t"); Serial.println(watthoursConsumed,3); - Serial.print("temp_Front \t"); Serial.println(temp_ESCFront,3); - Serial.print("temp_Rear \t"); Serial.println(temp_ESCRear,3); - Serial.print("temp_Air \t"); Serial.println(temp_Air,3); - Serial.print("looptime_duration_min \t"); Serial.println(looptime_duration_min); - Serial.print("looptime_duration_max \t"); Serial.println(looptime_duration_max); + Serial.print("loopmillis\t"); Serial.println(loopmillis); + Serial.print("temp_ESCFront\t"); Serial.println(escFront.getFeedback_boardTemp()); + Serial.print("temp_ESCRear\t"); Serial.println(escRear.getFeedback_boardTemp()); + Serial.print("vbat_Front\t"); Serial.println(escFront.getFeedback_batVoltage()); + Serial.print("vbat_Rear\t"); Serial.println(escRear.getFeedback_batVoltage()); + Serial.print("throttle\t"); Serial.println(throttle_pos); + Serial.print("brake\t"); Serial.println(brake_pos); + Serial.print("trip_Front\t"); Serial.println(escFront.getTrip()); + Serial.print("trip_Rear\t"); Serial.println(escRear.getTrip()); + Serial.print("trip\t"); Serial.println(trip); + Serial.print("currentConsumed_Front\t"); Serial.println(escFront.getCurrentConsumed(),3); + Serial.print("currentConsumed_Rear\t"); Serial.println(escRear.getCurrentConsumed(),3); + Serial.print("currentConsumed\t"); Serial.println(currentConsumed,3); + Serial.print("watthoursConsumed\t"); Serial.println(watthoursConsumed,3); + Serial.print("temp_Front\t"); Serial.println(temp_ESCFront,3); + Serial.print("temp_Rear\t"); Serial.println(temp_ESCRear,3); + Serial.print("temp_Air\t"); Serial.println(temp_Air,3); + Serial.print("looptime_duration_min\t"); Serial.println(looptime_duration_min); + Serial.print("looptime_duration_max\t"); Serial.println(looptime_duration_max); } message_pos = 0;