more information on debug serial

This commit is contained in:
interfisch 2019-12-03 22:53:56 +01:00
parent 4c16b2ab8e
commit 3efae76843
1 changed files with 5 additions and 5 deletions

View File

@ -110,8 +110,8 @@ void ReceiveSerial1()
{ {
// Check for new data availability in the Serial buffer // Check for new data availability in the Serial buffer
if (Serial1.available()) { if (Serial1.available()) {
incomingByte = Serial1.read(); // Read the incoming byte incomingByte = Serial1.read(); // Read the incoming byte
bufStartFrame = ((uint16_t)(incomingBytePrev) << 8) + incomingByte; // Construct the start marker bufStartFrame = ((uint16_t)(incomingBytePrev) << 8) + incomingByte; // Construct the start frame
} }
else { else {
return; return;
@ -137,8 +137,8 @@ void ReceiveSerial1()
// Check if we reached the end of the package // Check if we reached the end of the package
if (idx == sizeof(SerialFeedback)) { if (idx == sizeof(SerialFeedback)) {
uint16_t checksum; uint16_t checksum;
checksum = NewFeedback.start ^ NewFeedback.cmd1 ^ NewFeedback.cmd2 ^ NewFeedback.speedR ^ NewFeedback.speedL 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);
// Check validity of the new data // Check validity of the new data
if (NewFeedback.start == START_FRAME && checksum == NewFeedback.checksum) { if (NewFeedback.start == START_FRAME && checksum == NewFeedback.checksum) {
@ -178,7 +178,7 @@ void loop() {
int16_t speedvalue=constrain(analogRead(PIN_POTI)*1.0/MAXADCVALUE*1000, 0, 1000); int16_t speedvalue=constrain(analogRead(PIN_POTI)*1.0/MAXADCVALUE*1000, 0, 1000);
SendSerial1(speedvalue,0); SendSerial1(speedvalue,0);
Serial.println("-"); Serial.print("millis="); Serial.print(millis()); Serial.print(", steer=0"); Serial.print(", speed="); Serial.println(speedvalue);
last_send = millis(); last_send = millis();