Skip to content

Commit

Permalink
Add Sentinel AAT module
Browse files Browse the repository at this point in the history
For use with other OSD
Provides GPS tracking for use with Sentinel AAT tracker
  • Loading branch information
ShikOfTheRa committed May 12, 2021
1 parent 3ea7a13 commit 730fce6
Show file tree
Hide file tree
Showing 5 changed files with 105 additions and 1 deletion.
2 changes: 2 additions & 0 deletions MW_OSD/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@
//#define LTM2ADSB // Uncomment for a LTM protocol to ADSB converter
//#define UBLOX2ADSB // Uncomment for a UBLOX protocol to ADSB converter
//#define ESCOSD // Uncomment this if using ESC OSD - displays ESC TELEMETRY VALUES recieved on serial RX. Suitable for single ESC only.
//#define SENTINELAAT_UBLOX // Uncomment this to create a SENTINEL AAT module for use with other OSD using UBLOX GPS
//#define SENTINELAAT_NMEA // Uncomment this to create a SENTINEL AAT module for use with other OSD using NMEA GPS

// old releases supported...
//#define MULTIWII_V23 // Uncomment this if you are using MW versions 2.2/2.3
Expand Down
11 changes: 11 additions & 0 deletions MW_OSD/Def.h
Original file line number Diff line number Diff line change
Expand Up @@ -686,6 +686,17 @@
#define MENU_STAT
#endif

#if defined SENTINELAAT_UBLOX
#define GPSOSD_UBLOX
#define SENTINELAAT
#define INTRO_DELAY 0
#endif
#if defined SENTINELAAT_NMEA
#define GPSOSD_NMEA
#define SENTINELAAT
#define INTRO_DELAY 0
#endif

#if defined GPSOSD_UBLOX_KK
#define UBLOX
#define KKAUDIOVARIO AUDIOPIN // Enable this for audio vario. AUDIOPIN = D2 on AEROMAX hardware. Alternatively use A3 (RSSI) with other hardware
Expand Down
7 changes: 7 additions & 0 deletions MW_OSD/GPS.ino
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,9 @@ bool GPS_NMEA_newFrame(char c) {
if (checksum == parity) {
timer.packetcount++;
frameOK = 1;
#ifdef SENTINELAAT
sentinel.gpsdata = true;
#endif // SENTINELAAT
if (frame == FRAME_GGA) {
GPS_updateGGA();
}
Expand Down Expand Up @@ -556,6 +559,10 @@ bool GPS_UBLOX_newFrame(uint8_t data) {

bool UBLOX_parse_gps(void) {
timer.packetcount++;
#ifdef SENTINELAAT
sentinel.gpsdata = true;
#endif // SENTINELAAT

switch (_msg_id) {
case MSG_POSLLH:
//i2c_dataset.time = _buffer.posllh.time;
Expand Down
18 changes: 18 additions & 0 deletions MW_OSD/GlobalVariables.h
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,24 @@ struct __adsb {
}
adsb;

#ifdef SENTINELAAT
#define SENTINELTIMEOUT 4500
struct __sentinel {
bool gpsdata = false;
bool gpsdetected = false;
uint8_t baud = 99;
uint16_t timeout = SENTINELTIMEOUT;
uint32_t timer_led=0;
uint32_t timer_maxreset = 0;
uint32_t timer_gpsdata = 0;
uint32_t timer_baudchange = 0;
}
sentinel;

uint32_t SentinelBaud[] {115200,57600,9600,38400,19200,4800};
#endif // SENTINELAAT


#ifdef ADSBSTATION
const char ADSBTitle[] PROGMEM = "ADS-B SENSE AND AVOID";
const char ADSBHeading[] PROGMEM = "ICAO DIST ALT HDG SPD";
Expand Down
68 changes: 67 additions & 1 deletion MW_OSD/MW_OSD.ino
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ void loop()
{
// It would be beneficial to run this every few seconds to identify and reset max7456 lockups from low voltages
static uint32_t lastcheck;
if (millis() / 1000 == lastcheck){
if (millis() / 1000 > lastcheck){
MAX7456CheckStatus();
lastcheck = millis() / 1000;
}
Expand All @@ -350,6 +350,72 @@ void loop()
if (millis() > (vsync_timer + VSYNC_TIMEOUT))
MAX7456_DrawScreen();
}
#elif defined SENTINELAAT
void loop() // SENTINEL GPSOSD
{
Settings[S_AAT] = 1;
serialMSPreceive(1);

// Max lockup detect.............
if (millis() > sentinel.timer_maxreset){
MAX7456CheckStatus();
sentinel.timer_maxreset = millis();
}

// LED................
if (sentinel.gpsdetected == true){
sentinel.timer_led=millis();
}
if ( millis() > (sentinel.timer_led + 1000)){
sentinel.timer_led=millis();
}
else if (millis() > (sentinel.timer_led+ 500)){
LEDOFF
}
else{
LEDON
}

// Autodetect baud rate.............
if (millis() > sentinel.timer_gpsdata){
sentinel.gpsdetected = false;
}
if (sentinel.gpsdata == true){
sentinel.gpsdetected =true;
sentinel.timer_gpsdata=millis()+SENTINELTIMEOUT;
}
sentinel.gpsdata = false;

if (sentinel.gpsdetected == false){
if (sentinel.timeout > (SENTINELTIMEOUT)){
sentinel.timeout = 0;
}
if (millis() > sentinel.timer_baudchange){
sentinel.baud++;
if (sentinel.baud>5){
sentinel.baud = 0;
sentinel.timeout +=1500;
}
serialMSPreceive(1);
Serial.begin(SentinelBaud[sentinel.baud]);
delay(10);
serialMSPreceive(1);
sentinel.timer_baudchange = millis() + sentinel.timeout;
}
}

// Draw .............
if (displayReady != true){
displayAAT();
//displayDebug();
//displayGPSPosition();
//displayArmed();
//displayNumberOfSat();
displayReady = true;
}
if (millis() > (vsync_timer + VSYNC_TIMEOUT))
MAX7456_DrawScreen();
}
#else
//------------------------------------------------------------------------
void loop()
Expand Down

0 comments on commit 730fce6

Please sign in to comment.