some accumulated local mods, not all tested

This commit is contained in:
Jeff Epler 2018-07-02 20:52:53 -05:00
parent b526880814
commit 8226630e9d
2 changed files with 66 additions and 2 deletions

View file

@ -200,6 +200,39 @@ bool setGPS_OutputFreq16MHz()
return gps_set_sucess;
}
// 360Hz
bool setGPS_OutputFreq360Hz()
{
int gps_set_sucess=0;
uint8_t setOutputFreq[] = {
0xb5, 0x62, 0x06, 0x31, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x68, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00,
0x00, 0x00, 0xef, 0x00, 0x00, 0x00, 0x62, 0xca,
};
sendUBX(setOutputFreq, sizeof(setOutputFreq)/sizeof(uint8_t));
gps_set_sucess=getUBX_ACK(setOutputFreq);
//Serial.println("Set output Freq Done");
return gps_set_sucess;
}
// 5Hz
bool setGPS_OutputFreq5Hz()
{
int gps_set_sucess=0;
uint8_t setOutputFreq[] = {
0xb5, 0x62, 0x06, 0x31, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00,
0x00, 0x00, 0xef, 0x00, 0x00, 0x00, 0xfe, 0xfb,
};
sendUBX(setOutputFreq, sizeof(setOutputFreq)/sizeof(uint8_t));
gps_set_sucess=getUBX_ACK(setOutputFreq);
//Serial.println("Set output Freq Done");
return gps_set_sucess;
}
void sendUBX(uint8_t *MSG, uint8_t len) {
gpsPort.flush();
@ -257,4 +290,4 @@ boolean getUBX_ACK(uint8_t *MSG) {
}//else
}//If
}//While
}//getUBX_ACK
}//getUBX_ACK

View file

@ -66,7 +66,8 @@ void setup()
//Program GPS to output RF
if (setGPS_OutputFreq(SPEED_ARG)) {
Serial.println (F("GPS Initialized to output RF at " SPEED_STR "\nInitialization is complete.\n"));
Serial.print (F("GPS Initialized to output RF at "));
Serial.println (F(SPEED_STR "\nInitialization is complete.\n"));
GPSOK = true;
}
else
@ -78,12 +79,42 @@ void setup()
//--------------------------
void handle_serial() {
static uint8_t state = 0;
static uint32_t acc;
uint8_t ch = Serial.read();
if(ch == 'F') { state = 1; acc = 0; }
if(state == 1 && ch == '\n') {
if(setGPS_OutputFreq(acc)) {
Serial.print (F("GPS Initialized to output RF at "));
Serial.println (acc);
GPSOK = true;
}
else
{
Serial.println (F("Error! Could not program GPS!"));
GPSOK = false;
}
state = 0;
} else if(state) {
if (ch >= '0' && ch <= '9') {
acc = acc * 10 + ch - '0';
} else if (ch == 'M') {
acc *= 1000000lu;
} else if (ch == 'K') {
acc *= 1000lu;
}
}
}
//-------------------------- Main loop -----------------------
void loop()
{
while (Serial.available()) {
handle_serial();
}
while (gps.available( gpsPort )) {
fix = gps.read();
if (fix.valid.location && fix.valid.date && fix.valid.time)