Skip to content

Commit fff0a00

Browse files
committed
Revert "added low battery message"
This reverts PR #1352
1 parent 3b084d7 commit fff0a00

File tree

5 files changed

+1
-31
lines changed

5 files changed

+1
-31
lines changed

src/components/battery/BatteryController.cpp

-10
Original file line numberDiff line numberDiff line change
@@ -81,20 +81,10 @@ void Battery::SaadcEventHandler(nrfx_saadc_evt_t const* p_event) {
8181
newPercent = std::min(approx.GetValue(voltage), isCharging ? uint8_t {99} : uint8_t {100});
8282
}
8383

84-
if (isPowerPresent) {
85-
batteryLowNotified = false;
86-
}
87-
8884
if ((isPowerPresent && newPercent > percentRemaining) || (!isPowerPresent && newPercent < percentRemaining) || firstMeasurement) {
8985
firstMeasurement = false;
9086
percentRemaining = newPercent;
9187
systemTask->PushMessage(System::Messages::BatteryPercentageUpdated);
92-
93-
// warn about low battery when not charging and below threshold
94-
if (BatteryIsLow() && !isPowerPresent && !batteryLowNotified) {
95-
systemTask->PushMessage(System::Messages::LowBattery);
96-
batteryLowNotified = true;
97-
}
9888
}
9989

10090
nrfx_saadc_uninit();

src/components/battery/BatteryController.h

-7
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@ namespace Pinetime {
1818
return percentRemaining;
1919
}
2020

21-
bool BatteryIsLow() const {
22-
return percentRemaining <= lowBatteryThreshold;
23-
}
24-
2521
uint16_t Voltage() const {
2622
return voltage;
2723
}
@@ -43,7 +39,6 @@ namespace Pinetime {
4339
static constexpr nrf_saadc_input_t batteryVoltageAdcInput = NRF_SAADC_INPUT_AIN7;
4440
uint16_t voltage = 0;
4541
uint8_t percentRemaining = 0;
46-
bool batteryLowNotified = false;
4742

4843
bool isFull = false;
4944
bool isCharging = false;
@@ -55,8 +50,6 @@ namespace Pinetime {
5550
void SaadcEventHandler(nrfx_saadc_evt_t const* p_event);
5651
static void AdcCallbackStatic(nrfx_saadc_evt_t const* event);
5752

58-
static constexpr uint8_t lowBatteryThreshold {15};
59-
6053
bool isReading = false;
6154

6255
Pinetime::System::SystemTask* systemTask = nullptr;

src/displayapp/screens/BatteryInfo.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ void BatteryInfo::Refresh() {
5858
} else if (batteryPercent == 100) {
5959
lv_obj_set_style_local_bg_color(charging_bar, LV_BAR_PART_INDIC, LV_STATE_DEFAULT, LV_COLOR_BLUE);
6060
lv_label_set_text_static(status, "Fully charged");
61-
} else if (batteryController.BatteryIsLow()) {
61+
} else if (batteryPercent < 10) {
6262
lv_obj_set_style_local_bg_color(charging_bar, LV_BAR_PART_INDIC, LV_STATE_DEFAULT, LV_COLOR_YELLOW);
6363
lv_label_set_text_static(status, "Battery low");
6464
} else {

src/systemtask/Messages.h

-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ namespace Pinetime {
2929
SetOffAlarm,
3030
MeasureBatteryTimerExpired,
3131
BatteryPercentageUpdated,
32-
LowBattery,
3332
StartFileTransfer,
3433
StopFileTransfer,
3534
BleRadioEnableToggle

src/systemtask/SystemTask.cpp

-12
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
#include "BootErrors.h"
1919

2020
#include <memory>
21-
#include <algorithm>
22-
#include <cstring>
2321

2422
using namespace Pinetime::System;
2523

@@ -408,16 +406,6 @@ void SystemTask::Work() {
408406
case Messages::BatteryPercentageUpdated:
409407
nimbleController.NotifyBatteryLevel(batteryController.PercentRemaining());
410408
break;
411-
case Messages::LowBattery: {
412-
Pinetime::Controllers::NotificationManager::Notification notif;
413-
constexpr char message[] = "Low Battery\0Charge your watch to prevent data loss.\0";
414-
constexpr size_t messageSize = std::min(sizeof(message), Pinetime::Controllers::NotificationManager::MaximumMessageSize());
415-
std::memcpy(notif.message.data(), message, messageSize);
416-
notif.size = messageSize;
417-
notif.category = Pinetime::Controllers::NotificationManager::Categories::SimpleAlert;
418-
notificationManager.Push(std::move(notif));
419-
PushMessage(Messages::OnNewNotification);
420-
} break;
421409
case Messages::OnPairing:
422410
if (state == SystemTaskState::Sleeping) {
423411
GoToRunning();

0 commit comments

Comments
 (0)