Added minTime
This commit is contained in:
@@ -526,6 +526,15 @@ void sendTimeToOnlineAPI(int lane, String uid, float timeInSeconds) {
|
||||
|
||||
// Funktionen für lokales Leaderboard
|
||||
void addLocalTime(String uid, String name, unsigned long timeMs) {
|
||||
// Prüfe minimale Zeit für Leaderboard-Eintrag
|
||||
if (timeMs < minTimeForLeaderboard) {
|
||||
Serial.printf(
|
||||
"Zeit zu kurz für Leaderboard: %s (%s) - %.2fs (Minimum: %.2fs)\n",
|
||||
name.c_str(), uid.c_str(), timeMs / 1000.0,
|
||||
minTimeForLeaderboard / 1000.0);
|
||||
return; // Zeit wird nicht ins Leaderboard eingetragen
|
||||
}
|
||||
|
||||
LocalTime newTime;
|
||||
newTime.uid = uid;
|
||||
newTime.name = name;
|
||||
|
||||
@@ -72,7 +72,9 @@ bool learningMode = false;
|
||||
int learningStep = 0; // 0=Start1, 1=Stop1, 2=Start2, 3=Stop2
|
||||
unsigned long maxTimeBeforeReset = 300000; // 5 Minuten default
|
||||
unsigned long maxTimeDisplay = 20000; // 20 Sekunden Standard (in ms)
|
||||
bool wifimodeAP = false; // AP-Modus deaktiviert
|
||||
unsigned long minTimeForLeaderboard =
|
||||
5000; // 5 Sekunden minimum für Leaderboard (in ms)
|
||||
bool wifimodeAP = false; // AP-Modus deaktiviert
|
||||
String masterlocation;
|
||||
int gamemode; // 0=Individual, 1=Wettkampf
|
||||
bool startCompetition = false; // Flag, ob der Timer gestartet wurde
|
||||
|
||||
@@ -82,6 +82,7 @@ void saveSettings() {
|
||||
preferences.begin("settings", false);
|
||||
preferences.putULong("maxTime", maxTimeBeforeReset);
|
||||
preferences.putULong("maxTimeDisplay", maxTimeDisplay);
|
||||
preferences.putULong("minTime", minTimeForLeaderboard);
|
||||
preferences.putUInt("gamemode", gamemode);
|
||||
preferences.putUInt("laneConfigType", laneConfigType);
|
||||
preferences.putUInt("lane1Diff", lane1DifficultyType);
|
||||
@@ -93,6 +94,7 @@ void loadSettings() {
|
||||
preferences.begin("settings", true);
|
||||
maxTimeBeforeReset = preferences.getULong("maxTime", 300000);
|
||||
maxTimeDisplay = preferences.getULong("maxTimeDisplay", 20000);
|
||||
minTimeForLeaderboard = preferences.getULong("minTime", 5000);
|
||||
gamemode = preferences.getUInt("gamemode", 0);
|
||||
laneConfigType = preferences.getUInt("laneConfigType", 0);
|
||||
lane1DifficultyType = preferences.getUInt("lane1Diff", 0);
|
||||
|
||||
@@ -84,6 +84,12 @@ void setupRoutes() {
|
||||
request->getParam("maxTimeDisplay", true)->value().toInt() * 1000;
|
||||
changed = true;
|
||||
}
|
||||
if (request->hasParam("minTimeForLeaderboard", true)) {
|
||||
minTimeForLeaderboard =
|
||||
request->getParam("minTimeForLeaderboard", true)->value().toInt() *
|
||||
1000;
|
||||
changed = true;
|
||||
}
|
||||
if (changed) {
|
||||
saveSettings();
|
||||
DynamicJsonDocument doc(32);
|
||||
@@ -101,6 +107,7 @@ void setupRoutes() {
|
||||
DynamicJsonDocument doc(256);
|
||||
doc["maxTime"] = maxTimeBeforeReset / 1000;
|
||||
doc["maxTimeDisplay"] = maxTimeDisplay / 1000;
|
||||
doc["minTimeForLeaderboard"] = minTimeForLeaderboard / 1000;
|
||||
String result;
|
||||
serializeJson(doc, result);
|
||||
request->send(200, "application/json", result);
|
||||
|
||||
Reference in New Issue
Block a user