Skip to content

Commit 7f2b74f

Browse files
committed
fix: battery saver mode in AP FW
- initial batt saver, doesn't do much yet
1 parent df34002 commit 7f2b74f

File tree

2 files changed

+32
-34
lines changed

2 files changed

+32
-34
lines changed

Antihunter/full/src/hardware.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1728,10 +1728,6 @@ void enterBatterySaver(uint32_t heartbeatIntervalMs) {
17281728
// Disable WiFi promiscuous mode
17291729
esp_wifi_set_promiscuous(false);
17301730

1731-
// Stop WiFi (but keep mesh UART active)
1732-
esp_wifi_stop();
1733-
Serial.println("[BATTERY_SAVER] WiFi stopped");
1734-
17351731
// Disable BLE controller
17361732
esp_bt_controller_disable();
17371733
Serial.println("[BATTERY_SAVER] BLE disabled");
@@ -1788,10 +1784,6 @@ void exitBatterySaver() {
17881784
esp_bt_controller_enable(ESP_BT_MODE_BLE);
17891785
Serial.println("[BATTERY_SAVER] BLE re-enabled");
17901786

1791-
// Restart WiFi
1792-
WiFi.mode(WIFI_MODE_STA);
1793-
Serial.println("[BATTERY_SAVER] WiFi restarted");
1794-
17951787
batterySaverEnabled = false;
17961788

17971789
// Send notification to mesh

Antihunter/full/src/network.cpp

Lines changed: 32 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -908,36 +908,42 @@ static const char INDEX_HTML[] PROGMEM = R"HTML(
908908
<div id="autoEraseStatus" style="margin-top:8px;padding:6px;border-radius:4px;font-size:11px;text-align:center;">DISABLED</div>
909909
</div>
910910
911-
<!-- Battery Saver Mode -->
912-
<div style="margin-top:24px;padding-top:16px;border-top:1px solid var(--bord);">
913-
<div style="display:flex;align-items:center;gap:8px;margin-bottom:12px;">
914-
<span style="font-weight:bold;color:var(--accent);">Battery Saver Mode</span>
915-
<span style="cursor:help;padding:2px 6px;background:rgba(74,144,226,0.2);border:1px solid #4a90e2;border-radius:4px;font-size:10px;" onclick="showBatterySaverHelp()" title="Click for help">?</span>
916-
</div>
911+
</div>
912+
</div>
917913
918-
<p style="font-size:11px;color:#888;margin-bottom:12px;">
919-
Reduces power consumption by disabling WiFi/BLE scanning, lowering CPU frequency to 80MHz, and sending only periodic heartbeats. Mesh UART remains active for receiving commands.
920-
</p>
914+
<!-- Battery Saver Mode -->
915+
<div class="card">
916+
<div class="card-header" onclick="toggleCollapse('batterySaverCard')">
917+
<h3>Battery Saver Mode</h3>
918+
<span class="collapse-icon" id="batterySaverCardIcon">&#9654;</span>
919+
</div>
920+
<div class="card-body collapsed" id="batterySaverCardBody">
921+
<div style="display:flex;align-items:center;gap:8px;margin-bottom:12px;">
922+
<span style="cursor:help;padding:2px 6px;background:rgba(74,144,226,0.2);border:1px solid #4a90e2;border-radius:4px;font-size:10px;" onclick="showBatterySaverHelp()" title="Click for help">?</span>
923+
</div>
921924
922-
<div style="margin-bottom:16px;">
923-
<label style="font-size:11px;font-weight:bold;margin-bottom:4px;display:block;">Heartbeat Interval</label>
924-
<label style="font-size:10px;color:#888;margin-bottom:6px;display:block;">How often to send status heartbeats while in battery saver mode</label>
925-
<select id="batterySaverInterval">
926-
<option value="1">1 minute</option>
927-
<option value="2">2 minutes</option>
928-
<option value="5" selected>5 minutes</option>
929-
<option value="10">10 minutes</option>
930-
<option value="15">15 minutes</option>
931-
<option value="30">30 minutes</option>
932-
</select>
933-
</div>
925+
<p style="font-size:11px;color:#888;margin-bottom:12px;">
926+
Reduces power consumption by stopping WiFi/BLE scanning, lowering CPU frequency, and sending only periodic heartbeats. WiFi AP and web UI remain active. Mesh UART remains active for receiving commands.
927+
</p>
928+
929+
<div style="margin-bottom:16px;">
930+
<label style="font-size:11px;font-weight:bold;margin-bottom:4px;display:block;">Heartbeat Interval</label>
931+
<label style="font-size:10px;color:#888;margin-bottom:6px;display:block;">How often to send status heartbeats while in battery saver mode</label>
932+
<select id="batterySaverInterval">
933+
<option value="1">1 minute</option>
934+
<option value="2">2 minutes</option>
935+
<option value="5" selected>5 minutes</option>
936+
<option value="10">10 minutes</option>
937+
<option value="15">15 minutes</option>
938+
<option value="30">30 minutes</option>
939+
</select>
940+
</div>
934941
935-
<div style="display:flex;gap:8px;">
936-
<button class="btn primary" type="button" onclick="enableBatterySaver()" style="flex:1;">Enable Battery Saver</button>
937-
<button class="btn alt" type="button" onclick="disableBatterySaver()" style="flex:1;">Disable</button>
938-
</div>
939-
<div id="batterySaverStatus" style="margin-top:8px;padding:6px;border-radius:4px;font-size:11px;text-align:center;background:rgba(0,0,0,0.2);">INACTIVE</div>
942+
<div style="display:flex;gap:8px;">
943+
<button class="btn primary" type="button" onclick="enableBatterySaver()" style="flex:1;">Enable Battery Saver</button>
944+
<button class="btn alt" type="button" onclick="disableBatterySaver()" style="flex:1;">Disable</button>
940945
</div>
946+
<div id="batterySaverStatus" style="margin-top:8px;padding:6px;border-radius:4px;font-size:11px;text-align:center;background:rgba(0,0,0,0.2);">INACTIVE</div>
941947
</div>
942948
</div>
943949

0 commit comments

Comments
 (0)