Skip to content

Commit

Permalink
Added support for RAK12500, start of ver 0.4a
Browse files Browse the repository at this point in the history
  • Loading branch information
r4wk committed Oct 3, 2022
1 parent 5e3d927 commit bdc4447
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 4 deletions.
2 changes: 1 addition & 1 deletion platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ board = wiscore_rak4631
framework = arduino
build_flags =
-DSW_VERSION_1=0
-DSW_VERSION_2=3
-DSW_VERSION_2=4
-DSW_VERSION_3=0
-DLIB_DEBUG=0
-DAPI_DEBUG=1
Expand Down
2 changes: 1 addition & 1 deletion src/app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include "app.h"

/** Set the device name, max length is 10 characters */
char g_ble_dev_name[10] = "WB-Mapper";
char g_ble_dev_name[10] = "R4K-FM";

/** Flag showing if TX cycle is ongoing */
bool lora_busy = false;
Expand Down
2 changes: 2 additions & 0 deletions src/app.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ void ftester_tx_beacon(void);
void ftester_acc_event(void);
void ftester_setGPSData(int64_t lat, int64_t lon);
void ftester_GPSBusy(bool busy);
void ftester_SetGPSType(bool type);

/** Examples for application events */
#define ACC_TRIGGER 0b1000000000000000
Expand All @@ -86,6 +87,7 @@ uint8_t init_gnss(void);
bool poll_gnss(uint8_t gnss_option);
// Field Mapper
extern TinyGPSPlus my_rak1910_gnss;
extern SFE_UBLOX_GNSS my_rak12500_gnss;

/** Accelerometer stuff */
#include <SparkFunLIS3DH.h>
Expand Down
30 changes: 28 additions & 2 deletions src/fieldtester.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ int8_t ftester_satCount = 0;
bool ftester_gpsLock = false;
// Is field tester busy
bool ftester_busy = false;
// Is 12500 installed
bool israk12500 = false;

// Instance for display object (RENDER UPSIDE DOWN)
U8G2_SSD1306_128X64_NONAME_F_HW_I2C u8g2(U8G2_R2);
Expand Down Expand Up @@ -423,13 +425,21 @@ void ftester_setGPSData(int64_t lat, int64_t lon)
*/
void ftester_gps_fix(bool fix)
{
ftester_satCount = my_rak1910_gnss.satellites.value();
if(israk12500)
{
ftester_satCount = my_rak12500_gnss.getSIV();
} else {
ftester_satCount = my_rak1910_gnss.satellites.value();
}


if(fix)
{
if(!ftester_gpsLock)
{
sendToDisplay("GPS satellites found!");
// SAVE FIX INFO FOR NEXT BOOT RAK12500?
if(israk12500) { my_rak12500_gnss.saveConfigSelective(VAL_CFG_SUBSEC_NAVCONF); }
ftester_gpsLock = true;
}
} else {
Expand All @@ -443,6 +453,22 @@ void ftester_gps_fix(bool fix)
}
}

/**
* @brief Check what GNNS module to use
*
* @param type
*/
void ftester_SetGPSType(bool type)
{
israk12500 = type;
if(type)
{
sendToDisplay("Initialized RAK12500");
} else {
sendToDisplay("Initialized RAK1910");
}
}

/**
* @brief Allows me to know if GPS
* Module is busy, thus making ftester busy
Expand All @@ -463,7 +489,7 @@ void ftester_init(void)
u8g2.begin();
u8g2.setFont(u8g2_font_micro_mr);
u8g2.drawXBM(0, 0, rak_width, rak_height, rak_bits);
u8g2.drawStr(74, 10, "R4K v0.3a");
u8g2.drawStr(74, 10, "R4K v0.4a");
u8g2.drawStr(74, 16, "Field Tester");
u8g2.drawStr(74, 28, "Alpha Build");
u8g2.drawStr(38, 64, "Joining Helium Network!");
Expand Down
6 changes: 6 additions & 0 deletions src/gnss.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,12 @@ uint8_t init_gnss(void)
if (rak12500_present)
{
my_rak12500_gnss.setI2COutput(COM_TYPE_UBX); // Set the I2C port to output UBX only (turn off NMEA noise)
// Field Tester
my_rak12500_gnss.setHighPrecisionMode(false);
my_rak12500_gnss.saveConfigSelective(VAL_CFG_SUBSEC_IOPORT); // Save (only) the communications port settings to flash and BBR
MYLOG("GNSS", "Detected and initialized RAK12500");
// Hook for Field Tester
ftester_SetGPSType(true);
return RAK12500_GNSS;
}
else
Expand All @@ -72,6 +76,8 @@ uint8_t init_gnss(void)
while (!Serial1)
;
MYLOG("GNSS", "Initialized RAK1910");
// Hook for Field Tester
ftester_SetGPSType(false);
return RAK1910_GNSS;
}
}
Expand Down

0 comments on commit bdc4447

Please sign in to comment.