Tactility/Boards/Simulator/Source/hal/SimulatorPower.cpp
Ken Van Hoeylandt f34440eb6f
Fixes and improvements (#132)
- Fix glitch when turning on WiFi: It would temporarily show "No networks found" right before starting the first scan.
- Fix spinner to use Assets.h
- Replace statusbar battery icons 
- Better statusbar icon for when WiFi is on but not connected
- Replace statusbar WiFi icons and Wifi Manage RSSI/lock icons
- Fix for crash when timer is null in I2cScanner
- Deprecate Spacer
- Fixes for toolbar layout (simplified)
- Improved ImageViewer app: center image and add filename text on the bottom
- Add LV debug params to sdkconfig.developer
- Disabled LV spinner, msgbox and window widgets. These have equivalents in Tactility.
2024-12-17 23:32:43 +01:00

45 lines
1.1 KiB
C++

#include "SimulatorPower.h"
#define TAG "simulator_power"
bool SimulatorPower::supportsMetric(MetricType type) const {
switch (type) {
case IS_CHARGING:
case CURRENT:
case BATTERY_VOLTAGE:
case CHARGE_LEVEL:
return true;
}
return false; // Safety guard for when new enum values are introduced
}
bool SimulatorPower::getMetric(Power::MetricType type, Power::MetricData& data) {
switch (type) {
case IS_CHARGING:
data.valueAsBool = true;
return true;
case CURRENT:
data.valueAsInt32 = 42;
return true;
case BATTERY_VOLTAGE:
data.valueAsUint32 = 4032;
return true;
case CHARGE_LEVEL:
data.valueAsUint8 = 100;
return true;
}
return false; // Safety guard for when new enum values are introduced
}
static std::shared_ptr<Power> power;
std::shared_ptr<Power> simulatorPower() {
if (power == nullptr) {
power = std::make_shared<SimulatorPower>();
}
return power;
}