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
|
#define PIN_TOUCH 5
|
||||||
long last_touch=0;
|
long last_touch=0;
|
||||||
#define TOUCH_TIMEOUT 300
|
#define TOUCH_TIMEOUT 100
|
||||||
|
|
||||||
//command variables
|
//command variables
|
||||||
boolean motorenabled=false;
|
boolean motorenabled=false;
|
||||||
|
@ -75,8 +75,8 @@ boolean motorenabled=false;
|
||||||
#define PIN_POWERON 7
|
#define PIN_POWERON 7
|
||||||
|
|
||||||
#define TRACKPOINT_MAX 70 //value for maximum stick movement
|
#define TRACKPOINT_MAX 70 //value for maximum stick movement
|
||||||
float speedscale=0.7;
|
float speedscale=0.0;
|
||||||
float steerscale=0.3;
|
float steerscale=0.0;
|
||||||
|
|
||||||
int16_t last_xin=0;
|
int16_t last_xin=0;
|
||||||
int16_t last_yin=0;
|
int16_t last_yin=0;
|
||||||
|
@ -166,6 +166,8 @@ void setup() {
|
||||||
voltage=readVcc();
|
voltage=readVcc();
|
||||||
Serial.print("Voltage=");
|
Serial.print("Voltage=");
|
||||||
Serial.println( voltage, DEC );
|
Serial.println( voltage, DEC );
|
||||||
|
|
||||||
|
setup_updateSpeedmode(); //set speeds
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -293,10 +295,6 @@ void loop() {
|
||||||
|
|
||||||
senddata.steer=map(xin_smooth, -1000,1000, 127+(128*steerscale), 127-(127*steerscale) ); //steer
|
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
|
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
|
senddata.commands=0; //reset
|
||||||
|
|
||||||
|
@ -492,11 +490,11 @@ long readVcc() {
|
||||||
void setup_updateSpeedmode(){
|
void setup_updateSpeedmode(){
|
||||||
switch(speedmode){
|
switch(speedmode){
|
||||||
case 0: //slow
|
case 0: //slow
|
||||||
speedscale=0.3;
|
speedscale=0.15;
|
||||||
steerscale=0.2;
|
steerscale=0.2;
|
||||||
break;
|
break;
|
||||||
case 1: //medium
|
case 1: //medium
|
||||||
speedscale=0.6;
|
speedscale=0.4;
|
||||||
steerscale=0.45;
|
steerscale=0.45;
|
||||||
break;
|
break;
|
||||||
case 2: //fast
|
case 2: //fast
|
||||||
|
|
Loading…
Reference in New Issue