Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge v0.9 changes to main #218

Merged
merged 5 commits into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Firmware/RTK_Everywhere/RTK_Everywhere.ino
Original file line number Diff line number Diff line change
Expand Up @@ -737,7 +737,10 @@ unsigned long um980BaseStartTimer; // Tracks how long the base averaging mode ha

RtkMode_t rtkMode; // Mode of operation

unsigned long beepStopMs; // Time at which to turn off beeper
unsigned long beepLengthMs; // Number of ms to make noise
unsigned long beepQuietLengthMs; // Number of ms to make reset between multiple beeps
unsigned long beepNextEventMs; // Time at which to move the beeper to the next state
unsigned long beepCount; // Number of beeps to do

//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Expand Down
11 changes: 9 additions & 2 deletions Firmware/RTK_Everywhere/System.ino
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,15 @@ void finishDisplay()
// Start the beeper and limit its beep length using the tickerBeepUpdate task
void beepDurationMs(uint16_t lengthMs)
{
beepStopMs = millis() + lengthMs;
beepOn();
beepMultiple(1, lengthMs, 0); // Number of beeps, length of beep, length of quiet
}

// Number of beeps, length of beep ms, length of quiet ms
void beepMultiple(int numberOfBeeps, int lengthOfBeepMs, int lengthOfQuietMs)
{
beepCount = numberOfBeeps;
beepLengthMs = lengthOfBeepMs;
beepQuietLengthMs = lengthOfQuietMs;
}

void beepOn()
Expand Down
89 changes: 75 additions & 14 deletions Firmware/RTK_Everywhere/Tasks.ino
Original file line number Diff line number Diff line change
Expand Up @@ -1042,7 +1042,7 @@ void handleGnssDataTask(void *e)
slowConsumer = "SD card";
}
} // bytesToSend
} // End connected
} // End connected

//----------------------------------------------------------------------
// Update the available space in the ring buffer
Expand Down Expand Up @@ -1230,18 +1230,74 @@ void tickerBatteryLedUpdate()
}
}

enum BeepState
{
BEEP_OFF = 0,
BEEP_ON,
BEEP_QUIET,
};
BeepState beepState = BEEP_OFF;

// Control the length of time the beeper makes noise
// We move through a simple state machine in order to handle multiple types of beeps (see beepMultiple())
void tickerBeepUpdate()
{
if (present.beeper == true)
{
if (beepStopMs > 0)
switch (beepState)
{
if (millis() >= beepStopMs)
default:
if (beepState != BEEP_OFF)
beepState = BEEP_OFF;
break;

case BEEP_OFF:
if (beepLengthMs > 0)
{
beepNextEventMs = millis() + beepLengthMs;
beepOn();
beepState = BEEP_ON;
}
break;

case BEEP_ON:
if (millis() >= beepNextEventMs)
{
if (beepCount == 1)
{
beepLengthMs = 0; // Stop state machine
beepState = BEEP_OFF;
beepOff();
}
else
{
beepNextEventMs = millis() + beepQuietLengthMs;
beepState = BEEP_QUIET;
beepOff();
}
}
break;

case BEEP_QUIET:
if (millis() >= beepNextEventMs)
{
beepStopMs = 0; // Signal the beeper is off
beepOff();
beepCount--;

if (beepCount == 0)
{
// We should not be here, but just in case
beepLengthMs = 0; // Stop state machine
beepState = BEEP_OFF;
beepOff();
}
else
{
beepNextEventMs = millis() + beepLengthMs;
beepState = BEEP_ON;
beepOn();
}
}
break;
}
}
}
Expand Down Expand Up @@ -1359,18 +1415,23 @@ void buttonCheckTask(void *e)

// The RTK Torch uses a shutdown IC configured to turn off ~3s
// Beep shortly before the shutdown IC takes over
else if (userBtn->pressedFor(2500))
else if (userBtn->pressedFor(2100))
{
// Beep if we are not locally compiled or a release candidate
if (ENABLE_DEVELOPER == false)
beepDurationMs(500); // Announce powering down

tickerStop(); // Stop controlling LEDs via ticker task

gnssStatusLedOn();
bluetoothLedOn();

// Beep if we are not locally compiled or a release candidate
if (ENABLE_DEVELOPER == false)
{
// Announce powering down
beepMultiple(3, 100, 50); // Number of beeps, length of beep ms, length of quiet ms

delay(500); //We will be shutting off during this delay but this prevents another beepMultiple() from firing
}
}
} // End productVariant == Torch
} // End productVariant == Torch
else // RTK EVK, RTK Facet v2, RTK Facet mosaic
{
if (systemState == STATE_SHUTDOWN)
Expand Down Expand Up @@ -1477,7 +1538,7 @@ void buttonCheckTask(void *e)
// requestChangeState(STATE_BASE_NOT_STARTED);
break;
} // End singleTap switch (systemState)
} // End singleTap
} // End singleTap
else if (doubleTap && (firstRoverStart == false) && (settings.disableSetupButton == false))
{
switch (systemState)
Expand Down Expand Up @@ -1516,8 +1577,8 @@ void buttonCheckTask(void *e)
// requestChangeState(STATE_BASE_NOT_STARTED);
break;
} // End doubleTap switch (systemState)
} // End doubleTap
} // End productVariant != Torch
} // End doubleTap
} // End productVariant != Torch

feedWdt();
taskYIELD();
Expand Down
2 changes: 1 addition & 1 deletion Firmware/RTK_Everywhere/Tilt.ino
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ void tiltUpdate()
// Check to see if tilt compensation is active
if (tiltSensor->isCorrecting())
{
beepDurationMs(2000); // Audibly indicate the start of tilt
beepMultiple(2, 500, 500); //Number of beeps, length of beep ms, length of quiet ms

lastTiltBeepMs = millis();

Expand Down
88 changes: 40 additions & 48 deletions Firmware/RTK_Everywhere/menuGNSS.ino
Original file line number Diff line number Diff line change
Expand Up @@ -85,49 +85,41 @@ void menuGNSS()

systemPrintln("4) Set Constellations");

systemPrint("5) Toggle NTRIP Client: ");
systemPrintf("5) Minimum elevation for a GNSS satellite to be used in fix (degrees): %d\r\n", settings.minElev);

systemPrintf("6) Minimum satellite signal level for navigation (dBHz): %d\r\n", gnssGetMinCno());

systemPrint("7) Toggle NTRIP Client: ");
if (settings.enableNtripClient == true)
systemPrintln("Enabled");
else
systemPrintln("Disabled");

if (settings.enableNtripClient == true)
{
systemPrint("6) Set Caster Address: ");
systemPrint("8) Set Caster Address: ");
systemPrintln(settings.ntripClient_CasterHost);

systemPrint("7) Set Caster Port: ");
systemPrint("9) Set Caster Port: ");
systemPrintln(settings.ntripClient_CasterPort);

systemPrint("8) Set Caster User Name: ");
systemPrint("10) Set Caster User Name: ");
systemPrintln(settings.ntripClient_CasterUser);

systemPrint("9) Set Caster User Password: ");
systemPrint("11) Set Caster User Password: ");
systemPrintln(settings.ntripClient_CasterUserPW);

systemPrint("10) Set Mountpoint: ");
systemPrint("12) Set Mountpoint: ");
systemPrintln(settings.ntripClient_MountPoint);

systemPrint("11) Set Mountpoint PW: ");
systemPrint("13) Set Mountpoint PW: ");
systemPrintln(settings.ntripClient_MountPointPW);

systemPrint("12) Toggle sending GGA Location to Caster: ");
systemPrint("14) Toggle sending GGA Location to Caster: ");
if (settings.ntripClient_TransmitGGA == true)
systemPrintln("Enabled");
else
systemPrintln("Disabled");

systemPrintf("13) Minimum elevation for a GNSS satellite to be used in fix (degrees): %d\r\n",
settings.minElev);

systemPrintf("14) Minimum satellite signal level for navigation (dBHz): %d\r\n", gnssGetMinCno());
}
else
{
systemPrintf("6) Minimum elevation for a GNSS satellite to be used in fix (degrees): %d\r\n",
settings.minElev);

systemPrintf("7) Minimum satellite signal level for navigation (dBHz): %d\r\n", gnssGetMinCno());
}

systemPrintln("x) Exit");
Expand Down Expand Up @@ -227,18 +219,39 @@ void menuGNSS()
{
gnssMenuConstellations();
}

else if (incoming == 5)
{
// Arbitrary 90 degree max
if (getNewSetting("Enter minimum elevation in degrees", 0, 90, &settings.minElev) == INPUT_RESPONSE_VALID)
{
gnssSetElevation(settings.minElev);
}
}
else if (incoming == 6)
{
int minCNO = 0;
// Arbitrary 90 dBHz max
if (getNewSetting("Enter minimum satellite signal level for navigation in dBHz", 0, 90, &minCNO) ==
INPUT_RESPONSE_VALID)
{
// We don't know which platform we are using so we cannot explicitly use the settings.minCNO_F9P, eg
gnssSetMinCno(minCNO);
}
}

else if (incoming == 7)
{
settings.enableNtripClient ^= 1;
restartRover = true;
}
else if ((incoming == 6) && settings.enableNtripClient == true)
else if ((incoming == 8) && settings.enableNtripClient == true)
{
systemPrint("Enter new Caster Address: ");
getUserInputString(settings.ntripClient_CasterHost, sizeof(settings.ntripClient_CasterHost));
restartRover = true;
}
else if ((incoming == 7) && settings.enableNtripClient == true)
else if ((incoming == 9) && settings.enableNtripClient == true)
{
// Arbitrary 99k max port #
if (getNewSetting("Enter new Caster Port", 1, 99999, &settings.ntripClient_CasterPort) ==
Expand All @@ -247,56 +260,35 @@ void menuGNSS()
restartRover = true;
}
}
else if ((incoming == 8) && settings.enableNtripClient == true)
else if ((incoming == 10) && settings.enableNtripClient == true)
{
systemPrintf("Enter user name for %s: ", settings.ntripClient_CasterHost);
getUserInputString(settings.ntripClient_CasterUser, sizeof(settings.ntripClient_CasterUser));
restartRover = true;
}
else if ((incoming == 9) && settings.enableNtripClient == true)
else if ((incoming == 11) && settings.enableNtripClient == true)
{
systemPrintf("Enter user password for %s: ", settings.ntripClient_CasterHost);
getUserInputString(settings.ntripClient_CasterUserPW, sizeof(settings.ntripClient_CasterUserPW));
restartRover = true;
}
else if ((incoming == 10) && settings.enableNtripClient == true)
else if ((incoming == 12) && settings.enableNtripClient == true)
{
systemPrint("Enter new Mount Point: ");
getUserInputString(settings.ntripClient_MountPoint, sizeof(settings.ntripClient_MountPoint));
restartRover = true;
}
else if ((incoming == 11) && settings.enableNtripClient == true)
else if ((incoming == 13) && settings.enableNtripClient == true)
{
systemPrintf("Enter password for Mount Point %s: ", settings.ntripClient_MountPoint);
getUserInputString(settings.ntripClient_MountPointPW, sizeof(settings.ntripClient_MountPointPW));
restartRover = true;
}
else if ((incoming == 12) && settings.enableNtripClient == true)
else if ((incoming == 14) && settings.enableNtripClient == true)
{
settings.ntripClient_TransmitGGA ^= 1;
restartRover = true;
}
else if (((incoming == 13) && settings.enableNtripClient == true) ||
(incoming == 6 && settings.enableNtripClient == false))
{
// Arbitrary 90 degree max
if (getNewSetting("Enter minimum elevation in degrees", 0, 90, &settings.minElev) == INPUT_RESPONSE_VALID)
{
gnssSetElevation(settings.minElev);
}
}
else if (((incoming == 14) && settings.enableNtripClient == true) ||
(incoming == 7 && settings.enableNtripClient == false))
{
int minCNO = 0;
// Arbitrary 90 dBHz max
if (getNewSetting("Enter minimum satellite signal level for navigation in dBHz", 0, 90, &minCNO) ==
INPUT_RESPONSE_VALID)
{
// We don't know which platform we are using so we cannot explicitly use the settings.minCNO_F9P, eg
gnssSetMinCno(minCNO);
}
}

else if (incoming == INPUT_RESPONSE_GETNUMBER_EXIT)
break;
Expand Down
Loading
Loading