improved for higher speed
This commit is contained in:
parent
4cad7ab867
commit
dc81636839
|
@ -63,7 +63,7 @@ long last_sendNRF=0;
|
|||
|
||||
#define PIN_TOUCH 5
|
||||
long last_touch=0;
|
||||
#define TOUCH_TIMEOUT 300
|
||||
#define TOUCH_TIMEOUT 100
|
||||
|
||||
//command variables
|
||||
boolean motorenabled=false;
|
||||
|
@ -75,8 +75,8 @@ boolean motorenabled=false;
|
|||
#define PIN_POWERON 7
|
||||
|
||||
#define TRACKPOINT_MAX 70 //value for maximum stick movement
|
||||
float speedscale=0.7;
|
||||
float steerscale=0.3;
|
||||
float speedscale=0.0;
|
||||
float steerscale=0.0;
|
||||
|
||||
int16_t last_xin=0;
|
||||
int16_t last_yin=0;
|
||||
|
@ -167,6 +167,8 @@ void setup() {
|
|||
Serial.print("Voltage=");
|
||||
Serial.println( voltage, DEC );
|
||||
|
||||
setup_updateSpeedmode(); //set speeds
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -294,10 +296,6 @@ void loop() {
|
|||
senddata.steer=map(xin_smooth, -1000,1000, 127+(128*steerscale), 127-(127*steerscale) ); //steer
|
||||
senddata.speed=map(yin_smooth, -1000,1000, 127-(127*speedscale), 127+(128*speedscale) ); //speed
|
||||
|
||||
Serial.print(senddata.steer);
|
||||
Serial.print(", ");
|
||||
Serial.println(senddata.speed);
|
||||
|
||||
senddata.commands=0; //reset
|
||||
|
||||
if (!radioOk || setupmode!=SETUP_NONE){ //if last transmission failed or in setup mode
|
||||
|
@ -492,11 +490,11 @@ long readVcc() {
|
|||
void setup_updateSpeedmode(){
|
||||
switch(speedmode){
|
||||
case 0: //slow
|
||||
speedscale=0.3;
|
||||
speedscale=0.15;
|
||||
steerscale=0.2;
|
||||
break;
|
||||
case 1: //medium
|
||||
speedscale=0.6;
|
||||
speedscale=0.4;
|
||||
steerscale=0.45;
|
||||
break;
|
||||
case 2: //fast
|
||||
|
|
Loading…
Reference in New Issue