Skip to content
Draft
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
4 changes: 4 additions & 0 deletions data/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ <h1>Phobos LapTimer</h1>
<label for="pwd">WiFi Password:</label>
<input type="password" id="pwd" maxlength="32" />
</div>
<div class="config-item" style="display: none">
<label for="elrs">Elrs bind phrase</label>
<input type="text" id="elrsBindPhrase" maxlength="32" />
</div>
</div>
<button id="EnableAudioButton" onclick="enableAudioLoop()">Enable voice</button>
<button id="DisableAudioButton" onclick="disableAudioLoop()">Disable voice</button>
Expand Down
3 changes: 3 additions & 0 deletions data/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const ssidInput = document.getElementById("ssid");
const pwdInput = document.getElementById("pwd");
const minLapInput = document.getElementById("minLap");
const alarmThreshold = document.getElementById("alarmThreshold");
const elrsBindPhrase = document.getElementById("elrsBindPhrase");

const freqLookup = [
[5865, 5845, 5825, 5805, 5785, 5765, 5745, 5725],
Expand Down Expand Up @@ -85,6 +86,7 @@ onload = function (e) {
timer.innerHTML = "00:00:00 s";
clearLaps();
createRssiChart();
elrsBindPhrase.value = config.elrsBindPhrase
});
};

Expand Down Expand Up @@ -245,6 +247,7 @@ function saveConfig() {
name: pilotNameInput.value,
ssid: ssidInput.value,
pwd: pwdInput.value,
elrsBindPhrase: elrsBindPhrase.value,
}),
})
.then((response) => response.json())
Expand Down
11 changes: 11 additions & 0 deletions lib/CONFIG/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ void Config::toJson(AsyncResponseStream& destination) {
config["name"] = conf.pilotName;
config["ssid"] = conf.ssid;
config["pwd"] = conf.password;
config["elrsBindPhrase"] = conf.elrsBindPhrase;
serializeJson(config, destination);
}

Expand All @@ -74,6 +75,7 @@ void Config::toJsonString(char* buf) {
config["name"] = conf.pilotName;
config["ssid"] = conf.ssid;
config["pwd"] = conf.password;
config["elrsBindPhrase"] = conf.elrsBindPhrase;
serializeJsonPretty(config, buf, 256);
}

Expand Down Expand Up @@ -118,6 +120,10 @@ void Config::fromJson(JsonObject source) {
strlcpy(conf.password, source["pwd"] | "", sizeof(conf.password));
modified = true;
}
if (source["elrsBindPhrase"] != conf.elrsBindPhrase) {
strlcpy(conf.elrsBindPhrase, source["elrsBindPhrase"] | "", sizeof(conf.elrsBindPhrase));
modified = true;
}
}

uint16_t Config::getFrequency() {
Expand Down Expand Up @@ -148,6 +154,10 @@ char* Config::getPassword() {
return conf.password;
}

char* Config::getElrsBindPhrase() {
return conf.elrsBindPhrase;
}

void Config::setDefaults(void) {
DEBUG("Setting EEPROM defaults\n");
// Reset everything to 0/false and then just set anything that zero is not appropriate
Expand All @@ -163,6 +173,7 @@ void Config::setDefaults(void) {
strlcpy(conf.ssid, "", sizeof(conf.ssid));
strlcpy(conf.password, "", sizeof(conf.password));
strlcpy(conf.pilotName, "", sizeof(conf.pilotName));
strlcpy(conf.elrsBindPhrase, "", sizeof(conf.elrsBindPhrase));
modified = true;
write();
}
Expand Down
2 changes: 2 additions & 0 deletions lib/CONFIG/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ typedef struct {
char pilotName[21];
char ssid[33];
char password[33];
char elrsBindPhrase[32];
} laptimer_config_t;

class Config {
Expand All @@ -101,6 +102,7 @@ class Config {
uint8_t getExitRssi();
char* getSsid();
char* getPassword();
char* getElrsBindPhrase();

private:
laptimer_config_t conf;
Expand Down
5 changes: 4 additions & 1 deletion lib/LAPTIMER/laptimer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ void LapTimer::init(Config *config, RX5808 *rx5808, Buzzer *buzzer, Led *l) {
rx = rx5808;
buz = buzzer;
led = l;
startTimeOffsetMs = 0;

filter.setMeasurementNoise(rssi_filter_q * 0.01f);
filter.setProcessNoise(rssi_filter_r * 0.0001f);
Expand All @@ -21,6 +22,7 @@ void LapTimer::init(Config *config, RX5808 *rx5808, Buzzer *buzzer, Led *l) {
void LapTimer::start() {
DEBUG("LapTimer started\n");
state = RUNNING;
startTimeOffsetMs = millis();
buz->beep(500);
led->on(500);
}
Expand All @@ -30,6 +32,7 @@ void LapTimer::stop() {
state = STOPPED;
lapCount = 0;
rssiCount = 0;
startTimeOffsetMs = 0;
memset(lapTimes, 0, sizeof(lapTimes));
buz->beep(500);
led->on(500);
Expand Down Expand Up @@ -75,7 +78,7 @@ void LapTimer::lapPeakCapture() {
// Check if RSSI is greater than the previous detected peak
if (rssi[rssiCount] > rssiPeak) {
rssiPeak = rssi[rssiCount];
rssiPeakTimeMs = millis();
rssiPeakTimeMs = millis() - startTimeOffsetMs;
}
}
}
Expand Down
1 change: 1 addition & 0 deletions lib/LAPTIMER/laptimer.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class LapTimer {
Buzzer *buz;
Led *led;
KalmanFilter filter;
uint32_t startTimeOffsetMs;
uint32_t startTimeMs;
uint8_t lapCount;
uint8_t rssiCount;
Expand Down
1 change: 1 addition & 0 deletions lib/MSP/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Files are copied from https://github.com/ExpressLRS/Backpack/tree/master/lib/MSP commit 476d7c5
Loading