WILL NOT USE GPS MODES
This commit is contained in:
parent
c3d300ce37
commit
262819572c
|
|
@ -153,7 +153,47 @@ void setup() {
|
|||
menuDisplay = 0;
|
||||
}
|
||||
|
||||
/*uint8_t pm2Command[] = { // get Power Mode Command
|
||||
0xB5, 0x62, 0x06, 0x3B, 0x00, 0x00, 0x41, 0xBB
|
||||
};*/
|
||||
|
||||
//bool testGps = true;
|
||||
void loop() {
|
||||
|
||||
/*if (testGps) {
|
||||
GPS_Utils::sendUBXCommand(pm2Command, sizeof(pm2Command));
|
||||
testGps = false;
|
||||
}
|
||||
|
||||
if (neo6m_gps.available()) {
|
||||
uint8_t response[40]; // Size of CFG-PM2 response is 40 bytes
|
||||
int len = neo6m_gps.readBytes(response, sizeof(response));
|
||||
|
||||
// Check if we got the correct UBX-CFG-PM2 response
|
||||
if (len == 40 && response[0] == 0xB5 && response[1] == 0x62 && response[2] == 0x06 && response[3] == 0x3B) {
|
||||
// Extract the power mode
|
||||
uint32_t powerMode = response[16]; // powerSetupValue is at byte 16
|
||||
Serial.print("Current Power Mode: ");
|
||||
Serial.println(powerMode, HEX); // Display the power mode in hex
|
||||
|
||||
// Interpret power mode:
|
||||
switch (powerMode) {
|
||||
case 0x00:
|
||||
Serial.println("Continuous Mode (Full Power Mode)");
|
||||
break;
|
||||
case 0x01:
|
||||
Serial.println("Power Save Mode (Eco Mode)");
|
||||
break;
|
||||
case 0x02:
|
||||
Serial.println("Trickle Power Mode");
|
||||
break;
|
||||
default:
|
||||
Serial.println("Unknown Mode");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
currentBeacon = &Config.beacons[myBeaconsIndex];
|
||||
if (statusState) {
|
||||
if (Config.validateConfigFile(currentBeacon->callsign)) {
|
||||
|
|
|
|||
|
|
@ -42,9 +42,60 @@ float bearing = 0;
|
|||
|
||||
bool gpsIsActive = true;
|
||||
|
||||
uint8_t pm2Command[] = { // Continuous Mode
|
||||
0xB5, 0x62, 0x06, 0x3B, 0x2C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0xF0, 0x52
|
||||
};
|
||||
|
||||
/*uint8_t pm2Command[] = { // Power Save Mode
|
||||
0xB5, 0x62, 0x06, 0x3B, 0x2C, 0x00, 0xE0, 0xE1, 0x03, 0x00, 0x01, 0x00, 0x00, 0x00,
|
||||
0x88, 0x13, 0x00, 0x00, 0xE8, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x4C, 0x64
|
||||
};*/
|
||||
|
||||
/*uint8_t pm2Command[] = { // Balanced Power Save Mode (Eco Mode)
|
||||
0xB5, 0x62, 0x06, 0x3B, 0x2C, 0x00, 0xE0, 0xE1, 0x03, 0x00, 0x01, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0xE8, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x8C, 0x9B
|
||||
};*/
|
||||
|
||||
/*uint8_t pm2Command[] = { // Trickle Power Mode
|
||||
0xB5, 0x62, 0x06, 0x3B, 0x2C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00, 0x10, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x3C, 0x4D
|
||||
};*/
|
||||
|
||||
/*uint8_t pm2Command[] = { // Backup Mode
|
||||
0xB5, 0x62, 0x06, 0x3E, 0x08, 0x00, 0x06, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x2A, 0xAF
|
||||
};*/
|
||||
|
||||
/*uint8_t pm2Command[] = { // Standby Mode
|
||||
0xB5, 0x62, 0x06, 0x3E, 0x08, 0x00, 0x06, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x3A, 0xB7
|
||||
};*/
|
||||
|
||||
|
||||
// UBX-CFG-PM2 query command
|
||||
/*uint8_t pm2Command[] = { // get Power Mode Command
|
||||
0xB5, 0x62, 0x06, 0x3B, 0x00, 0x00, 0x41, 0xBB
|
||||
};*/
|
||||
|
||||
|
||||
namespace GPS_Utils {
|
||||
|
||||
void sendUBXCommand(uint8_t *msg, uint8_t len) {
|
||||
for (int i = 0; i < len; i++) {
|
||||
neo6m_gps.write(msg[i]);
|
||||
}
|
||||
Serial.println("UBX command sent to GPS!");
|
||||
}
|
||||
|
||||
void setup() {
|
||||
if (disableGPS) {
|
||||
logger.log(logging::LoggerLevel::LOGGER_LEVEL_WARN, "Main", "GPS disabled");
|
||||
|
|
@ -56,6 +107,11 @@ namespace GPS_Utils {
|
|||
delay(200);
|
||||
#endif
|
||||
neo6m_gps.begin(GPS_BAUD, SERIAL_8N1, GPS_TX, GPS_RX);
|
||||
|
||||
//
|
||||
delay(2000);
|
||||
sendUBXCommand(pm2Command, sizeof(pm2Command));
|
||||
//
|
||||
}
|
||||
|
||||
void calculateDistanceCourse(const String& callsign, double checkpointLatitude, double checkPointLongitude) {
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
namespace GPS_Utils {
|
||||
|
||||
void sendUBXCommand(uint8_t *msg, uint8_t len);
|
||||
void setup();
|
||||
void calculateDistanceCourse(const String& callsign, double checkpointLatitude, double checkPointLongitude);
|
||||
void getData();
|
||||
|
|
|
|||
Loading…
Reference in New Issue