Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add throttle control in cruising mode with UART #14

Open
wants to merge 2 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,10 @@ Update 2.0 introduces quite a few new interesting features to the remote, and fi
To-do:
* UART throttle control
* Introducing cruise control

## Issues

Randomly won't start, have to reset:
* Solder a 100uF capacitor in series with a 10K resistor from the reset pin to 3.3v and minus pin of the capacitor to GND. This [delays the setup of the Arduino](https://forum.arduino.cc/index.php?topic=256771.msg3893494#msg3893494), ensuring it doesn’t crash on startup.
[Like show on this image](https://forum.arduino.cc/index.php?action=dlattach;topic=256771.0;attach=276522;image).

6 changes: 3 additions & 3 deletions receiver/receiver.ino
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ void updateSetting( uint8_t setting, uint64_t value)
}
}

void setCruise ( bool cruise = true, uint16_t setPoint = defaultThrottle ){
void setCruise ( bool cruise = true, uint16_t setPoint = defaultThrottle, uint16_t throttle = defaultThrottle ){
if( rxSettings.controlMode == 0 ){

setThrottle( setPoint );
Expand All @@ -451,7 +451,7 @@ void setCruise ( bool cruise = true, uint16_t setPoint = defaultThrottle ){

} else{

UART.nunchuck.valueY = 127;
UART.nunchuck.valueY = map(throttle, 0, 1023, 0, 255);
UART.setNunchuckValues();

}
Expand Down Expand Up @@ -503,7 +503,7 @@ void speedControl( uint16_t throttle , bool trigger )
cruising = true;
}

setCruise( true, cruiseThrottle );
setCruise( true, cruiseThrottle, throttle );

}else{
cruising = false;
Expand Down