update to new gps library

This commit is contained in:
Mario 2021-03-11 10:57:43 +01:00
parent a8f57b200c
commit 2e00fdaa1c

View File

@ -303,36 +303,36 @@ Blockly.Arduino.sensebox_scd30 = function () {
Blockly.Arduino.sensebox_gps = function () { Blockly.Arduino.sensebox_gps = function () {
var dropdown = this.getFieldValue('dropdown'); var dropdown = this.getFieldValue('dropdown');
Blockly.Arduino.libraries_['gps_library'] = '#include "SparkFun_Ublox_Arduino_Library.h"' Blockly.Arduino.libraries_['gps_library'] = '#include <SparkFun_u-blox_GNSS_Arduino_Library.h>'
Blockly.Arduino.libraries_['wire'] = '#include <Wire.h>' Blockly.Arduino.libraries_['wire'] = '#include <Wire.h>'
Blockly.Arduino.libraries_['library_senseBoxMCU'] = '#include "SenseBoxMCU.h"'; Blockly.Arduino.libraries_['library_senseBoxMCU'] = '#include "SenseBoxMCU.h"';
Blockly.Arduino.definitions_['GPS'] = 'SFE_UBLOX_GPS myGPS;'; Blockly.Arduino.definitions_['GPS'] = 'SFE_UBLOX_GNSS myGNSS;';
Blockly.Arduino.setupCode_['init_gps'] = ` Wire.begin(); Blockly.Arduino.setupCode_['init_gps'] = ` Wire.begin();
if (myGPS.begin() == false) //Connect to the Ublox module using Wire port if (myGNSS.begin() == false) //Connect to the Ublox module using Wire port
{ {
Serial.println(F("Ublox GPS not detected at default I2C address. Please check wiring. Freezing.")); Serial.println(F("Ublox GPS not detected at default I2C address. Please check wiring. Freezing."));
while (1); while (1);
} }
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise) myGNSS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
myGPS.saveConfiguration(); //Save the current settings to flash and BBR`; myGNSS.saveConfiguration(); //Save the current settings to flash and BBR`;
var code = ''; var code = '';
switch (dropdown) { switch (dropdown) {
case 'latitude': case 'latitude':
code = 'myGPS.getLatitude()'; code = 'myGNSS.getLatitude()';
break; break;
case 'longitude': case 'longitude':
code = 'myGPS.getLongitude()'; code = 'myGNSS.getLongitude()';
break; break;
case 'altitude': case 'altitude':
code = 'myGPS.getAltitudeMSL()'; code = 'myGNSS.getAltitudeMSL()';
break; break;
case 'pDOP': case 'pDOP':
code = 'myGPS.getPDOP()'; code = 'myGNSS.getPDOP()';
break; break;
case 'fixType': case 'fixType':
code = 'myGPS.getFixType()'; code = 'myGNSS.getFixType()';
break; break;
default: default:
code = '' code = ''