Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
b4177c9b0f | |||
0763fe2181 | |||
024a00e1bf | |||
2fea8cfdd6 | |||
25f05ed832 | |||
3d090dceb1 |
@ -15,6 +15,11 @@ custom_flash_version = env.GetProjectOption("custom_flash_version", "0.99")
|
||||
fw_major, fw_minor = custom_firmware_version.split('.')
|
||||
fl_major, fl_minor = custom_flash_version.split('.')
|
||||
|
||||
fw_major_int = int(fw_major)
|
||||
fw_minor_int = int(fw_minor)
|
||||
fl_major_int = int(fl_major)
|
||||
fl_minor_int = int(fl_minor)
|
||||
|
||||
# Version in Datei "version" im Ordner "data_src" überschreiben
|
||||
with open('data_src/version', 'w') as version_file:
|
||||
version_file.write(custom_flash_version)
|
||||
@ -23,10 +28,10 @@ with open('data_src/version', 'w') as version_file:
|
||||
env.Replace(PROGNAME="firmware_%s_%s.fw" % (custom_firmware_version, git_revision))
|
||||
env.Append(CPPDEFINES=[
|
||||
('GIT_REV', '\\"{}\\"'.format(git_revision)),
|
||||
('FW_MAJOR', fw_major),
|
||||
('FW_MINOR', fw_minor),
|
||||
('FL_MAJOR', fl_major),
|
||||
('FL_MINOR', fl_minor)
|
||||
('FW_MAJOR', fw_major_int),
|
||||
('FW_MINOR', fw_minor_int),
|
||||
('FL_MAJOR', fl_major_int),
|
||||
('FL_MINOR', fl_minor_int)
|
||||
])
|
||||
|
||||
struct2json.struct2json()
|
||||
|
19
Software/codegen/wifiAP_passcalc.py
Normal file
19
Software/codegen/wifiAP_passcalc.py
Normal file
@ -0,0 +1,19 @@
|
||||
def djb2_hash(s):
|
||||
hash = 5381
|
||||
for c in s:
|
||||
hash = ((hash << 5) + hash) + ord(c) # hash * 33 + c
|
||||
return hash & 0xFFFFFFFF # Ensure it's a 32-bit unsigned integer
|
||||
|
||||
def generate_password(seed, chip_id):
|
||||
combined = (seed + chip_id)[:24] # Ensure the combined string is up to 24 characters
|
||||
hash_value = djb2_hash(combined)
|
||||
hash_str = f"{hash_value:08X}{hash_value:08X}" # Repeat the hash to ensure at least 16 characters
|
||||
return hash_str[:32] # Ensure the password is at most 32 characters
|
||||
|
||||
if __name__ == "__main__":
|
||||
SEED = "letmelubeyou"
|
||||
chip_id = input("Enter the Chip ID in hex (e.g., 1A2B3C4D): ").strip()
|
||||
chip_id = chip_id.zfill(8).upper() # Ensure it's 8 characters, upper case
|
||||
|
||||
password = generate_password(SEED, chip_id)
|
||||
print(f"Generated Password: {password}")
|
@ -4,19 +4,19 @@
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Dark Emergency Timer</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="stylesheet" href="static/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="static/css/custom.css">
|
||||
<link rel="stylesheet" href="static/css/tweaks.css">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<link rel="stylesheet" href="static/css/bootstrap.min.css" />
|
||||
<link rel="stylesheet" href="static/css/custom.css" />
|
||||
<link rel="stylesheet" href="static/css/tweaks.css" />
|
||||
<script src="static/js/jquery.min.js"></script>
|
||||
<script src="static/js/bootstrap.min.js"></script>
|
||||
<script src="static/js/websocket.js"></script>
|
||||
<script src="static/js/dtc_table.js"></script>
|
||||
<script src="static/js/script.js"></script>
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="static/img/apple-touch-icon.png">
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="static/img/favicon-32x32.png">
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="static/img/favicon-16x16.png">
|
||||
<link rel="manifest" href="static/img/site.webmanifest">
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="static/img/apple-touch-icon.png" />
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="static/img/favicon-32x32.png" />
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="static/img/favicon-16x16.png" />
|
||||
<link rel="manifest" href="static/img/site.webmanifest" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
@ -31,93 +31,125 @@
|
||||
<!-- Notification-Container -->
|
||||
<div id="notification-container" class="notification-container"></div>
|
||||
<!-- Notification-Container -->
|
||||
|
||||
<nav class="navbar fixed-top navbar-dark bg-primary" id="navbar1">
|
||||
<a class="navbar-brand" href="#">
|
||||
<img src="static/img/logo.png" width="30" height="30" class="d-inline-block align-top mr-1" alt="">
|
||||
<img src="static/img/logo.png" width="30" height="30" class="d-inline-block align-top mr-1" alt="" />
|
||||
<span class="data-devicename">DE Airsoft Timer</span>
|
||||
</a>
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#collapsingNavbar"
|
||||
aria-controls="collapsingNavbar" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
|
||||
<div class="collapse navbar-collapse" id="collapsingNavbar">
|
||||
<ul class="navbar-nav nav mr-auto mt-2 mt-lg-0">
|
||||
|
||||
<li class="nav-item"><a class="nav-link active" role="tab" data-toggle="tab" href="#tab_home">Home</a></li>
|
||||
<li class="nav-item"><a class="nav-link" role="tab" data-toggle="tab" href="#tab_maintenance">Wartung</a></li>
|
||||
<li class="nav-item"><a class="nav-link" role="tab" data-toggle="tab" href="#tab_source">Einstellungen</a></li>
|
||||
<li class="nav-item"><a class="nav-link" role="tab" data-toggle="tab" href="#tab_fwupdate">Update</a></li>
|
||||
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" role="tab" data-toggle="tab" href="#tab_home">Home</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" role="tab" data-toggle="tab" href="#tab_maintenance">Wartung</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" role="tab" data-toggle="tab" href="#tab_source">Einstellungen</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" role="tab" data-toggle="tab" href="#tab_fwupdate">Update</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<main class="container">
|
||||
|
||||
<!-- Tabs Content -->
|
||||
<div class="tab-content">
|
||||
<!-- Div Tab Home-->
|
||||
<div id="tab_home" class="tab-pane fade show active" role="tabpanel">
|
||||
<div class="col text-center">
|
||||
<div class="jumbotron">
|
||||
<img src="static/img/logo.png" width="120" height="120" class="img-fluid" alt="">
|
||||
<h3 class="pt-3"><span class="data-devicename">DE Airsoft Timer</span></h3>
|
||||
<img src="static/img/logo.png" width="120" height="120" class="img-fluid" alt="" />
|
||||
<h3 class="pt-3">
|
||||
<span class="data-devicename">DE Airsoft Timer</span>
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Div Group Battery remain -->
|
||||
<hr />
|
||||
<p>
|
||||
<h4>Akkuladestand</h4>
|
||||
<div class="progress">
|
||||
<div id="battery_level" class="data-battery_level progress-bar text-light" role="progressbar" aria-valuenow="0"
|
||||
<div id="batterylevel" class="data-batterylevel progress-bar text-light" role="progressbar" aria-valuenow="0"
|
||||
aria-valuemin="0" aria-valuemax="100" style="width: 0%">
|
||||
0
|
||||
</div>
|
||||
</div>
|
||||
</p>
|
||||
<!-- Div Group Battery remain -->
|
||||
<!-- Div Group current Mode -->
|
||||
<hr />
|
||||
<p>
|
||||
<h4>aktueller Modus</h4>
|
||||
<input class="data-systemstatus form-control" type="text" id="sysstatus" readonly>
|
||||
</p>
|
||||
<input class="data-systemstatus form-control" type="text" id="sysstatus" readonly />
|
||||
<!-- Div Group current Mode -->
|
||||
<!-- Div Group Faction Points -->
|
||||
<hr />
|
||||
<p>
|
||||
<h4>aktueller Punktestand</h4>
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div id="header_faction1" class="col text-center data-name_faction1 text-white p-3">%NAME_FAC_1%</div>
|
||||
<div id="header_faction2" class="col text-center data-name_faction2 text-white p-3">%NAME_FAC_2%</div>
|
||||
<div id="header_faction3" class="col text-center data-name_faction3 text-white p-3">%NAME_FAC_3%</div>
|
||||
<div id="header_faction1" class="col text-center data-name_faction1 text-white p-3">
|
||||
%NAME_FAC_1%
|
||||
</div>
|
||||
<div id="header_faction2" class="col text-center data-name_faction2 text-white p-3">
|
||||
%NAME_FAC_2%
|
||||
</div>
|
||||
<div id="header_faction3" class="col text-center data-name_faction3 text-white p-3">
|
||||
%NAME_FAC_3%
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col bg-dark text-white p-3 data-activefaction faction-logo faction1">
|
||||
<img src="static/img/logo_fac1.png" class="rounded mx-auto img-fluid d-block" alt="...">
|
||||
<div class="glow-container">
|
||||
<img src="static/img/logo_fac1.png" class="rounded mx-auto img-fluid d-block" alt="..." />
|
||||
</div>
|
||||
</div>
|
||||
<div class="col bg-dark text-white p-3 data-activefaction faction-logo faction2">
|
||||
<img src="static/img/logo_fac2.png" class="rounded mx-auto img-fluid d-block" alt="...">
|
||||
<div class="col bg-dark text-white p-3 data-activefaction faction-logo faction2 glow-active-faction">
|
||||
<div class="glow-container">
|
||||
<img src="static/img/logo_fac2.png" class="rounded mx-auto img-fluid d-block" alt="..." />
|
||||
</div>
|
||||
</div>
|
||||
<div class="col bg-dark text-white p-3 data-activefaction faction-logo faction3">
|
||||
<img src="static/img/logo_fac3.png" class="rounded mx-auto img-fluid d-block" alt="...">
|
||||
<div class="glow-container">
|
||||
<img src="static/img/logo_fac3.png" class="rounded mx-auto img-fluid d-block" alt="..." />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div id="time_faction1" class="data-time_faction1 col text-center bg-secondary text-white p-3 format-time">0</div>
|
||||
<div id="time_faction2" class="data-time_faction2 col text-center bg-secondary text-white p-3 format-time">0</div>
|
||||
<div id="time_faction3" class="data-time_faction3 col text-center bg-secondary text-white p-3 format-time">0</div>
|
||||
<div id="time_faction1" class="data-time_faction1 col text-center bg-secondary text-white p-3 format-time">
|
||||
0
|
||||
</div>
|
||||
<div id="time_faction2" class="data-time_faction2 col text-center bg-secondary text-white p-3 format-time">
|
||||
0
|
||||
</div>
|
||||
<div id="time_faction3" class="data-time_faction3 col text-center bg-secondary text-white p-3 format-time">
|
||||
0
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mt-3">
|
||||
<div class="col text-center">
|
||||
<button id="faction1" class="btn-wsevent btn btn-outline-primary">
|
||||
Aktivieren
|
||||
</button>
|
||||
</div>
|
||||
<div class="col text-center">
|
||||
<button id="faction2" class="btn-wsevent btn btn-outline-primary">
|
||||
Aktivieren
|
||||
</button>
|
||||
</div>
|
||||
<div class="col text-center">
|
||||
<button id="faction3" class="btn-wsevent btn btn-outline-primary">
|
||||
Aktivieren
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</p>
|
||||
<!-- Div GroupFaction Points -->
|
||||
<!-- Div Group DTC Table -->
|
||||
<div id="dtc_container" hidden>
|
||||
<hr />
|
||||
<p>
|
||||
<h4>Fehlercodes</h4>
|
||||
<table class="table" id="dtc_table">
|
||||
<tbody>
|
||||
@ -129,259 +161,251 @@
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</p>
|
||||
</div>
|
||||
<!-- Div Group DTC Table -->
|
||||
</div>
|
||||
<!-- Div Tab Home-->
|
||||
|
||||
<!-- Div Tab Maintenance -->
|
||||
<div id="tab_maintenance" class="tab-pane fade" role="tabpanel">
|
||||
<h3>Wartung</h3>
|
||||
<!-- Div Group Reset Timers -->
|
||||
<hr />
|
||||
<p>
|
||||
<h4>Punkte zurücksetzen</h4>
|
||||
<div class="form-group row">
|
||||
<div class="col text-center">
|
||||
<button id="reset-timer" class="btn-wsevent btn btn-outline-primary ml-2">Timer zurücksetzen</button>
|
||||
<button id="reset-timer" class="btn-wsevent btn btn-outline-primary ml-2">
|
||||
Timer zurücksetzen
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</p>
|
||||
<!-- Div Group Reset Timers -->
|
||||
<!-- Div Group LiveDebug -->
|
||||
<hr />
|
||||
<p>
|
||||
<h4>Live Debug</h4>
|
||||
<div class="form-group row">
|
||||
<textarea class="form-control" spellcheck="false" id="livedebug-out" rows="3" readonly></textarea>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<div class="col text-center">
|
||||
<button id="debugstart" class="btn-wsevent btn btn-outline-primary ml-2">Start</button>
|
||||
<button id="debugstop" class="btn-wsevent btn btn-outline-primary ml-2">Stop</button>
|
||||
</div>
|
||||
</div>
|
||||
</p>
|
||||
<!-- Div Group LiveDebug -->
|
||||
<!-- Div Group Device Reboot -->
|
||||
<hr />
|
||||
<p>
|
||||
<h4>Gerät neustarten</h4>
|
||||
<div class="form-group row">
|
||||
<div class="col text-center">
|
||||
<button id="reboot" class="btn-wsevent confirm btn btn-outline-primary">Reboot</button>
|
||||
</div>
|
||||
</div>
|
||||
</p>
|
||||
<!-- Div Group Device Reboot -->
|
||||
</div>
|
||||
<!-- Div Tab Maintenance -->
|
||||
|
||||
<!-- Div Tab Settings-->
|
||||
<div id="tab_source" class="tab-pane fade" role="tabpanel">
|
||||
<h3>Einstellungen</h3>
|
||||
<!-- Div Group Battery Type -->
|
||||
<hr />
|
||||
<p>
|
||||
<h4>Akku</h4>
|
||||
<div class="form-group row">
|
||||
<label for="batterytype" class="control-label col-4">Akku-Variante</label>
|
||||
<div class="col-8">
|
||||
<select id="batterytype" class="set-wsevent data-batterytype select form-control">
|
||||
<option value="Undefined">Undefined</option>
|
||||
<option value="LiPo 3S">LiPo 3S</option>
|
||||
<option value="LiPo 2S">LiPo 2S</option>
|
||||
</select>
|
||||
<!-- Div Group LiveDebug -->
|
||||
<hr />
|
||||
<h4>Live Debug</h4>
|
||||
<div class="form-group row">
|
||||
<input id="livedebug-in" type="text" class="set-wsevent data-livedebug-in form-control" />
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<textarea class="form-control" spellcheck="false" id="livedebug-out" rows="3" readonly></textarea>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<div class="col text-center">
|
||||
<button id="debugstart" class="btn-wsevent btn btn-outline-primary ml-2">
|
||||
Start
|
||||
</button>
|
||||
<button id="debugstop" class="btn-wsevent btn btn-outline-primary ml-2">
|
||||
Stop
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Div Group LiveDebug -->
|
||||
<!-- Div Group Device Reboot -->
|
||||
<hr />
|
||||
<h4>Gerät neustarten</h4>
|
||||
<div class="form-group row">
|
||||
<div class="col text-center">
|
||||
<button id="reboot" class="btn-wsevent confirm btn btn-outline-primary">
|
||||
Reboot
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Div Group Device Reboot -->
|
||||
</div>
|
||||
<!-- Div Tab Maintenance -->
|
||||
<!-- Div Tab Settings-->
|
||||
<div id="tab_source" class="tab-pane fade" role="tabpanel">
|
||||
<h3>Einstellungen</h3>
|
||||
<!-- Div Group Battery Type -->
|
||||
<hr />
|
||||
<h4>Akku</h4>
|
||||
<div class="form-group row">
|
||||
<label for="batterytype" class="control-label col-4">Akku-Variante</label>
|
||||
<div class="col-8">
|
||||
<select id="batterytype" class="set-wsevent data-batterytype select form-control">
|
||||
<option value="Undefined">Undefined</option>
|
||||
<option value="LiPo 3S">LiPo 3S</option>
|
||||
<option value="LiPo 2S">LiPo 2S</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Div Group Battery Type -->
|
||||
<!-- Div Group Timer Settings -->
|
||||
<hr />
|
||||
<h4>Timer Einstellungen</h4>
|
||||
<div class="form-group row">
|
||||
<label for="active_faction_on_reboot" class="control-label col-4">Aktive Fraktion wiederherstellen</label>
|
||||
<div class="col-8">
|
||||
<div class="form-check">
|
||||
<input class="set-wsevent data-active_faction_on_reboot form-check-input" type="checkbox"
|
||||
id="active_faction_on_reboot" />
|
||||
<label class="form-check-label" for="active_faction_on_reboot">
|
||||
aktivieren
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="name_faction1" class="control-label col-4">Faktion 1</label>
|
||||
<div class="col-8">
|
||||
<div class="input-group">
|
||||
<input id="name_faction1" type="text" class="set-wsevent data-name_faction1 form-control"
|
||||
required="required" />
|
||||
<div class="input-group-append">
|
||||
<span class="input-group-text">max. 32 Zeichen</span>
|
||||
</div>
|
||||
</div>
|
||||
</p>
|
||||
<!-- Div Group Battery Type -->
|
||||
<!-- Div Group Timer Settings -->
|
||||
<hr />
|
||||
<p>
|
||||
<h4>Timer Einstellungen</h4>
|
||||
<div class="form-group row">
|
||||
<label for="active_faction_on_reboot" class="control-label col-4">Aktive Fraktion wiederherstellen</label>
|
||||
<div class="col-8">
|
||||
<div class="form-check">
|
||||
<input class="set-wsevent data-active_faction_on_reboot form-check-input" type="checkbox" id="active_faction_on_reboot">
|
||||
<label class="form-check-label" for="active_faction_on_reboot">
|
||||
aktivieren
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="name_faction1" class="control-label col-4">Faktion 1</label>
|
||||
<div class="col-8">
|
||||
<div class="input-group">
|
||||
<input id="name_faction1" type="text" class="set-wsevent data-name_faction1 form-control" required="required">
|
||||
<div class="input-group-append">
|
||||
<span class="input-group-text">max. 32 Zeichen</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="name_faction2" class="control-label col-4">Faktion 2</label>
|
||||
<div class="col-8">
|
||||
<div class="input-group">
|
||||
<input id="name_faction2" type="text" class="set-wsevent data-name_faction2 form-control"
|
||||
required="required" />
|
||||
<div class="input-group-append">
|
||||
<span class="input-group-text">max. 32 Zeichen</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="name_faction2" class="control-label col-4">Faktion 2</label>
|
||||
<div class="col-8">
|
||||
<div class="input-group">
|
||||
<input id="name_faction2" type="text" class="set-wsevent data-name_faction2 form-control" required="required">
|
||||
<div class="input-group-append">
|
||||
<span class="input-group-text">max. 32 Zeichen</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="name_faction3" class="control-label col-4">Faktion 3</label>
|
||||
<div class="col-8">
|
||||
<div class="input-group">
|
||||
<input id="name_faction3" type="text" class="set-wsevent data-name_faction3 form-control"
|
||||
required="required" />
|
||||
<div class="input-group-append">
|
||||
<span class="input-group-text">max. 32 Zeichen</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="name_faction3" class="control-label col-4">Faktion 3</label>
|
||||
<div class="col-8">
|
||||
<div class="input-group">
|
||||
<input id="name_faction3" type="text" class="set-wsevent data-name_faction3 form-control" required="required">
|
||||
<div class="input-group-append">
|
||||
<span class="input-group-text">max. 32 Zeichen</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Div Group Timer Settings -->
|
||||
</div>
|
||||
</div>
|
||||
<!-- Div Group Timer Settings -->
|
||||
<!-- Div Group Save Button-->
|
||||
<hr />
|
||||
<p>
|
||||
<div class="form-group row">
|
||||
<div class="col text-center">
|
||||
<button id="settingssave" class="btn-wsevent btn btn-outline-primary">Speichern</button>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<div class="col text-center">
|
||||
<button id="settingssave" class="btn-wsevent btn btn-outline-primary">
|
||||
Speichern
|
||||
</button>
|
||||
</div>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Div Tab Settings -->
|
||||
|
||||
<!-- Div Tab Firmware Update-->
|
||||
<div id="tab_fwupdate" class="tab-pane fade" role="tabpanel">
|
||||
<h3>Firmware</h3>
|
||||
<!-- Div Group VersionInfo -->
|
||||
<hr />
|
||||
<p>
|
||||
<h4>Version-Info</h4>
|
||||
<table class="table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th class="col-7" scope="col">Parameter</td>
|
||||
<th class="col-5" scope="col">Value</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Firmware Version</td>
|
||||
<td><span class="data-fw-version"></span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Flash Version</td>
|
||||
<td><span class="data-flash-version"></span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Git Revision</td>
|
||||
<td><span class="data-git-revision"></span></td>
|
||||
</tr>
|
||||
</table>
|
||||
</p>
|
||||
<!-- Div Group VersionInfo -->
|
||||
<!-- Div Group EEPROM Backup -->
|
||||
<hr />
|
||||
<p>
|
||||
<h4>EEPROM-Backup</h4>
|
||||
<div class="form-group row">
|
||||
<div class="col text-center">
|
||||
<a class="btn btn-outline-primary" href="eejson" role="button" id="ee-backup-download">Download</a>
|
||||
</div>
|
||||
</div>
|
||||
</p>
|
||||
<!-- Div Group EEPROM Backup -->
|
||||
<!-- Div Group EEPROM Restore -->
|
||||
<hr />
|
||||
<p>
|
||||
<h4>EEPROM-Restore</h4>
|
||||
<form method='POST' action='eeRestore' enctype='multipart/form-data'>
|
||||
<div class="form-group row">
|
||||
<div class="custom-file">
|
||||
<input type="file" name="ee-restore-file" class="custom-file-input" id="ee-restore-file" accept=".ee.json"
|
||||
required />
|
||||
<label class="custom-file-label" for="ee-restore-file">EEPROM-Backup auswählen</label>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Div Tab Firmware Update-->
|
||||
<div id="tab_fwupdate" class="tab-pane fade" role="tabpanel">
|
||||
<h3>Firmware</h3>
|
||||
<!-- Div Group VersionInfo -->
|
||||
<hr />
|
||||
<h4>Version-Info</h4>
|
||||
<table class="table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th class="col-7" scope="col">Parameter</th>
|
||||
<th class="col-5" scope="col">Value</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Firmware Version</td>
|
||||
<td><span class="data-fw-version"></span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Flash Version</td>
|
||||
<td><span class="data-flash-version"></span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Git Revision</td>
|
||||
<td><span class="data-git-revision"></span></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<!-- Div Group VersionInfo -->
|
||||
<!-- Div Group EEPROM Backup -->
|
||||
<hr />
|
||||
<h4>EEPROM-Backup</h4>
|
||||
<div class="form-group row">
|
||||
<div class="col text-center">
|
||||
<button name="submit" type="submit" class="btn btn-outline-primary">Restore starten</button>
|
||||
<a class="btn btn-outline-primary" href="eejson" role="button" id="ee-backup-download">Download</a>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</p>
|
||||
<!-- Div Group EEPROM Restore -->
|
||||
<!-- Div Group Firmware Update -->
|
||||
<hr />
|
||||
<p>
|
||||
<h4>Firmware-Update</h4>
|
||||
<form method='POST' action='doUpdate' enctype='multipart/form-data'>
|
||||
<div class="form-group row">
|
||||
<div class="custom-file">
|
||||
<input type="file" name="fw-update-file" class="custom-file-input" id="fw-update-file"
|
||||
accept=".fw.bin,.fs.gz" required />
|
||||
<label class="custom-file-label" for="fw-update-file">Firmware-Update auswählen</label>
|
||||
<!-- Div Group EEPROM Backup -->
|
||||
<!-- Div Group EEPROM Restore -->
|
||||
<hr />
|
||||
<h4>EEPROM-Restore</h4>
|
||||
<form method="POST" action="eeRestore" enctype="multipart/form-data">
|
||||
<div class="form-group row">
|
||||
<div class="custom-file">
|
||||
<input type="file" name="ee-restore-file" class="custom-file-input" id="ee-restore-file" accept=".ee.json"
|
||||
required />
|
||||
<label class="custom-file-label" for="ee-restore-file">EEPROM-Backup auswählen</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<div class="col text-center">
|
||||
<button name="submit" type="submit" class="btn btn-outline-primary">Update starten</button>
|
||||
<div class="form-group row">
|
||||
<div class="col text-center">
|
||||
<button name="submit" type="submit" class="btn btn-outline-primary">
|
||||
Restore starten
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</p>
|
||||
<!-- Div Group Firmware Update -->
|
||||
</div>
|
||||
<!-- Div Tab Firmware Update-->
|
||||
</div>
|
||||
<!-- Tabs Content -->
|
||||
</main>
|
||||
|
||||
<!-- Footer -->
|
||||
|
||||
<footer class="page-footer navbar-dark bg-primary font-small fixed-bottom">
|
||||
<div class="container-fluid text-center">
|
||||
<div class="footer-copyright text-center py-3">
|
||||
<span class="text-muted">© 2023 -
|
||||
<a class="text-reset fw-bold" href="https://eventronics.de/">Marcel Peterkau</a></span>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
<!-- Footer -->
|
||||
|
||||
<!-- Modal Dialog -->
|
||||
|
||||
<div class="modal fade" id="dtcModal" tabindex="-1" role="dialog" aria-labelledby="dtcModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="dtcModalLabel">DTC-Description</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</form>
|
||||
<!-- Div Group EEPROM Restore -->
|
||||
<!-- Div Group Firmware Update -->
|
||||
<hr />
|
||||
<h4>Firmware-Update</h4>
|
||||
<form method="POST" action="doUpdate" enctype="multipart/form-data">
|
||||
<div class="form-group row">
|
||||
<div class="custom-file">
|
||||
<input type="file" name="fw-update-file" class="custom-file-input" id="fw-update-file"
|
||||
accept=".fw.bin,.fs.gz" required />
|
||||
<label class="custom-file-label" for="fw-update-file">Firmware-Update auswählen</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<div class="col text-center">
|
||||
<button name="submit" type="submit" class="btn btn-outline-primary">
|
||||
Update starten
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<!-- Div Group Firmware Update -->
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p class="dtc-desc">DTC Description</p>
|
||||
<p class="dtc-debugval">DTC DebugVal</p>
|
||||
<!-- Div Tab Firmware Update-->
|
||||
</div>
|
||||
<!-- Tabs Content -->
|
||||
</main>
|
||||
<!-- Footer -->
|
||||
<footer class="page-footer navbar-dark bg-primary font-small fixed-bottom">
|
||||
<div class="container-fluid text-center">
|
||||
<div class="footer-copyright text-center py-3">
|
||||
<span class="text-muted">© 2023 -
|
||||
<a class="text-reset fw-bold" href="https://eventronics.de/">Marcel Peterkau</a></span>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-outline-secondary" data-dismiss="modal">Close</button>
|
||||
</div>
|
||||
</footer>
|
||||
<!-- Footer -->
|
||||
<!-- Modal Dialog -->
|
||||
<div class="modal fade" id="dtcModal" tabindex="-1" role="dialog" aria-labelledby="dtcModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="dtcModalLabel">DTC-Description</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p class="dtc-desc">DTC Description</p>
|
||||
<p class="dtc-debugval">DTC DebugVal</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-outline-secondary" data-dismiss="modal">
|
||||
Close
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Modal Dialog -->
|
||||
|
||||
|
||||
|
||||
<!-- Modal Dialog -->
|
||||
</body>
|
||||
|
||||
</html>
|
File diff suppressed because it is too large
Load Diff
@ -1,27 +1,42 @@
|
||||
$(document).ready(function () {
|
||||
$(".navbar-nav a").on("click", function () {
|
||||
$(".navbar-collapse").collapse("hide");
|
||||
});
|
||||
|
||||
$("#show_hide_password a").on("click", function (event) {
|
||||
event.preventDefault();
|
||||
if ($("#show_hide_password input").attr("type") == "text") {
|
||||
$("#show_hide_password input").attr("type", "password");
|
||||
$("#show_hide_password i").addClass("fa-eye-slash");
|
||||
$("#show_hide_password i").removeClass("fa-eye");
|
||||
} else if ($("#show_hide_password input").attr("type") == "password") {
|
||||
$("#show_hide_password input").attr("type", "text");
|
||||
$("#show_hide_password i").removeClass("fa-eye-slash");
|
||||
$("#show_hide_password i").addClass("fa-eye");
|
||||
}
|
||||
});
|
||||
// Event-Listener für Navbar-Links
|
||||
$(".navbar-nav a").on("click", function () {
|
||||
$(".navbar-collapse").collapse("hide");
|
||||
});
|
||||
|
||||
document
|
||||
.querySelector(".custom-file-input")
|
||||
.addEventListener("change", function (e) {
|
||||
var fileName = document.getElementById("fw-update-file").files[0].name;
|
||||
var nextSibling = e.target.nextElementSibling;
|
||||
nextSibling.innerText = fileName;
|
||||
});
|
||||
|
||||
|
||||
// Event-Listener für Passwort zeigen/verborgen
|
||||
$("#show_hide_password a").on("click", function (event) {
|
||||
event.preventDefault();
|
||||
var inputField = $("#show_hide_password input");
|
||||
var icon = $("#show_hide_password i");
|
||||
if (inputField.attr("type") == "text") {
|
||||
inputField.attr("type", "password");
|
||||
icon.addClass("fa-eye-slash");
|
||||
icon.removeClass("fa-eye");
|
||||
} else if (inputField.attr("type") == "password") {
|
||||
inputField.attr("type", "text");
|
||||
icon.removeClass("fa-eye-slash");
|
||||
icon.addClass("fa-eye");
|
||||
}
|
||||
});
|
||||
|
||||
// Event-Listener für Datei-Upload
|
||||
$(".custom-file-input").on("change", function (e) {
|
||||
var fileName = document.getElementById("fw-update-file").files[0].name;
|
||||
var nextSibling = e.target.nextElementSibling;
|
||||
nextSibling.innerText = fileName;
|
||||
});
|
||||
|
||||
// Event-Listener für Live-Debug-Eingabe
|
||||
$('#livedebug-in').on('keydown', function(event) {
|
||||
if (event.key === 'Enter' || event.keyCode === 13) {
|
||||
event.preventDefault(); // Verhindert, dass die Enter-Taste die Standardaktion ausführt (z.B. Absenden eines Formulars)
|
||||
|
||||
const command = $('#livedebug-in').val(); // Den Befehl aus dem Eingabefeld holen
|
||||
websocket_sendDebugCommand(command); // Den Befehl an die Funktion übergeben
|
||||
|
||||
$('#livedebug-in').val(''); // Leert das Eingabefeld
|
||||
$('#livedebug-in').focus(); // Setzt den Fokus zurück auf das Eingabefeld
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@ -139,6 +139,10 @@ function websocket_sendevent(element_id, element_value) {
|
||||
websocket.send(element_id + ":" + element_value);
|
||||
}
|
||||
|
||||
function websocket_sendDebugCommand(command) {
|
||||
websocket.send("debug-in:" + command);
|
||||
}
|
||||
|
||||
function do_resize(textbox) {
|
||||
var maxrows = 15;
|
||||
var minrows = 3;
|
||||
@ -216,18 +220,12 @@ function formatTime(seconds) {
|
||||
|
||||
function updateFactionLogo(element, faction) {
|
||||
const glowClass = "glow-active-faction";
|
||||
const factionClasses = ["faction1", "faction2", "faction3"];
|
||||
|
||||
factionClasses.forEach((factionClass) => {
|
||||
if (
|
||||
factionClass === "faction" + faction &&
|
||||
element.classList.contains(factionClass)
|
||||
) {
|
||||
element.classList.add(glowClass);
|
||||
} else {
|
||||
element.classList.remove(glowClass);
|
||||
}
|
||||
});
|
||||
var factionClass = "faction" + faction;
|
||||
if (element.classList.contains(factionClass)) {
|
||||
element.classList.add(glowClass);
|
||||
} else {
|
||||
element.classList.remove(glowClass);
|
||||
}
|
||||
}
|
||||
|
||||
// Funktion zum Setzen des ausgewählten Werts für Dropdowns
|
||||
|
@ -57,5 +57,5 @@ void pushCANDebug(uint32_t id, uint8_t dlc, uint8_t *data);
|
||||
void Debug_pushMessage(const char *format, ...);
|
||||
void SetDebugportStatus(DebugPorts_t port, DebugStatus_t status);
|
||||
void Debug_Process();
|
||||
|
||||
void Debug_ProcessCommand(uint8_t *command);
|
||||
#endif
|
@ -66,8 +66,6 @@ typedef struct
|
||||
char Faction_1_Name[33];
|
||||
char Faction_2_Name[33];
|
||||
char Faction_3_Name[33];
|
||||
char wifi_ap_ssid[33];
|
||||
char wifi_ap_password[64];
|
||||
char wifi_client_ssid[33];
|
||||
char wifi_client_password[64];
|
||||
bool wifi_autoconnect;
|
||||
@ -82,8 +80,6 @@ const configData_t ConfigData_defaults = {
|
||||
"FACTION 1", // Faction_1_Name
|
||||
"FACTION 2", // Faction_2_Name
|
||||
"FACTION 3", // Faction_3_Name
|
||||
HOST_NAME,
|
||||
QUOTE(WIFI_AP_PASSWORD),
|
||||
QUOTE(WIFI_SSID_CLIENT),
|
||||
QUOTE(WIFI_PASSWORD_CLIENT),
|
||||
true,
|
||||
|
@ -1,31 +1,75 @@
|
||||
#ifndef _SANITYCHECK_H_
|
||||
#define _SANITYCHECK_H_
|
||||
|
||||
// Utility macros for handling quotes
|
||||
#define Q(x) #x
|
||||
#define QUOTE(x) Q(x)
|
||||
|
||||
// Utility macros for checking string lengths
|
||||
#define STRING_LENGTH_CHECK(str, max_length) (sizeof(str) <= (max_length) + 1)
|
||||
#define IS_ALPHANUMERIC(c) ((((c) >= '0') && ((c) <= '9')) || (((c) >= 'A') && ((c) <= 'Z')) || (((c) >= 'a') && ((c) <= 'z')))
|
||||
#define IS_PRINTABLE_ASCII(c) ((c) >= 32 && (c) <= 126)
|
||||
#define IS_VALID_WIFI_CHAR(c) (IS_PRINTABLE_ASCII(c))
|
||||
#define IS_ALPHANUMERIC_HELPER(str, i) (i >= sizeof(str) - 1 || IS_ALPHANUMERIC(str[i]))
|
||||
#define IS_PRINTABLE_ASCII_HELPER(str, i) (i >= sizeof(str) - 1 || IS_PRINTABLE_ASCII(str[i]))
|
||||
#define IS_VALID_WIFI_CHAR_HELPER(str, i) (i >= sizeof(str) - 1 || IS_VALID_WIFI_CHAR(str[i]))
|
||||
#define IS_ALPHANUMERIC_IMPL(str, i) (IS_ALPHANUMERIC_HELPER(str, i) && IS_ALPHANUMERIC_HELPER(str, i+1) && IS_ALPHANUMERIC_HELPER(str, i+2) && IS_ALPHANUMERIC_HELPER(str, i+3) && IS_ALPHANUMERIC_HELPER(str, i+4) && IS_ALPHANUMERIC_HELPER(str, i+5) && IS_ALPHANUMERIC_HELPER(str, i+6) && IS_ALPHANUMERIC_HELPER(str, i+7) && IS_ALPHANUMERIC_HELPER(str, i+8) && IS_ALPHANUMERIC_HELPER(str, i+9) && IS_ALPHANUMERIC_HELPER(str, i+10) && IS_ALPHANUMERIC_HELPER(str, i+11) && IS_ALPHANUMERIC_HELPER(str, i+12) && IS_ALPHANUMERIC_HELPER(str, i+13) && IS_ALPHANUMERIC_HELPER(str, i+14) && IS_ALPHANUMERIC_HELPER(str, i+15) && IS_ALPHANUMERIC_HELPER(str, i+16))
|
||||
#define IS_PRINTABLE_ASCII_IMPL(str, i) (IS_PRINTABLE_ASCII_HELPER(str, i) && IS_PRINTABLE_ASCII_HELPER(str, i+1) && IS_PRINTABLE_ASCII_HELPER(str, i+2) && IS_PRINTABLE_ASCII_HELPER(str, i+3) && IS_PRINTABLE_ASCII_HELPER(str, i+4) && IS_PRINTABLE_ASCII_HELPER(str, i+5) && IS_PRINTABLE_ASCII_HELPER(str, i+6) && IS_PRINTABLE_ASCII_HELPER(str, i+7) && IS_PRINTABLE_ASCII_HELPER(str, i+8) && IS_PRINTABLE_ASCII_HELPER(str, i+9) && IS_PRINTABLE_ASCII_HELPER(str, i+10) && IS_PRINTABLE_ASCII_HELPER(str, i+11) && IS_PRINTABLE_ASCII_HELPER(str, i+12) && IS_PRINTABLE_ASCII_HELPER(str, i+13) && IS_PRINTABLE_ASCII_HELPER(str, i+14) && IS_PRINTABLE_ASCII_HELPER(str, i+15) && IS_PRINTABLE_ASCII_HELPER(str, i+16) && IS_PRINTABLE_ASCII_HELPER(str, i+17) && IS_PRINTABLE_ASCII_HELPER(str, i+18) && IS_PRINTABLE_ASCII_HELPER(str, i+19) && IS_PRINTABLE_ASCII_HELPER(str, i+20) && IS_PRINTABLE_ASCII_HELPER(str, i+21) && IS_PRINTABLE_ASCII_HELPER(str, i+22) && IS_PRINTABLE_ASCII_HELPER(str, i+23) && IS_PRINTABLE_ASCII_HELPER(str, i+24))
|
||||
#define IS_ALPHANUMERIC_STRING(str) (IS_ALPHANUMERIC_IMPL(str, 0))
|
||||
#define IS_PRINTABLE_ASCII_STRING(str) (IS_PRINTABLE_ASCII_IMPL(str, 0))
|
||||
#define IS_VALID_WIFI_STRING(str) (IS_VALID_WIFI_CHAR_HELPER(str, 0) && IS_VALID_WIFI_CHAR_HELPER(str, 1) && IS_VALID_WIFI_CHAR_HELPER(str, 2) && IS_VALID_WIFI_CHAR_HELPER(str, 3) && IS_VALID_WIFI_CHAR_HELPER(str, 4) && IS_VALID_WIFI_CHAR_HELPER(str, 5) && IS_VALID_WIFI_CHAR_HELPER(str, 6) && IS_VALID_WIFI_CHAR_HELPER(str, 7) && IS_VALID_WIFI_CHAR_HELPER(str, 8) && IS_VALID_WIFI_CHAR_HELPER(str, 9) && IS_VALID_WIFI_CHAR_HELPER(str, 10) && IS_VALID_WIFI_CHAR_HELPER(str, 11) && IS_VALID_WIFI_CHAR_HELPER(str, 12) && IS_VALID_WIFI_CHAR_HELPER(str, 13) && IS_VALID_WIFI_CHAR_HELPER(str, 14) && IS_VALID_WIFI_CHAR_HELPER(str, 15) && IS_VALID_WIFI_CHAR_HELPER(str, 16) && IS_VALID_WIFI_CHAR_HELPER(str, 17) && IS_VALID_WIFI_CHAR_HELPER(str, 18) && IS_VALID_WIFI_CHAR_HELPER(str, 19) && IS_VALID_WIFI_CHAR_HELPER(str, 20) && IS_VALID_WIFI_CHAR_HELPER(str, 21) && IS_VALID_WIFI_CHAR_HELPER(str, 22) && IS_VALID_WIFI_CHAR_HELPER(str, 23) && IS_VALID_WIFI_CHAR_HELPER(str, 24) && IS_VALID_WIFI_CHAR_HELPER(str, 25) && IS_VALID_WIFI_CHAR_HELPER(str, 26) && IS_VALID_WIFI_CHAR_HELPER(str, 27) && IS_VALID_WIFI_CHAR_HELPER(str, 28) && IS_VALID_WIFI_CHAR_HELPER(str, 29) && IS_VALID_WIFI_CHAR_HELPER(str, 30) && IS_VALID_WIFI_CHAR_HELPER(str, 31) && IS_VALID_WIFI_CHAR_HELPER(str, 32))
|
||||
|
||||
// ADMIN_PASSWORD check
|
||||
#ifndef ADMIN_PASSWORD
|
||||
#error "You need to define ADMIN_PASSWORD for OTA-Update"
|
||||
#else
|
||||
_Static_assert(STRING_LENGTH_CHECK(QUOTE(ADMIN_PASSWORD), 16), "ADMIN_PASSWORD must be at most 16 characters long");
|
||||
#endif
|
||||
|
||||
// WIFI_AP_SSID check
|
||||
#ifndef WIFI_AP_SSID
|
||||
#warning "No WIFI_AP_SSID defined. Using DeviceName"
|
||||
#define WIFI_AP_SSID DEVICE_NAME
|
||||
#else
|
||||
_Static_assert(STRING_LENGTH_CHECK(QUOTE(WIFI_AP_SSID), 32), "WIFI_AP_SSID must be at most 32 characters long");
|
||||
_Static_assert(IS_VALID_WIFI_STRING(QUOTE(WIFI_AP_SSID)), "WIFI_AP_SSID must contain only valid WiFi characters");
|
||||
#endif
|
||||
|
||||
#ifndef WIFI_AP_PASSWORD
|
||||
#error "You must define an WIFI_AP_PASSWORD for Standalone AP-Mode"
|
||||
// WIFI_PASS_SEED check
|
||||
#ifndef WIFI_PASS_SEED
|
||||
#error "You must define an WIFI_PASS_SEED for Standalone AP-Mode"
|
||||
#else
|
||||
_Static_assert(STRING_LENGTH_CHECK(QUOTE(WIFI_PASS_SEED), 16), "WIFI_PASS_SEED must be at most 16 characters long");
|
||||
_Static_assert(IS_ALPHANUMERIC_STRING(QUOTE(WIFI_PASS_SEED)), "WIFI_PASS_SEED must contain only alphanumeric characters (a-z, A-Z, 0-9)");
|
||||
#endif
|
||||
|
||||
// DEVICE_NAME check
|
||||
#ifndef DEVICE_NAME
|
||||
#error "You must define DEVICE_NAME"
|
||||
#else
|
||||
_Static_assert(STRING_LENGTH_CHECK(QUOTE(DEVICE_NAME), 24), "DEVICE_NAME must be at most 24 characters long");
|
||||
_Static_assert(IS_VALID_WIFI_STRING(QUOTE(DEVICE_NAME)), "DEVICE_NAME must contain only valid WiFi characters");
|
||||
#endif
|
||||
|
||||
// Mutual exclusion check for LoRa features
|
||||
#if defined(FEATURE_ENABLE_UARTLORA) && defined(FEATURE_ENABLE_LORA)
|
||||
#error "You cannot enable LoRa and UART-Protocol at the same time!"
|
||||
#endif
|
||||
|
||||
// WIFI_CLIENT checks
|
||||
#ifdef FEATURE_ENABLE_WIFI_CLIENT
|
||||
#ifndef WIFI_PASSWORD_CLIENT
|
||||
#error "You must define an WIFI_PASSWORD for OTA-Update"
|
||||
#error "You must define an WIFI_PASSWORD_CLIENT for OTA-Update"
|
||||
#else
|
||||
_Static_assert(STRING_LENGTH_CHECK(QUOTE(WIFI_PASSWORD_CLIENT), 63), "WIFI_PASSWORD_CLIENT must be at most 63 characters long");
|
||||
#endif
|
||||
|
||||
#ifndef WIFI_SSID_CLIENT
|
||||
#error "You must define an WIFI_SSID for OTA-Update"
|
||||
#error "You must define an WIFI_SSID_CLIENT for OTA-Update"
|
||||
#else
|
||||
_Static_assert(STRING_LENGTH_CHECK(QUOTE(WIFI_SSID_CLIENT), 32), "WIFI_SSID_CLIENT must be at most 32 characters long");
|
||||
_Static_assert(IS_VALID_WIFI_STRING(QUOTE(WIFI_SSID_CLIENT)), "WIFI_SSID_CLIENT must contain only valid WiFi characters");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#endif //_SANITYCHECK_H_
|
||||
#endif // _SANITYCHECK_H_
|
||||
|
@ -3,10 +3,10 @@
|
||||
*
|
||||
* @brief Header file for converting structs to JSON objects.
|
||||
*
|
||||
* @note This file is auto-generated by a script on 2024-05-30 22:54:25.
|
||||
* @note This file is auto-generated by a script on 2024-06-06 18:52:33.
|
||||
*
|
||||
* @author Marcel Peterkau
|
||||
* @date 30.05.2024
|
||||
* @date 06.06.2024
|
||||
*/
|
||||
|
||||
#ifndef _STRUCT2JSON_H_
|
||||
@ -23,4 +23,4 @@ void generateJsonObject_PersistenceData(JsonObject data);
|
||||
|
||||
#endif /* _STRUCT2JSON_H_ */
|
||||
|
||||
// CODEGENERATOR_CHECKSUM: 735cd4daf9a46bd773bdf5e6cd5a58d61b0d877196399bc2784a0d0ea7af717d
|
||||
// CODEGENERATOR_CHECKSUM: 3a3fd3024dd9dd769ff5d62f61b3ba1b781b7d06e7568a1ddac56d193dba9ee5
|
@ -33,4 +33,16 @@ bool validateWiFiString(char *string, size_t size);
|
||||
*/
|
||||
void sanitizeWiFiString(const char *input, char *buffer, size_t bufferSize);
|
||||
|
||||
/**
|
||||
* @brief Generates a device-specific password based on a seed and the ESP8266 Chip ID.
|
||||
*
|
||||
* This function combines a given seed with the unique Chip ID of the ESP8266 device to create a device-specific password.
|
||||
* The resulting password is stored in the provided character buffer.
|
||||
*
|
||||
* @param seed The seed string used for password generation. Should be up to 16 characters long.
|
||||
* @param passwordBuffer The character buffer where the generated password will be stored.
|
||||
* @param bufferLength The length of the password buffer. Should be large enough to hold the generated password and null terminator.
|
||||
*/
|
||||
void GenerateDeviceSpecificPassword(const char* seed, char* passwordBuffer, size_t bufferLength);
|
||||
|
||||
#endif // UTILITIES_H
|
||||
|
@ -17,12 +17,12 @@ platform = espressif8266
|
||||
framework = arduino
|
||||
board = d1_mini
|
||||
|
||||
custom_firmware_version = 1.07
|
||||
custom_flash_version = 1.07
|
||||
custom_firmware_version = 1.08
|
||||
custom_flash_version = 1.08
|
||||
|
||||
upload_protocol = esptool
|
||||
upload_speed = 921600
|
||||
;upload_port = 10.0.1.48
|
||||
;upload_port = 10.0.0.1
|
||||
;upload_flags =
|
||||
; --port=8266
|
||||
; --auth=${wifi_cred.admin_password}
|
||||
@ -36,8 +36,7 @@ build_flags=
|
||||
-DADMIN_PASSWORD=${wifi_cred.admin_password}
|
||||
-DWIFI_SSID_CLIENT=${wifi_cred.wifi_ssid_client}
|
||||
-DWIFI_PASSWORD_CLIENT=${wifi_cred.wifi_password_client}
|
||||
-DADMIN_PASSWORD=${wifi_cred.admin_password}
|
||||
-DWIFI_AP_PASSWORD=${wifi_cred.wifi_ap_password}
|
||||
-DWIFI_PASS_SEED=${wifi_cred.wifi_pass_seed}
|
||||
-DDEVICE_NAME='"Dark Emergency Timer"'
|
||||
|
||||
;build_type = debug
|
||||
|
@ -12,6 +12,8 @@
|
||||
*/
|
||||
|
||||
#include "debugger.h"
|
||||
#include "utilities.h"
|
||||
#include <pgmspace.h>
|
||||
|
||||
DebugStatus_t DebuggerStatus[dbg_cntElements];
|
||||
|
||||
@ -117,16 +119,13 @@ const char helpText[][64] PROGMEM = {
|
||||
"notify_error - Send error notification",
|
||||
"notify_warning - Send warning notification",
|
||||
"notify_success - Send success notification",
|
||||
"notify_info - Send info notification"
|
||||
};
|
||||
"notify_info - Send info notification"};
|
||||
|
||||
const size_t NUM_HELP_LINES = sizeof(helpText) / sizeof(helpText[0]);
|
||||
|
||||
// Überprüfen, ob die Anzahl der Commands und Hilfetext-Zeilen übereinstimmen
|
||||
static_assert(NUM_COMMANDS == NUM_HELP_LINES, "Number of commands and help text lines do not match!");
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief Initializes the debugger by setting the initial status for different debug ports.
|
||||
* Serial debug output is turned off.
|
||||
@ -326,7 +325,7 @@ void Debug_formatPersistence()
|
||||
*/
|
||||
void Debug_printSystemInfo()
|
||||
{
|
||||
Debug_pushMessage("Hostname: %s\n", globals.DeviceName);
|
||||
Debug_pushMessage("Hostname: %s\n", globals.DeviceNameId);
|
||||
|
||||
FlashMode_t ideMode = ESP.getFlashChipMode();
|
||||
Debug_pushMessage("Sdk version: %s\n", ESP.getSdkVersion());
|
||||
@ -369,8 +368,6 @@ void Debug_dumpConfig()
|
||||
Debug_pushMessage("Faction_1_Name: %s\n", ConfigData.Faction_3_Name);
|
||||
Debug_pushMessage("active_faction_on_reboot: %d\n", ConfigData.active_faction_on_reboot);
|
||||
Debug_pushMessage("wifi_autoconnect: %d\n", ConfigData.wifi_autoconnect);
|
||||
Debug_pushMessage("wifi_ap_password: %s\n", ConfigData.wifi_ap_password);
|
||||
Debug_pushMessage("wifi_ap_ssid: %s\n", ConfigData.wifi_ap_ssid);
|
||||
Debug_pushMessage("wifi_client_ssid: %s\n", ConfigData.wifi_client_ssid);
|
||||
Debug_pushMessage("wifi_client_password: %s\n", ConfigData.wifi_client_password);
|
||||
Debug_pushMessage("EEPROM_Version: %d\n", ConfigData.EEPROM_Version);
|
||||
@ -411,7 +408,10 @@ void Debug_dumpPersistance()
|
||||
*/
|
||||
void Debug_printWifiInfo()
|
||||
{
|
||||
char buffer[33];
|
||||
GenerateDeviceSpecificPassword(QUOTE(WIFI_PASS_SEED), buffer, sizeof(buffer));
|
||||
Debug_pushMessage("IP Adress: %s\n", WiFi.localIP().toString().c_str());
|
||||
Debug_pushMessage("WiFi AP Pw: %s\n", buffer);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -508,10 +508,9 @@ void Debug_printHelp()
|
||||
char buffer[64];
|
||||
for (size_t i = 0; i < NUM_HELP_LINES; ++i)
|
||||
{
|
||||
strcpy_P(buffer, (PGM_P)pgm_read_word(&(helpText[i])));
|
||||
|
||||
// Display the help command
|
||||
Debug_pushMessage(buffer);
|
||||
strncpy_P(buffer, helpText[i], sizeof(buffer));
|
||||
buffer[sizeof(buffer) - 1] = '\0'; // Sicherstellen, dass der String nullterminiert ist
|
||||
Serial.println(buffer);
|
||||
}
|
||||
}
|
||||
|
||||
@ -526,6 +525,20 @@ void Debug_Reboot()
|
||||
globals.systemStatus = sysStat_Shutdown;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Processes a debug command.
|
||||
*
|
||||
* This function takes a pointer to a debug command and processes it by
|
||||
* passing it to the `processCmdDebug` function. The command is expected
|
||||
* to be a string, so it is cast to `const char *` before being processed.
|
||||
*
|
||||
* @param command Pointer to the debug command, expected to be a null-terminated string.
|
||||
*/
|
||||
void Debug_ProcessCommand(uint8_t *command)
|
||||
{
|
||||
processCmdDebug((const char *)command);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Convert a uint32_t value to a binary string with nibbles separated by a space.
|
||||
*
|
||||
|
@ -400,30 +400,16 @@ uint32_t ConfigSanityCheck(bool autocorrect)
|
||||
{
|
||||
uint32_t setting_reset_bits = 0;
|
||||
|
||||
if (!validateWiFiString(ConfigData.wifi_ap_ssid, sizeof(ConfigData.wifi_ap_ssid)))
|
||||
{
|
||||
SET_BIT(setting_reset_bits, 1);
|
||||
if (autocorrect)
|
||||
strncpy(ConfigData.wifi_ap_ssid, ConfigData_defaults.wifi_ap_ssid, sizeof(ConfigData.wifi_ap_ssid));
|
||||
}
|
||||
|
||||
if (!validateWiFiString(ConfigData.wifi_ap_password, sizeof(ConfigData.wifi_ap_password)))
|
||||
{
|
||||
SET_BIT(setting_reset_bits, 2);
|
||||
if (autocorrect)
|
||||
strncpy(ConfigData.wifi_ap_password, ConfigData_defaults.wifi_ap_password, sizeof(ConfigData.wifi_ap_password));
|
||||
}
|
||||
|
||||
if (!validateWiFiString(ConfigData.wifi_client_ssid, sizeof(ConfigData.wifi_client_ssid)))
|
||||
{
|
||||
SET_BIT(setting_reset_bits, 3);
|
||||
SET_BIT(setting_reset_bits, 0);
|
||||
if (autocorrect)
|
||||
strncpy(ConfigData.wifi_client_ssid, ConfigData_defaults.wifi_client_ssid, sizeof(ConfigData.wifi_client_ssid));
|
||||
}
|
||||
|
||||
if (!validateWiFiString(ConfigData.wifi_client_password, sizeof(ConfigData.wifi_client_password)))
|
||||
{
|
||||
SET_BIT(setting_reset_bits, 4);
|
||||
SET_BIT(setting_reset_bits, 1);
|
||||
if (autocorrect)
|
||||
strncpy(ConfigData.wifi_client_password, ConfigData_defaults.wifi_client_password, sizeof(ConfigData.wifi_client_password));
|
||||
}
|
||||
|
@ -573,6 +573,7 @@ void wifiMaintainConnectionTicker_callback()
|
||||
void toggleWiFiAP(bool shutdown)
|
||||
{
|
||||
char buffer[33];
|
||||
char buffer_pass[33];
|
||||
// Check if WiFi is currently active
|
||||
if (WiFi.getMode() != WIFI_OFF)
|
||||
{
|
||||
@ -591,7 +592,8 @@ void toggleWiFiAP(bool shutdown)
|
||||
WiFi.mode(WIFI_AP);
|
||||
WiFi.softAPConfig(IPAddress(WIFI_AP_IP_GW), IPAddress(WIFI_AP_IP_GW), IPAddress(255, 255, 255, 0));
|
||||
sanitizeWiFiString(globals.DeviceNameId, buffer, sizeof(buffer));
|
||||
WiFi.softAP(buffer, QUOTE(WIFI_AP_PASSWORD));
|
||||
GenerateDeviceSpecificPassword(QUOTE(WIFI_PASS_SEED), buffer_pass, sizeof(buffer_pass));
|
||||
WiFi.softAP(buffer, buffer_pass);
|
||||
|
||||
// Stop WiFi maintenance connection ticker if enabled and display debug messages
|
||||
#ifdef FEATURE_ENABLE_WIFI_CLIENT
|
||||
|
@ -3,10 +3,10 @@
|
||||
*
|
||||
* @brief Implementation file for converting structs to JSON objects.
|
||||
*
|
||||
* @note This file is auto-generated by a script on 2024-05-30 22:54:25.
|
||||
* @note This file is auto-generated by a script on 2024-06-06 18:52:33.
|
||||
*
|
||||
* @author Marcel Peterkau
|
||||
* @date 30.05.2024
|
||||
* @date 06.06.2024
|
||||
*/
|
||||
|
||||
|
||||
@ -20,8 +20,6 @@ void generateJsonObject_ConfigData(JsonObject data)
|
||||
data["Faction_1_Name"] = ConfigData.Faction_1_Name;
|
||||
data["Faction_2_Name"] = ConfigData.Faction_2_Name;
|
||||
data["Faction_3_Name"] = ConfigData.Faction_3_Name;
|
||||
data["wifi_ap_ssid"] = ConfigData.wifi_ap_ssid;
|
||||
data["wifi_ap_password"] = ConfigData.wifi_ap_password;
|
||||
data["wifi_client_ssid"] = ConfigData.wifi_client_ssid;
|
||||
data["wifi_client_password"] = ConfigData.wifi_client_password;
|
||||
data["wifi_autoconnect"] = ConfigData.wifi_autoconnect;
|
||||
@ -40,4 +38,4 @@ void generateJsonObject_PersistenceData(JsonObject data)
|
||||
|
||||
|
||||
|
||||
// CODEGENERATOR_CHECKSUM: 735cd4daf9a46bd773bdf5e6cd5a58d61b0d877196399bc2784a0d0ea7af717d
|
||||
// CODEGENERATOR_CHECKSUM: 3a3fd3024dd9dd769ff5d62f61b3ba1b781b7d06e7568a1ddac56d193dba9ee5
|
@ -33,7 +33,7 @@ bool validateWiFiString(char *string, size_t size)
|
||||
c == '.' || c == '/' || c == ':' || c == ';' || c == '<' ||
|
||||
c == '=' || c == '>' || c == '?' || c == '@' || c == '[' ||
|
||||
c == '\\' || c == ']' || c == '^' || c == '_' || c == '`' ||
|
||||
c == '{' || c == '|' || c == '}' || c == '~'))
|
||||
c == '{' || c == '|' || c == '}' || c == '~' || c == ' '))
|
||||
{
|
||||
// Found a character that is not a valid WiFi character.
|
||||
return false;
|
||||
@ -78,7 +78,7 @@ void sanitizeWiFiString(const char *input, char *buffer, size_t bufferSize)
|
||||
c == '.' || c == '/' || c == ':' || c == ';' || c == '<' ||
|
||||
c == '=' || c == '>' || c == '?' || c == '@' || c == '[' ||
|
||||
c == '\\' || c == ']' || c == '^' || c == '_' || c == '`' ||
|
||||
c == '{' || c == '|' || c == '}' || c == '~'))
|
||||
c == '{' || c == '|' || c == '}' || c == '~' || c == ' '))
|
||||
{
|
||||
// Replace invalid character with placeholder
|
||||
buffer[i] = '_';
|
||||
@ -92,3 +92,35 @@ void sanitizeWiFiString(const char *input, char *buffer, size_t bufferSize)
|
||||
// Null-terminate the buffer
|
||||
buffer[i] = '\0';
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Generates a device-specific password based on a seed and the ESP8266 Chip ID.
|
||||
*
|
||||
* This function combines a given seed with the unique Chip ID of the ESP8266 device to create a device-specific password.
|
||||
* The resulting password is stored in the provided character buffer.
|
||||
*
|
||||
* @param seed The seed string used for password generation. Should be up to 16 characters long.
|
||||
* @param passwordBuffer The character buffer where the generated password will be stored.
|
||||
* @param bufferLength The length of the password buffer. Should be large enough to hold the generated password and null terminator.
|
||||
*/
|
||||
void GenerateDeviceSpecificPassword(const char* seed, char* passwordBuffer, size_t bufferLength) {
|
||||
uint32_t chipId = ESP.getChipId();
|
||||
char chipIdStr[9]; // 8 characters + null terminator
|
||||
snprintf(chipIdStr, sizeof(chipIdStr), "%08X", chipId);
|
||||
|
||||
char combined[33]; // seed (16) + chipId (8) + null terminator (1)
|
||||
strncpy(combined, seed, 16);
|
||||
strncat(combined, chipIdStr, 8);
|
||||
|
||||
// Simple hash function for demonstration
|
||||
unsigned long hash = 5381;
|
||||
int c;
|
||||
char *str = combined;
|
||||
|
||||
while ((c = *str++)) {
|
||||
hash = ((hash << 5) + hash) + c; // hash * 33 + c
|
||||
}
|
||||
|
||||
snprintf(passwordBuffer, bufferLength, "%08X%08X", hash, hash);
|
||||
passwordBuffer[bufferLength - 1] = '\0'; // Ensure null termination
|
||||
}
|
@ -295,8 +295,6 @@ void WebserverEERestore_Callback(AsyncWebServerRequest *request, const String &f
|
||||
strncpy(ConfigData.Faction_1_Name, json["config"]["Faction_1_Name"].as<const char *>(), sizeof(ConfigData.Faction_1_Name));
|
||||
strncpy(ConfigData.Faction_2_Name, json["config"]["Faction_2_Name"].as<const char *>(), sizeof(ConfigData.Faction_2_Name));
|
||||
strncpy(ConfigData.Faction_3_Name, json["config"]["Faction_3_Name"].as<const char *>(), sizeof(ConfigData.Faction_3_Name));
|
||||
strncpy(ConfigData.wifi_ap_ssid, json["config"]["wifi_ap_ssid"].as<const char *>(), sizeof(ConfigData.wifi_ap_ssid));
|
||||
strncpy(ConfigData.wifi_ap_password, json["config"]["wifi_ap_password"].as<const char *>(), sizeof(ConfigData.wifi_ap_password));
|
||||
strncpy(ConfigData.wifi_client_ssid, json["config"]["wifi_client_ssid"].as<const char *>(), sizeof(ConfigData.wifi_client_ssid));
|
||||
strncpy(ConfigData.wifi_client_password, json["config"]["wifi_client_password"].as<const char *>(), sizeof(ConfigData.wifi_client_password));
|
||||
|
||||
@ -426,6 +424,10 @@ void Websocket_HandleMessage(void *arg, uint8_t *data, size_t len)
|
||||
{
|
||||
Websocket_HandleSettings(data + strlen("set-"));
|
||||
}
|
||||
else if (strncmp((char *)data, "debug", strlen("debug")) == 0)
|
||||
{
|
||||
Debug_ProcessCommand(data - strlen("debug"));
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug_pushMessage("Got unknown Websocket-Message '%s' from client\n", (char *)data);
|
||||
@ -472,6 +474,18 @@ void Websocket_HandleButtons(uint8_t *data)
|
||||
{
|
||||
globals.systemStatus = sysStat_Shutdown;
|
||||
}
|
||||
else if (strcmp(identifier, "faction1") == 0)
|
||||
{
|
||||
PersistenceData.activeFaction = FACTION_1;
|
||||
}
|
||||
else if (strcmp(identifier, "faction2") == 0)
|
||||
{
|
||||
PersistenceData.activeFaction = FACTION_2;
|
||||
}
|
||||
else if (strcmp(identifier, "faction3") == 0)
|
||||
{
|
||||
PersistenceData.activeFaction = FACTION_3;
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug_pushMessage("Got unknown Button-id '%s' from ws-client\n", identifier);
|
||||
@ -594,44 +608,43 @@ void Websocket_RefreshClientData_DTCs(uint32_t client_id)
|
||||
*/
|
||||
void Websocket_RefreshClientData_Status(uint32_t client_id, bool send_mapping)
|
||||
{
|
||||
if (send_mapping)
|
||||
{
|
||||
const char mapping[] = "MAPPING_STATUS:"
|
||||
"batterylevel;"
|
||||
"systemstatus;"
|
||||
"activefaction;"
|
||||
"time_faction1;"
|
||||
"time_faction2;"
|
||||
"time_faction3;";
|
||||
|
||||
if (client_id > 0)
|
||||
webSocket.text(client_id, mapping);
|
||||
else
|
||||
webSocket.textAll(mapping);
|
||||
|
||||
Debug_pushMessage("send MAPPING_STATUS WS-Client Data\n");
|
||||
}
|
||||
|
||||
char dataString[200] = {0}; // Maximal 200 Zeichen für den Data-String
|
||||
|
||||
sprintf(dataString, "STATUS:%d;%s;%d;%ld;%ld;%ld;",
|
||||
globals.battery_level,
|
||||
globals.systemStatustxt,
|
||||
PersistenceData.activeFaction,
|
||||
PersistenceData.faction_1_timer,
|
||||
PersistenceData.faction_2_timer,
|
||||
PersistenceData.faction_3_timer);
|
||||
if (send_mapping)
|
||||
{
|
||||
const char mapping[] = "MAPPING_STATUS:"
|
||||
"batterylevel;"
|
||||
"systemstatus;"
|
||||
"activefaction;"
|
||||
"time_faction1;"
|
||||
"time_faction2;"
|
||||
"time_faction3;";
|
||||
|
||||
if (client_id > 0)
|
||||
{
|
||||
webSocket.text(client_id, dataString);
|
||||
}
|
||||
webSocket.text(client_id, mapping);
|
||||
else
|
||||
{
|
||||
webSocket.textAll(dataString);
|
||||
}
|
||||
}
|
||||
webSocket.textAll(mapping);
|
||||
|
||||
Debug_pushMessage("send MAPPING_STATUS WS-Client Data\n");
|
||||
}
|
||||
|
||||
char dataString[200] = {0}; // Maximal 200 Zeichen für den Data-String
|
||||
|
||||
sprintf(dataString, "STATUS:%d;%s;%d;%ld;%ld;%ld;",
|
||||
globals.battery_level,
|
||||
globals.systemStatustxt,
|
||||
PersistenceData.activeFaction,
|
||||
PersistenceData.faction_1_timer,
|
||||
PersistenceData.faction_2_timer,
|
||||
PersistenceData.faction_3_timer);
|
||||
|
||||
if (client_id > 0)
|
||||
{
|
||||
webSocket.text(client_id, dataString);
|
||||
}
|
||||
else
|
||||
{
|
||||
webSocket.textAll(dataString);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Refreshes client data related to static configuration parameters on WebSocket clients.
|
||||
@ -660,7 +673,7 @@ void Websocket_RefreshClientData_Static(uint32_t client_id, bool send_mapping)
|
||||
"wifi-pass;"
|
||||
"fw-version;"
|
||||
"flash-version;"
|
||||
"git-revison;";
|
||||
"git-revision;";
|
||||
|
||||
if (client_id > 0)
|
||||
webSocket.text(client_id, mapping);
|
||||
|
@ -1,5 +1,5 @@
|
||||
[wifi_cred]
|
||||
admin_password = chainlube
|
||||
wifi_ap_password = wifiappass
|
||||
wifi_pass_seed = wifiapseed
|
||||
wifi_ssid_client = wifi-ssid
|
||||
wifi_password_client = ota-password
|
Loading…
x
Reference in New Issue
Block a user