diff --git a/controller/controller.ino b/controller/controller.ino index 82609b9..0643538 100644 --- a/controller/controller.ino +++ b/controller/controller.ino @@ -7,6 +7,15 @@ //to flash set boot0 (the one further away from reset button) to 1 and press reset, flash, program executes immediately //set boot0 back to 0 to run program on powerup +//Flashing the hoverbrett controller: +/* + * connect uart adapter to serial port cable (the one with more red heatshrink) + * (disconnect xt30 power connector) + * set jumper on usb uart adapter to output 5V + * hold boot0 button (black, the outermost) while powering up (or restarting with small button next to it) + * flash + */ + //PA2 may be defective on my bluepill #define SERIAL_CONTROL_BAUD 38400 // [-] Baud rate for HoverSerial (used to communicate with the hoverboard) @@ -187,6 +196,8 @@ typedef struct{ int16_t speedL_meas; int16_t batVoltage; int16_t boardTemp; + int16_t curL_DC; + int16_t curR_DC; int16_t checksum; } SerialFeedback; SerialFeedback Feedback; @@ -654,7 +665,7 @@ void ReceiveSerial2() if (idx == sizeof(SerialFeedback)) { uint16_t checksum; checksum = (uint16_t)(NewFeedback.start ^ NewFeedback.cmd1 ^ NewFeedback.cmd2 ^ NewFeedback.speedR ^ NewFeedback.speedL - ^ NewFeedback.speedR_meas ^ NewFeedback.speedL_meas ^ NewFeedback.batVoltage ^ NewFeedback.boardTemp); + ^ NewFeedback.speedR_meas ^ NewFeedback.speedL_meas ^ NewFeedback.batVoltage ^ NewFeedback.boardTemp ^ NewFeedback.curL_DC ^ NewFeedback.curR_DC); // Check validity of the new data if (NewFeedback.start == START_FRAME && checksum == NewFeedback.checksum) { @@ -670,6 +681,8 @@ void ReceiveSerial2() Serial.print(" 6: "); Serial.print(Feedback.speedL_meas); Serial.print(" 7: "); Serial.print(Feedback.batVoltage); Serial.print(" 8: "); Serial.println(Feedback.boardTemp); + Serial.print(" 9: "); Serial.print(Feedback.curL_DC); //in mA (100mA resolution), in hoverbrett negative sign for forward + Serial.print(" 10: "); Serial.println(Feedback.curR_DC); //in mA (100mA resolution), in hoverbrett negative sign for forward } else { Serial.println("Non-valid data skipped"); } diff --git a/hoverboard-firmware-hack-foc-serial-esc b/hoverboard-firmware-hack-foc-serial-esc index 1d9843a..d62793f 160000 --- a/hoverboard-firmware-hack-foc-serial-esc +++ b/hoverboard-firmware-hack-foc-serial-esc @@ -1 +1 @@ -Subproject commit 1d9843a26c1d76f6fa997315a490db089c48ec57 +Subproject commit d62793f9a2d6d04a1e8681fbcffbc6ccb309f8f4