Apply clang-format to all C++ files
This commit is contained in:
parent
718fbdab98
commit
7f45538eb5
|
@ -8,9 +8,9 @@ AlignConsecutiveDeclarations: false
|
||||||
AlignEscapedNewlines: Right
|
AlignEscapedNewlines: Right
|
||||||
AlignOperands: Align
|
AlignOperands: Align
|
||||||
AlignTrailingComments: true
|
AlignTrailingComments: true
|
||||||
AllowAllArgumentsOnNextLine: true
|
AllowAllArgumentsOnNextLine: false
|
||||||
AllowAllConstructorInitializersOnNextLine: true
|
AllowAllConstructorInitializersOnNextLine: true
|
||||||
AllowAllParametersOfDeclarationOnNextLine: true
|
AllowAllParametersOfDeclarationOnNextLine: false
|
||||||
AllowShortBlocksOnASingleLine: Never
|
AllowShortBlocksOnASingleLine: Never
|
||||||
AllowShortCaseLabelsOnASingleLine: false
|
AllowShortCaseLabelsOnASingleLine: false
|
||||||
AllowShortFunctionsOnASingleLine: None
|
AllowShortFunctionsOnASingleLine: None
|
||||||
|
@ -83,6 +83,8 @@ IndentGotoLabels: true
|
||||||
IndentPPDirectives: BeforeHash
|
IndentPPDirectives: BeforeHash
|
||||||
IndentWidth: 2
|
IndentWidth: 2
|
||||||
IndentWrappedFunctionNames: false
|
IndentWrappedFunctionNames: false
|
||||||
|
# Requires Clang >= 15, could also cause incorrect code formatting:
|
||||||
|
# InsertBraces: true
|
||||||
JavaScriptQuotes: Leave
|
JavaScriptQuotes: Leave
|
||||||
JavaScriptWrapImports: true
|
JavaScriptWrapImports: true
|
||||||
KeepEmptyLinesAtTheStartOfBlocks: true
|
KeepEmptyLinesAtTheStartOfBlocks: true
|
||||||
|
|
|
@ -31,6 +31,10 @@ const bool BootloaderVersion::IsValid() {
|
||||||
|
|
||||||
void BootloaderVersion::SetVersion(uint32_t v) {
|
void BootloaderVersion::SetVersion(uint32_t v) {
|
||||||
BootloaderVersion::version = v;
|
BootloaderVersion::version = v;
|
||||||
snprintf(BootloaderVersion::versionString, BootloaderVersion::VERSION_STR_LEN, "%ld.%ld.%ld",
|
snprintf(BootloaderVersion::versionString,
|
||||||
BootloaderVersion::Major(), BootloaderVersion::Minor(), BootloaderVersion::Patch());
|
BootloaderVersion::VERSION_STR_LEN,
|
||||||
|
"%ld.%ld.%ld",
|
||||||
|
BootloaderVersion::Major(),
|
||||||
|
BootloaderVersion::Minor(),
|
||||||
|
BootloaderVersion::Patch());
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@ namespace Pinetime {
|
||||||
static const char* VersionString();
|
static const char* VersionString();
|
||||||
static const bool IsValid();
|
static const bool IsValid();
|
||||||
static void SetVersion(uint32_t v);
|
static void SetVersion(uint32_t v);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static uint32_t version;
|
static uint32_t version;
|
||||||
static constexpr size_t VERSION_STR_LEN = 12;
|
static constexpr size_t VERSION_STR_LEN = 12;
|
||||||
|
|
|
@ -54,8 +54,7 @@ void AlarmController::ScheduleAlarm() {
|
||||||
|
|
||||||
auto now = dateTimeController.CurrentDateTime();
|
auto now = dateTimeController.CurrentDateTime();
|
||||||
alarmTime = now;
|
alarmTime = now;
|
||||||
time_t ttAlarmTime = std::chrono::system_clock::to_time_t(
|
time_t ttAlarmTime = std::chrono::system_clock::to_time_t(std::chrono::time_point_cast<std::chrono::system_clock::duration>(alarmTime));
|
||||||
std::chrono::time_point_cast<std::chrono::system_clock::duration>(alarmTime));
|
|
||||||
tm* tmAlarmTime = std::localtime(&ttAlarmTime);
|
tm* tmAlarmTime = std::localtime(&ttAlarmTime);
|
||||||
|
|
||||||
// If the time being set has already passed today,the alarm should be set for tomorrow
|
// If the time being set has already passed today,the alarm should be set for tomorrow
|
||||||
|
|
|
@ -26,8 +26,11 @@ namespace {
|
||||||
return client->OnCharacteristicsDiscoveryEvent(conn_handle, error, chr);
|
return client->OnCharacteristicsDiscoveryEvent(conn_handle, error, chr);
|
||||||
}
|
}
|
||||||
|
|
||||||
int OnAlertNotificationDescriptorDiscoveryEventCallback(
|
int OnAlertNotificationDescriptorDiscoveryEventCallback(uint16_t conn_handle,
|
||||||
uint16_t conn_handle, const struct ble_gatt_error* error, uint16_t chr_val_handle, const struct ble_gatt_dsc* dsc, void* arg) {
|
const struct ble_gatt_error* error,
|
||||||
|
uint16_t chr_val_handle,
|
||||||
|
const struct ble_gatt_dsc* dsc,
|
||||||
|
void* arg) {
|
||||||
auto client = static_cast<AlertNotificationClient*>(arg);
|
auto client = static_cast<AlertNotificationClient*>(arg);
|
||||||
return client->OnDescriptorDiscoveryEventCallback(conn_handle, error, chr_val_handle, dsc);
|
return client->OnDescriptorDiscoveryEventCallback(conn_handle, error, chr_val_handle, dsc);
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@ namespace Pinetime {
|
||||||
|
|
||||||
int OnBatteryServiceRequested(uint16_t connectionHandle, uint16_t attributeHandle, ble_gatt_access_ctxt* context);
|
int OnBatteryServiceRequested(uint16_t connectionHandle, uint16_t attributeHandle, ble_gatt_access_ctxt* context);
|
||||||
void NotifyBatteryLevel(uint16_t connectionHandle, uint8_t level);
|
void NotifyBatteryLevel(uint16_t connectionHandle, uint8_t level);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Controllers::Battery& batteryController;
|
Controllers::Battery& batteryController;
|
||||||
static constexpr uint16_t batteryInformationServiceId {0x180F};
|
static constexpr uint16_t batteryInformationServiceId {0x180F};
|
||||||
|
|
|
@ -85,10 +85,21 @@ int CurrentTimeClient::OnCurrentTimeReadResult(uint16_t conn_handle, const ble_g
|
||||||
// TODO check that attribute->handle equals the handle discovered in OnCharacteristicDiscoveryEvent
|
// TODO check that attribute->handle equals the handle discovered in OnCharacteristicDiscoveryEvent
|
||||||
CtsData result;
|
CtsData result;
|
||||||
os_mbuf_copydata(attribute->om, 0, sizeof(CtsData), &result);
|
os_mbuf_copydata(attribute->om, 0, sizeof(CtsData), &result);
|
||||||
NRF_LOG_INFO(
|
NRF_LOG_INFO("Received data: %d-%d-%d %d:%d:%d",
|
||||||
"Received data: %d-%d-%d %d:%d:%d", result.year, result.month, result.dayofmonth, result.hour, result.minute, result.second);
|
result.year,
|
||||||
dateTimeController.SetTime(
|
result.month,
|
||||||
result.year, result.month, result.dayofmonth, 0, result.hour, result.minute, result.second, nrf_rtc_counter_get(portNRF_RTC_REG));
|
result.dayofmonth,
|
||||||
|
result.hour,
|
||||||
|
result.minute,
|
||||||
|
result.second);
|
||||||
|
dateTimeController.SetTime(result.year,
|
||||||
|
result.month,
|
||||||
|
result.dayofmonth,
|
||||||
|
0,
|
||||||
|
result.hour,
|
||||||
|
result.minute,
|
||||||
|
result.second,
|
||||||
|
nrf_rtc_counter_get(portNRF_RTC_REG));
|
||||||
} else {
|
} else {
|
||||||
NRF_LOG_INFO("Error retrieving current time: %d", error->status);
|
NRF_LOG_INFO("Error retrieving current time: %d", error->status);
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,11 +29,22 @@ int CurrentTimeService::OnTimeAccessed(uint16_t conn_handle, uint16_t attr_handl
|
||||||
CtsData result;
|
CtsData result;
|
||||||
os_mbuf_copydata(ctxt->om, 0, sizeof(CtsData), &result);
|
os_mbuf_copydata(ctxt->om, 0, sizeof(CtsData), &result);
|
||||||
|
|
||||||
NRF_LOG_INFO(
|
NRF_LOG_INFO("Received data: %d-%d-%d %d:%d:%d",
|
||||||
"Received data: %d-%d-%d %d:%d:%d", result.year, result.month, result.dayofmonth, result.hour, result.minute, result.second);
|
result.year,
|
||||||
|
result.month,
|
||||||
|
result.dayofmonth,
|
||||||
|
result.hour,
|
||||||
|
result.minute,
|
||||||
|
result.second);
|
||||||
|
|
||||||
m_dateTimeController.SetTime(
|
m_dateTimeController.SetTime(result.year,
|
||||||
result.year, result.month, result.dayofmonth, 0, result.hour, result.minute, result.second, nrf_rtc_counter_get(portNRF_RTC_REG));
|
result.month,
|
||||||
|
result.dayofmonth,
|
||||||
|
0,
|
||||||
|
result.hour,
|
||||||
|
result.minute,
|
||||||
|
result.second,
|
||||||
|
nrf_rtc_counter_get(portNRF_RTC_REG));
|
||||||
|
|
||||||
} else if (ctxt->op == BLE_GATT_ACCESS_OP_READ_CHR) {
|
} else if (ctxt->op == BLE_GATT_ACCESS_OP_READ_CHR) {
|
||||||
CtsData currentDateTime;
|
CtsData currentDateTime;
|
||||||
|
|
|
@ -57,7 +57,8 @@ int HeartRateService::OnHeartRateRequested(uint16_t connectionHandle, uint16_t a
|
||||||
}
|
}
|
||||||
|
|
||||||
void HeartRateService::OnNewHeartRateValue(uint8_t heartRateValue) {
|
void HeartRateService::OnNewHeartRateValue(uint8_t heartRateValue) {
|
||||||
if(!heartRateMeasurementNotificationEnable) return;
|
if (!heartRateMeasurementNotificationEnable)
|
||||||
|
return;
|
||||||
|
|
||||||
uint8_t buffer[2] = {0, heartRateController.HeartRate()}; // [0] = flags, [1] = hr value
|
uint8_t buffer[2] = {0, heartRateController.HeartRate()}; // [0] = flags, [1] = hr value
|
||||||
auto* om = ble_hs_mbuf_from_flat(buffer, 2);
|
auto* om = ble_hs_mbuf_from_flat(buffer, 2);
|
||||||
|
@ -72,11 +73,11 @@ void HeartRateService::OnNewHeartRateValue(uint8_t heartRateValue) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void HeartRateService::SubscribeNotification(uint16_t connectionHandle, uint16_t attributeHandle) {
|
void HeartRateService::SubscribeNotification(uint16_t connectionHandle, uint16_t attributeHandle) {
|
||||||
if(attributeHandle == heartRateMeasurementHandle)
|
if (attributeHandle == heartRateMeasurementHandle)
|
||||||
heartRateMeasurementNotificationEnable = true;
|
heartRateMeasurementNotificationEnable = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void HeartRateService::UnsubscribeNotification(uint16_t connectionHandle, uint16_t attributeHandle) {
|
void HeartRateService::UnsubscribeNotification(uint16_t connectionHandle, uint16_t attributeHandle) {
|
||||||
if(attributeHandle == heartRateMeasurementHandle)
|
if (attributeHandle == heartRateMeasurementHandle)
|
||||||
heartRateMeasurementNotificationEnable = false;
|
heartRateMeasurementNotificationEnable = false;
|
||||||
}
|
}
|
|
@ -8,10 +8,8 @@ using namespace Pinetime::Controllers;
|
||||||
namespace {
|
namespace {
|
||||||
// 0003yyxx-78fc-48fe-8e23-433b3a1942d0
|
// 0003yyxx-78fc-48fe-8e23-433b3a1942d0
|
||||||
constexpr ble_uuid128_t CharUuid(uint8_t x, uint8_t y) {
|
constexpr ble_uuid128_t CharUuid(uint8_t x, uint8_t y) {
|
||||||
return ble_uuid128_t{
|
return ble_uuid128_t {.u = {.type = BLE_UUID_TYPE_128},
|
||||||
.u = {.type = BLE_UUID_TYPE_128},
|
.value = {0xd0, 0x42, 0x19, 0x3a, 0x3b, 0x43, 0x23, 0x8e, 0xfe, 0x48, 0xfc, 0x78, x, y, 0x03, 0x00}};
|
||||||
.value = { 0xd0, 0x42, 0x19, 0x3a, 0x3b, 0x43, 0x23, 0x8e, 0xfe, 0x48, 0xfc, 0x78, x, y, 0x03, 0x00 }
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 00030000-78fc-48fe-8e23-433b3a1942d0
|
// 00030000-78fc-48fe-8e23-433b3a1942d0
|
||||||
|
@ -45,11 +43,7 @@ MotionService::MotionService(Pinetime::System::SystemTask& system, Controllers::
|
||||||
.val_handle = &motionValuesHandle},
|
.val_handle = &motionValuesHandle},
|
||||||
{0}},
|
{0}},
|
||||||
serviceDefinition {
|
serviceDefinition {
|
||||||
{
|
{.type = BLE_GATT_SVC_TYPE_PRIMARY, .uuid = &motionServiceUuid.u, .characteristics = characteristicDefinition},
|
||||||
.type = BLE_GATT_SVC_TYPE_PRIMARY,
|
|
||||||
.uuid = &motionServiceUuid.u,
|
|
||||||
.characteristics = characteristicDefinition
|
|
||||||
},
|
|
||||||
{0},
|
{0},
|
||||||
} {
|
} {
|
||||||
// TODO refactor to prevent this loop dependency (service depends on controller and controller depends on service)
|
// TODO refactor to prevent this loop dependency (service depends on controller and controller depends on service)
|
||||||
|
@ -72,8 +66,8 @@ int MotionService::OnStepCountRequested(uint16_t connectionHandle, uint16_t attr
|
||||||
|
|
||||||
int res = os_mbuf_append(context->om, &buffer, 4);
|
int res = os_mbuf_append(context->om, &buffer, 4);
|
||||||
return (res == 0) ? 0 : BLE_ATT_ERR_INSUFFICIENT_RES;
|
return (res == 0) ? 0 : BLE_ATT_ERR_INSUFFICIENT_RES;
|
||||||
} else if(attributeHandle == motionValuesHandle) {
|
} else if (attributeHandle == motionValuesHandle) {
|
||||||
int16_t buffer[3] = { motionController.X(), motionController.Y(), motionController.Z() };
|
int16_t buffer[3] = {motionController.X(), motionController.Y(), motionController.Z()};
|
||||||
|
|
||||||
int res = os_mbuf_append(context->om, buffer, 3 * sizeof(int16_t));
|
int res = os_mbuf_append(context->om, buffer, 3 * sizeof(int16_t));
|
||||||
return (res == 0) ? 0 : BLE_ATT_ERR_INSUFFICIENT_RES;
|
return (res == 0) ? 0 : BLE_ATT_ERR_INSUFFICIENT_RES;
|
||||||
|
@ -82,7 +76,8 @@ int MotionService::OnStepCountRequested(uint16_t connectionHandle, uint16_t attr
|
||||||
}
|
}
|
||||||
|
|
||||||
void MotionService::OnNewStepCountValue(uint32_t stepCount) {
|
void MotionService::OnNewStepCountValue(uint32_t stepCount) {
|
||||||
if(!stepCountNoficationEnabled) return;
|
if (!stepCountNoficationEnabled)
|
||||||
|
return;
|
||||||
|
|
||||||
uint32_t buffer = stepCount;
|
uint32_t buffer = stepCount;
|
||||||
auto* om = ble_hs_mbuf_from_flat(&buffer, 4);
|
auto* om = ble_hs_mbuf_from_flat(&buffer, 4);
|
||||||
|
@ -96,9 +91,10 @@ void MotionService::OnNewStepCountValue(uint32_t stepCount) {
|
||||||
ble_gattc_notify_custom(connectionHandle, stepCountHandle, om);
|
ble_gattc_notify_custom(connectionHandle, stepCountHandle, om);
|
||||||
}
|
}
|
||||||
void MotionService::OnNewMotionValues(int16_t x, int16_t y, int16_t z) {
|
void MotionService::OnNewMotionValues(int16_t x, int16_t y, int16_t z) {
|
||||||
if(!motionValuesNoficationEnabled) return;
|
if (!motionValuesNoficationEnabled)
|
||||||
|
return;
|
||||||
|
|
||||||
int16_t buffer[3] = { motionController.X(), motionController.Y(), motionController.Z() };
|
int16_t buffer[3] = {motionController.X(), motionController.Y(), motionController.Z()};
|
||||||
auto* om = ble_hs_mbuf_from_flat(buffer, 3 * sizeof(int16_t));
|
auto* om = ble_hs_mbuf_from_flat(buffer, 3 * sizeof(int16_t));
|
||||||
|
|
||||||
uint16_t connectionHandle = system.nimble().connHandle();
|
uint16_t connectionHandle = system.nimble().connHandle();
|
||||||
|
@ -111,15 +107,15 @@ void MotionService::OnNewMotionValues(int16_t x, int16_t y, int16_t z) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MotionService::SubscribeNotification(uint16_t connectionHandle, uint16_t attributeHandle) {
|
void MotionService::SubscribeNotification(uint16_t connectionHandle, uint16_t attributeHandle) {
|
||||||
if(attributeHandle == stepCountHandle)
|
if (attributeHandle == stepCountHandle)
|
||||||
stepCountNoficationEnabled = true;
|
stepCountNoficationEnabled = true;
|
||||||
else if(attributeHandle == motionValuesHandle)
|
else if (attributeHandle == motionValuesHandle)
|
||||||
motionValuesNoficationEnabled = true;
|
motionValuesNoficationEnabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MotionService::UnsubscribeNotification(uint16_t connectionHandle, uint16_t attributeHandle) {
|
void MotionService::UnsubscribeNotification(uint16_t connectionHandle, uint16_t attributeHandle) {
|
||||||
if(attributeHandle == stepCountHandle)
|
if (attributeHandle == stepCountHandle)
|
||||||
stepCountNoficationEnabled = false;
|
stepCountNoficationEnabled = false;
|
||||||
else if(attributeHandle == motionValuesHandle)
|
else if (attributeHandle == motionValuesHandle)
|
||||||
motionValuesNoficationEnabled = false;
|
motionValuesNoficationEnabled = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,10 +22,8 @@
|
||||||
namespace {
|
namespace {
|
||||||
// 0000yyxx-78fc-48fe-8e23-433b3a1942d0
|
// 0000yyxx-78fc-48fe-8e23-433b3a1942d0
|
||||||
constexpr ble_uuid128_t CharUuid(uint8_t x, uint8_t y) {
|
constexpr ble_uuid128_t CharUuid(uint8_t x, uint8_t y) {
|
||||||
return ble_uuid128_t{
|
return ble_uuid128_t {.u = {.type = BLE_UUID_TYPE_128},
|
||||||
.u = {.type = BLE_UUID_TYPE_128},
|
.value = {0xd0, 0x42, 0x19, 0x3a, 0x3b, 0x43, 0x23, 0x8e, 0xfe, 0x48, 0xfc, 0x78, x, y, 0x00, 0x00}};
|
||||||
.value = { 0xd0, 0x42, 0x19, 0x3a, 0x3b, 0x43, 0x23, 0x8e, 0xfe, 0x48, 0xfc, 0x78, x, y, 0x00, 0x00 }
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 00000000-78fc-48fe-8e23-433b3a1942d0
|
// 00000000-78fc-48fe-8e23-433b3a1942d0
|
||||||
|
@ -111,8 +109,7 @@ Pinetime::Controllers::MusicService::MusicService(Pinetime::System::SystemTask&
|
||||||
.flags = BLE_GATT_CHR_F_WRITE | BLE_GATT_CHR_F_READ};
|
.flags = BLE_GATT_CHR_F_WRITE | BLE_GATT_CHR_F_READ};
|
||||||
characteristicDefinition[13] = {0};
|
characteristicDefinition[13] = {0};
|
||||||
|
|
||||||
serviceDefinition[0] = {
|
serviceDefinition[0] = {.type = BLE_GATT_SVC_TYPE_PRIMARY, .uuid = &msUuid.u, .characteristics = characteristicDefinition};
|
||||||
.type = BLE_GATT_SVC_TYPE_PRIMARY, .uuid = &msUuid.u, .characteristics = characteristicDefinition};
|
|
||||||
serviceDefinition[1] = {0};
|
serviceDefinition[1] = {0};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,9 +134,9 @@ int Pinetime::Controllers::MusicService::OnCommand(uint16_t conn_handle, uint16_
|
||||||
os_mbuf_copydata(ctxt->om, 0, bufferSize, data);
|
os_mbuf_copydata(ctxt->om, 0, bufferSize, data);
|
||||||
|
|
||||||
if (notifSize > bufferSize) {
|
if (notifSize > bufferSize) {
|
||||||
data[bufferSize-1] = '.';
|
data[bufferSize - 1] = '.';
|
||||||
data[bufferSize-2] = '.';
|
data[bufferSize - 2] = '.';
|
||||||
data[bufferSize-3] = '.';
|
data[bufferSize - 3] = '.';
|
||||||
}
|
}
|
||||||
data[bufferSize] = '\0';
|
data[bufferSize] = '\0';
|
||||||
|
|
||||||
|
@ -157,7 +154,8 @@ int Pinetime::Controllers::MusicService::OnCommand(uint16_t conn_handle, uint16_
|
||||||
if (playing) {
|
if (playing) {
|
||||||
trackProgressUpdateTime = xTaskGetTickCount();
|
trackProgressUpdateTime = xTaskGetTickCount();
|
||||||
} else {
|
} else {
|
||||||
trackProgress += static_cast<int>((static_cast<float>(xTaskGetTickCount() - trackProgressUpdateTime) / 1024.0f) * getPlaybackSpeed());
|
trackProgress +=
|
||||||
|
static_cast<int>((static_cast<float>(xTaskGetTickCount() - trackProgressUpdateTime) / 1024.0f) * getPlaybackSpeed());
|
||||||
}
|
}
|
||||||
} else if (ble_uuid_cmp(ctxt->chr->uuid, &msRepeatCharUuid.u) == 0) {
|
} else if (ble_uuid_cmp(ctxt->chr->uuid, &msRepeatCharUuid.u) == 0) {
|
||||||
repeat = s[0];
|
repeat = s[0];
|
||||||
|
@ -201,7 +199,8 @@ float Pinetime::Controllers::MusicService::getPlaybackSpeed() const {
|
||||||
|
|
||||||
int Pinetime::Controllers::MusicService::getProgress() const {
|
int Pinetime::Controllers::MusicService::getProgress() const {
|
||||||
if (isPlaying()) {
|
if (isPlaying()) {
|
||||||
return trackProgress + static_cast<int>((static_cast<float>(xTaskGetTickCount() - trackProgressUpdateTime) / 1024.0f) * getPlaybackSpeed());
|
return trackProgress +
|
||||||
|
static_cast<int>((static_cast<float>(xTaskGetTickCount() - trackProgressUpdateTime) / 1024.0f) * getPlaybackSpeed());
|
||||||
}
|
}
|
||||||
return trackProgress;
|
return trackProgress;
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,15 +46,23 @@ namespace {
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
Pinetime::Controllers::NavigationService::NavigationService(Pinetime::System::SystemTask& system) : m_system(system) {
|
Pinetime::Controllers::NavigationService::NavigationService(Pinetime::System::SystemTask& system) : m_system(system) {
|
||||||
characteristicDefinition[0] = {
|
characteristicDefinition[0] = {.uuid = &navFlagCharUuid.u,
|
||||||
.uuid = &navFlagCharUuid.u, .access_cb = NAVCallback, .arg = this, .flags = BLE_GATT_CHR_F_WRITE | BLE_GATT_CHR_F_READ};
|
.access_cb = NAVCallback,
|
||||||
|
.arg = this,
|
||||||
|
.flags = BLE_GATT_CHR_F_WRITE | BLE_GATT_CHR_F_READ};
|
||||||
|
|
||||||
characteristicDefinition[1] = {
|
characteristicDefinition[1] = {.uuid = &navNarrativeCharUuid.u,
|
||||||
.uuid = &navNarrativeCharUuid.u, .access_cb = NAVCallback, .arg = this, .flags = BLE_GATT_CHR_F_WRITE | BLE_GATT_CHR_F_READ};
|
.access_cb = NAVCallback,
|
||||||
characteristicDefinition[2] = {
|
.arg = this,
|
||||||
.uuid = &navManDistCharUuid.u, .access_cb = NAVCallback, .arg = this, .flags = BLE_GATT_CHR_F_WRITE | BLE_GATT_CHR_F_READ};
|
.flags = BLE_GATT_CHR_F_WRITE | BLE_GATT_CHR_F_READ};
|
||||||
characteristicDefinition[3] = {
|
characteristicDefinition[2] = {.uuid = &navManDistCharUuid.u,
|
||||||
.uuid = &navProgressCharUuid.u, .access_cb = NAVCallback, .arg = this, .flags = BLE_GATT_CHR_F_WRITE | BLE_GATT_CHR_F_READ};
|
.access_cb = NAVCallback,
|
||||||
|
.arg = this,
|
||||||
|
.flags = BLE_GATT_CHR_F_WRITE | BLE_GATT_CHR_F_READ};
|
||||||
|
characteristicDefinition[3] = {.uuid = &navProgressCharUuid.u,
|
||||||
|
.access_cb = NAVCallback,
|
||||||
|
.arg = this,
|
||||||
|
.flags = BLE_GATT_CHR_F_WRITE | BLE_GATT_CHR_F_READ};
|
||||||
|
|
||||||
characteristicDefinition[4] = {0};
|
characteristicDefinition[4] = {0};
|
||||||
|
|
||||||
|
|
|
@ -223,7 +223,7 @@ int NimbleController::OnGAPEvent(ble_gap_event* event) {
|
||||||
currentTimeClient.Reset();
|
currentTimeClient.Reset();
|
||||||
alertNotificationClient.Reset();
|
alertNotificationClient.Reset();
|
||||||
connectionHandle = BLE_HS_CONN_HANDLE_NONE;
|
connectionHandle = BLE_HS_CONN_HANDLE_NONE;
|
||||||
if(bleController.IsConnected()) {
|
if (bleController.IsConnected()) {
|
||||||
bleController.Disconnect();
|
bleController.Disconnect();
|
||||||
fastAdvCount = 0;
|
fastAdvCount = 0;
|
||||||
StartAdvertising();
|
StartAdvertising();
|
||||||
|
|
|
@ -127,7 +127,8 @@ namespace Pinetime {
|
||||||
{.uuid = &weatherControlCharUuid.u, .access_cb = WeatherCallback, .arg = this, .flags = BLE_GATT_CHR_F_WRITE | BLE_GATT_CHR_F_READ},
|
{.uuid = &weatherControlCharUuid.u, .access_cb = WeatherCallback, .arg = this, .flags = BLE_GATT_CHR_F_WRITE | BLE_GATT_CHR_F_READ},
|
||||||
{nullptr}};
|
{nullptr}};
|
||||||
const struct ble_gatt_svc_def serviceDefinition[2] = {
|
const struct ble_gatt_svc_def serviceDefinition[2] = {
|
||||||
{.type = BLE_GATT_SVC_TYPE_PRIMARY, .uuid = &weatherUuid.u, .characteristics = characteristicDefinition}, {0}};
|
{.type = BLE_GATT_SVC_TYPE_PRIMARY, .uuid = &weatherUuid.u, .characteristics = characteristicDefinition},
|
||||||
|
{0}};
|
||||||
|
|
||||||
uint16_t eventHandle {};
|
uint16_t eventHandle {};
|
||||||
|
|
||||||
|
|
|
@ -19,8 +19,14 @@ void DateTime::SetCurrentTime(std::chrono::time_point<std::chrono::system_clock,
|
||||||
UpdateTime(previousSystickCounter); // Update internal state without updating the time
|
UpdateTime(previousSystickCounter); // Update internal state without updating the time
|
||||||
}
|
}
|
||||||
|
|
||||||
void DateTime::SetTime(
|
void DateTime::SetTime(uint16_t year,
|
||||||
uint16_t year, uint8_t month, uint8_t day, uint8_t dayOfWeek, uint8_t hour, uint8_t minute, uint8_t second, uint32_t systickCounter) {
|
uint8_t month,
|
||||||
|
uint8_t day,
|
||||||
|
uint8_t dayOfWeek,
|
||||||
|
uint8_t hour,
|
||||||
|
uint8_t minute,
|
||||||
|
uint8_t second,
|
||||||
|
uint32_t systickCounter) {
|
||||||
std::tm tm = {
|
std::tm tm = {
|
||||||
/* .tm_sec = */ second,
|
/* .tm_sec = */ second,
|
||||||
/* .tm_min = */ minute,
|
/* .tm_min = */ minute,
|
||||||
|
@ -129,16 +135,16 @@ std::string DateTime::FormattedTime() {
|
||||||
// Return time as a string in 12- or 24-hour format
|
// Return time as a string in 12- or 24-hour format
|
||||||
char buff[9];
|
char buff[9];
|
||||||
if (settingsController.GetClockType() == ClockType::H12) {
|
if (settingsController.GetClockType() == ClockType::H12) {
|
||||||
uint8_t hour12;
|
uint8_t hour12;
|
||||||
const char* amPmStr;
|
const char* amPmStr;
|
||||||
if (hour < 12) {
|
if (hour < 12) {
|
||||||
hour12 = (hour == 0) ? 12 : hour;
|
hour12 = (hour == 0) ? 12 : hour;
|
||||||
amPmStr = "AM";
|
amPmStr = "AM";
|
||||||
} else {
|
} else {
|
||||||
hour12 = (hour == 12) ? 12 : hour - 12;
|
hour12 = (hour == 12) ? 12 : hour - 12;
|
||||||
amPmStr = "PM";
|
amPmStr = "PM";
|
||||||
}
|
}
|
||||||
sprintf(buff, "%i:%02i %s", hour12, minute, amPmStr);
|
sprintf(buff, "%i:%02i %s", hour12, minute, amPmStr);
|
||||||
} else {
|
} else {
|
||||||
sprintf(buff, "%02i:%02i", hour, minute);
|
sprintf(buff, "%02i:%02i", hour, minute);
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,8 +95,8 @@ int FS::DirRewind(lfs_dir_t* dir) {
|
||||||
int FS::DirCreate(const char* path) {
|
int FS::DirCreate(const char* path) {
|
||||||
return lfs_mkdir(&lfs, path);
|
return lfs_mkdir(&lfs, path);
|
||||||
}
|
}
|
||||||
int FS::Rename(const char* oldPath, const char* newPath){
|
int FS::Rename(const char* oldPath, const char* newPath) {
|
||||||
return lfs_rename(&lfs,oldPath,newPath);
|
return lfs_rename(&lfs, oldPath, newPath);
|
||||||
}
|
}
|
||||||
int FS::Stat(const char* path, lfs_info* info) {
|
int FS::Stat(const char* path, lfs_info* info) {
|
||||||
return lfs_stat(&lfs, path, info);
|
return lfs_stat(&lfs, path, info);
|
||||||
|
|
|
@ -26,7 +26,7 @@ namespace Pinetime {
|
||||||
int DirRead(lfs_dir_t* dir, lfs_info* info);
|
int DirRead(lfs_dir_t* dir, lfs_info* info);
|
||||||
int DirRewind(lfs_dir_t* dir);
|
int DirRewind(lfs_dir_t* dir);
|
||||||
int DirCreate(const char* path);
|
int DirCreate(const char* path);
|
||||||
|
|
||||||
lfs_ssize_t GetFSSize();
|
lfs_ssize_t GetFSSize();
|
||||||
int Rename(const char* oldPath, const char* newPath);
|
int Rename(const char* oldPath, const char* newPath);
|
||||||
int Stat(const char* path, lfs_info* info);
|
int Stat(const char* path, lfs_info* info);
|
||||||
|
|
|
@ -26,12 +26,12 @@ void Settings::LoadSettingsFromFile() {
|
||||||
SettingsData bufferSettings;
|
SettingsData bufferSettings;
|
||||||
lfs_file_t settingsFile;
|
lfs_file_t settingsFile;
|
||||||
|
|
||||||
if ( fs.FileOpen(&settingsFile, "/settings.dat", LFS_O_RDONLY) != LFS_ERR_OK) {
|
if (fs.FileOpen(&settingsFile, "/settings.dat", LFS_O_RDONLY) != LFS_ERR_OK) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
fs.FileRead(&settingsFile, reinterpret_cast<uint8_t*>(&bufferSettings), sizeof(settings));
|
fs.FileRead(&settingsFile, reinterpret_cast<uint8_t*>(&bufferSettings), sizeof(settings));
|
||||||
fs.FileClose(&settingsFile);
|
fs.FileClose(&settingsFile);
|
||||||
if ( bufferSettings.version == settingsVersion ) {
|
if (bufferSettings.version == settingsVersion) {
|
||||||
settings = bufferSettings;
|
settings = bufferSettings;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ void Settings::LoadSettingsFromFile() {
|
||||||
void Settings::SaveSettingsToFile() {
|
void Settings::SaveSettingsToFile() {
|
||||||
lfs_file_t settingsFile;
|
lfs_file_t settingsFile;
|
||||||
|
|
||||||
if ( fs.FileOpen(&settingsFile, "/settings.dat", LFS_O_WRONLY | LFS_O_CREAT) != LFS_ERR_OK) {
|
if (fs.FileOpen(&settingsFile, "/settings.dat", LFS_O_WRONLY | LFS_O_CREAT) != LFS_ERR_OK) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
fs.FileWrite(&settingsFile, reinterpret_cast<uint8_t*>(&settings), sizeof(settings));
|
fs.FileWrite(&settingsFile, reinterpret_cast<uint8_t*>(&settings), sizeof(settings));
|
||||||
|
|
|
@ -140,15 +140,14 @@ namespace Pinetime {
|
||||||
return settings.screenTimeOut;
|
return settings.screenTimeOut;
|
||||||
};
|
};
|
||||||
|
|
||||||
void SetShakeThreshold(uint16_t thresh){
|
void SetShakeThreshold(uint16_t thresh) {
|
||||||
if(settings.shakeWakeThreshold != thresh){
|
if (settings.shakeWakeThreshold != thresh) {
|
||||||
settings.shakeWakeThreshold = thresh;
|
settings.shakeWakeThreshold = thresh;
|
||||||
settingsChanged = true;
|
settingsChanged = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t GetShakeThreshold() const{
|
int16_t GetShakeThreshold() const {
|
||||||
return settings.shakeWakeThreshold;
|
return settings.shakeWakeThreshold;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -195,20 +194,20 @@ namespace Pinetime {
|
||||||
if (goal != settings.stepsGoal) {
|
if (goal != settings.stepsGoal) {
|
||||||
settingsChanged = true;
|
settingsChanged = true;
|
||||||
}
|
}
|
||||||
settings.stepsGoal = goal;
|
settings.stepsGoal = goal;
|
||||||
};
|
};
|
||||||
|
|
||||||
uint32_t GetStepsGoal() const {
|
uint32_t GetStepsGoal() const {
|
||||||
return settings.stepsGoal;
|
return settings.stepsGoal;
|
||||||
};
|
};
|
||||||
|
|
||||||
void SetBleRadioEnabled(bool enabled) {
|
void SetBleRadioEnabled(bool enabled) {
|
||||||
bleRadioEnabled = enabled;
|
bleRadioEnabled = enabled;
|
||||||
};
|
};
|
||||||
|
|
||||||
bool GetBleRadioEnabled() const {
|
bool GetBleRadioEnabled() const {
|
||||||
return bleRadioEnabled;
|
return bleRadioEnabled;
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Pinetime::Controllers::FS& fs;
|
Pinetime::Controllers::FS& fs;
|
||||||
|
|
|
@ -5,23 +5,41 @@ using namespace Pinetime::Controllers;
|
||||||
|
|
||||||
lv_color_t Pinetime::Applications::Convert(Pinetime::Controllers::Settings::Colors color) {
|
lv_color_t Pinetime::Applications::Convert(Pinetime::Controllers::Settings::Colors color) {
|
||||||
switch (color) {
|
switch (color) {
|
||||||
case Pinetime::Controllers::Settings::Colors::White: return LV_COLOR_WHITE;
|
case Pinetime::Controllers::Settings::Colors::White:
|
||||||
case Pinetime::Controllers::Settings::Colors::Silver: return LV_COLOR_SILVER;
|
return LV_COLOR_WHITE;
|
||||||
case Pinetime::Controllers::Settings::Colors::Gray: return LV_COLOR_GRAY;
|
case Pinetime::Controllers::Settings::Colors::Silver:
|
||||||
case Pinetime::Controllers::Settings::Colors::Black: return LV_COLOR_BLACK;
|
return LV_COLOR_SILVER;
|
||||||
case Pinetime::Controllers::Settings::Colors::Red: return LV_COLOR_RED;
|
case Pinetime::Controllers::Settings::Colors::Gray:
|
||||||
case Pinetime::Controllers::Settings::Colors::Maroon: return LV_COLOR_MAKE(0xb0, 0x0, 0x0);
|
return LV_COLOR_GRAY;
|
||||||
case Pinetime::Controllers::Settings::Colors::Yellow: return LV_COLOR_YELLOW;
|
case Pinetime::Controllers::Settings::Colors::Black:
|
||||||
case Pinetime::Controllers::Settings::Colors::Olive: return LV_COLOR_MAKE(0xb0, 0xb0, 0x0);
|
return LV_COLOR_BLACK;
|
||||||
case Pinetime::Controllers::Settings::Colors::Lime: return LV_COLOR_LIME;
|
case Pinetime::Controllers::Settings::Colors::Red:
|
||||||
case Pinetime::Controllers::Settings::Colors::Green: return LV_COLOR_MAKE(0x0, 0xb0, 0x0);
|
return LV_COLOR_RED;
|
||||||
case Pinetime::Controllers::Settings::Colors::Cyan: return LV_COLOR_CYAN;
|
case Pinetime::Controllers::Settings::Colors::Maroon:
|
||||||
case Pinetime::Controllers::Settings::Colors::Teal: return LV_COLOR_MAKE(0x0, 0xb0, 0xb0);
|
return LV_COLOR_MAKE(0xb0, 0x0, 0x0);
|
||||||
case Pinetime::Controllers::Settings::Colors::Blue: return LV_COLOR_BLUE;
|
case Pinetime::Controllers::Settings::Colors::Yellow:
|
||||||
case Pinetime::Controllers::Settings::Colors::Navy: return LV_COLOR_MAKE(0x0, 0x0, 0xb0);
|
return LV_COLOR_YELLOW;
|
||||||
case Pinetime::Controllers::Settings::Colors::Magenta: return LV_COLOR_MAGENTA;
|
case Pinetime::Controllers::Settings::Colors::Olive:
|
||||||
case Pinetime::Controllers::Settings::Colors::Purple: return LV_COLOR_MAKE(0xb0, 0x0, 0xb0);
|
return LV_COLOR_MAKE(0xb0, 0xb0, 0x0);
|
||||||
case Pinetime::Controllers::Settings::Colors::Orange: return LV_COLOR_ORANGE;
|
case Pinetime::Controllers::Settings::Colors::Lime:
|
||||||
default: return LV_COLOR_WHITE;
|
return LV_COLOR_LIME;
|
||||||
|
case Pinetime::Controllers::Settings::Colors::Green:
|
||||||
|
return LV_COLOR_MAKE(0x0, 0xb0, 0x0);
|
||||||
|
case Pinetime::Controllers::Settings::Colors::Cyan:
|
||||||
|
return LV_COLOR_CYAN;
|
||||||
|
case Pinetime::Controllers::Settings::Colors::Teal:
|
||||||
|
return LV_COLOR_MAKE(0x0, 0xb0, 0xb0);
|
||||||
|
case Pinetime::Controllers::Settings::Colors::Blue:
|
||||||
|
return LV_COLOR_BLUE;
|
||||||
|
case Pinetime::Controllers::Settings::Colors::Navy:
|
||||||
|
return LV_COLOR_MAKE(0x0, 0x0, 0xb0);
|
||||||
|
case Pinetime::Controllers::Settings::Colors::Magenta:
|
||||||
|
return LV_COLOR_MAGENTA;
|
||||||
|
case Pinetime::Controllers::Settings::Colors::Purple:
|
||||||
|
return LV_COLOR_MAKE(0xb0, 0x0, 0xb0);
|
||||||
|
case Pinetime::Controllers::Settings::Colors::Orange:
|
||||||
|
return LV_COLOR_ORANGE;
|
||||||
|
default:
|
||||||
|
return LV_COLOR_WHITE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -348,13 +348,21 @@ void DisplayApp::LoadApp(Apps app, DisplayApp::FullRefreshDirections direction)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Apps::Notifications:
|
case Apps::Notifications:
|
||||||
currentScreen = std::make_unique<Screens::Notifications>(
|
currentScreen = std::make_unique<Screens::Notifications>(this,
|
||||||
this, notificationManager, systemTask->nimble().alertService(), motorController, *systemTask, Screens::Notifications::Modes::Normal);
|
notificationManager,
|
||||||
|
systemTask->nimble().alertService(),
|
||||||
|
motorController,
|
||||||
|
*systemTask,
|
||||||
|
Screens::Notifications::Modes::Normal);
|
||||||
ReturnApp(Apps::Clock, FullRefreshDirections::Up, TouchEvents::SwipeUp);
|
ReturnApp(Apps::Clock, FullRefreshDirections::Up, TouchEvents::SwipeUp);
|
||||||
break;
|
break;
|
||||||
case Apps::NotificationsPreview:
|
case Apps::NotificationsPreview:
|
||||||
currentScreen = std::make_unique<Screens::Notifications>(
|
currentScreen = std::make_unique<Screens::Notifications>(this,
|
||||||
this, notificationManager, systemTask->nimble().alertService(), motorController, *systemTask, Screens::Notifications::Modes::Preview);
|
notificationManager,
|
||||||
|
systemTask->nimble().alertService(),
|
||||||
|
motorController,
|
||||||
|
*systemTask,
|
||||||
|
Screens::Notifications::Modes::Preview);
|
||||||
ReturnApp(Apps::Clock, FullRefreshDirections::Up, TouchEvents::SwipeUp);
|
ReturnApp(Apps::Clock, FullRefreshDirections::Up, TouchEvents::SwipeUp);
|
||||||
break;
|
break;
|
||||||
case Apps::Timer:
|
case Apps::Timer:
|
||||||
|
@ -366,8 +374,12 @@ void DisplayApp::LoadApp(Apps app, DisplayApp::FullRefreshDirections direction)
|
||||||
|
|
||||||
// Settings
|
// Settings
|
||||||
case Apps::QuickSettings:
|
case Apps::QuickSettings:
|
||||||
currentScreen = std::make_unique<Screens::QuickSettings>(
|
currentScreen = std::make_unique<Screens::QuickSettings>(this,
|
||||||
this, batteryController, dateTimeController, brightnessController, motorController, settingsController);
|
batteryController,
|
||||||
|
dateTimeController,
|
||||||
|
brightnessController,
|
||||||
|
motorController,
|
||||||
|
settingsController);
|
||||||
ReturnApp(Apps::Clock, FullRefreshDirections::LeftAnim, TouchEvents::SwipeLeft);
|
ReturnApp(Apps::Clock, FullRefreshDirections::LeftAnim, TouchEvents::SwipeLeft);
|
||||||
break;
|
break;
|
||||||
case Apps::Settings:
|
case Apps::Settings:
|
||||||
|
@ -419,8 +431,14 @@ void DisplayApp::LoadApp(Apps app, DisplayApp::FullRefreshDirections direction)
|
||||||
ReturnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown);
|
ReturnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown);
|
||||||
break;
|
break;
|
||||||
case Apps::SysInfo:
|
case Apps::SysInfo:
|
||||||
currentScreen = std::make_unique<Screens::SystemInfo>(
|
currentScreen = std::make_unique<Screens::SystemInfo>(this,
|
||||||
this, dateTimeController, batteryController, brightnessController, bleController, watchdog, motionController, touchPanel);
|
dateTimeController,
|
||||||
|
batteryController,
|
||||||
|
brightnessController,
|
||||||
|
bleController,
|
||||||
|
watchdog,
|
||||||
|
motionController,
|
||||||
|
touchPanel);
|
||||||
ReturnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown);
|
ReturnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown);
|
||||||
break;
|
break;
|
||||||
case Apps::FlashLight:
|
case Apps::FlashLight:
|
||||||
|
|
|
@ -88,7 +88,7 @@ namespace Pinetime {
|
||||||
Pinetime::Controllers::MotionController& motionController;
|
Pinetime::Controllers::MotionController& motionController;
|
||||||
Pinetime::Controllers::TimerController& timerController;
|
Pinetime::Controllers::TimerController& timerController;
|
||||||
Pinetime::Controllers::AlarmController& alarmController;
|
Pinetime::Controllers::AlarmController& alarmController;
|
||||||
Pinetime::Controllers::BrightnessController &brightnessController;
|
Pinetime::Controllers::BrightnessController& brightnessController;
|
||||||
Pinetime::Controllers::TouchHandler& touchHandler;
|
Pinetime::Controllers::TouchHandler& touchHandler;
|
||||||
|
|
||||||
Pinetime::Controllers::FirmwareValidator validator;
|
Pinetime::Controllers::FirmwareValidator validator;
|
||||||
|
|
|
@ -26,7 +26,6 @@ DisplayApp::DisplayApp(Drivers::St7789& lcd,
|
||||||
Pinetime::Controllers::BrightnessController& brightnessController,
|
Pinetime::Controllers::BrightnessController& brightnessController,
|
||||||
Pinetime::Controllers::TouchHandler& touchHandler)
|
Pinetime::Controllers::TouchHandler& touchHandler)
|
||||||
: lcd {lcd}, bleController {bleController} {
|
: lcd {lcd}, bleController {bleController} {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayApp::Start() {
|
void DisplayApp::Start() {
|
||||||
|
@ -121,5 +120,4 @@ void DisplayApp::PushMessage(Display::Messages msg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayApp::Register(Pinetime::System::SystemTask* systemTask) {
|
void DisplayApp::Register(Pinetime::System::SystemTask* systemTask) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,9 @@ namespace Pinetime {
|
||||||
Pinetime::Controllers::BrightnessController& brightnessController,
|
Pinetime::Controllers::BrightnessController& brightnessController,
|
||||||
Pinetime::Controllers::TouchHandler& touchHandler);
|
Pinetime::Controllers::TouchHandler& touchHandler);
|
||||||
void Start();
|
void Start();
|
||||||
void Start(Pinetime::System::BootErrors){ Start(); };
|
void Start(Pinetime::System::BootErrors) {
|
||||||
|
Start();
|
||||||
|
};
|
||||||
void PushMessage(Pinetime::Applications::Display::Messages msg);
|
void PushMessage(Pinetime::Applications::Display::Messages msg);
|
||||||
void Register(Pinetime::System::SystemTask* systemTask);
|
void Register(Pinetime::System::SystemTask* systemTask);
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,6 @@ namespace Pinetime {
|
||||||
LittleVgl& operator=(LittleVgl&&) = delete;
|
LittleVgl& operator=(LittleVgl&&) = delete;
|
||||||
|
|
||||||
void Init() {
|
void Init() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FlushDisplay(const lv_area_t* area, lv_color_t* color_p) {
|
void FlushDisplay(const lv_area_t* area, lv_color_t* color_p) {
|
||||||
|
@ -33,7 +32,6 @@ namespace Pinetime {
|
||||||
void SetNewTapEvent(uint16_t x, uint16_t y) {
|
void SetNewTapEvent(uint16_t x, uint16_t y) {
|
||||||
}
|
}
|
||||||
void SetNewTouchPoint(uint16_t x, uint16_t y, bool contact) {
|
void SetNewTouchPoint(uint16_t x, uint16_t y, bool contact) {
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -195,8 +195,13 @@ bool LittleVgl::GetTouchPadInfo(lv_indev_data_t* ptr) {
|
||||||
|
|
||||||
void LittleVgl::InitTheme() {
|
void LittleVgl::InitTheme() {
|
||||||
|
|
||||||
lv_theme_t* th = lv_pinetime_theme_init(
|
lv_theme_t* th = lv_pinetime_theme_init(LV_COLOR_WHITE,
|
||||||
LV_COLOR_WHITE, LV_COLOR_SILVER, 0, &jetbrains_mono_bold_20, &jetbrains_mono_bold_20, &jetbrains_mono_bold_20, &jetbrains_mono_bold_20);
|
LV_COLOR_SILVER,
|
||||||
|
0,
|
||||||
|
&jetbrains_mono_bold_20,
|
||||||
|
&jetbrains_mono_bold_20,
|
||||||
|
&jetbrains_mono_bold_20,
|
||||||
|
&jetbrains_mono_bold_20);
|
||||||
|
|
||||||
lv_theme_set_act(th);
|
lv_theme_set_act(th);
|
||||||
}
|
}
|
||||||
|
|
|
@ -300,8 +300,12 @@ void Alarm::ShowInfo() {
|
||||||
auto minToAlarm = (timeToAlarm % 3600) / 60;
|
auto minToAlarm = (timeToAlarm % 3600) / 60;
|
||||||
auto secToAlarm = timeToAlarm % 60;
|
auto secToAlarm = timeToAlarm % 60;
|
||||||
|
|
||||||
lv_label_set_text_fmt(
|
lv_label_set_text_fmt(txtMessage,
|
||||||
txtMessage, "Time to\nalarm:\n%2lu Days\n%2lu Hours\n%2lu Minutes\n%2lu Seconds", daysToAlarm, hrsToAlarm, minToAlarm, secToAlarm);
|
"Time to\nalarm:\n%2lu Days\n%2lu Hours\n%2lu Minutes\n%2lu Seconds",
|
||||||
|
daysToAlarm,
|
||||||
|
hrsToAlarm,
|
||||||
|
minToAlarm,
|
||||||
|
secToAlarm);
|
||||||
} else {
|
} else {
|
||||||
lv_label_set_text_static(txtMessage, "Alarm\nis not\nset.");
|
lv_label_set_text_static(txtMessage, "Alarm\nis not\nset.");
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,8 +45,8 @@ namespace Pinetime {
|
||||||
Controllers::Settings& settingsController;
|
Controllers::Settings& settingsController;
|
||||||
System::SystemTask& systemTask;
|
System::SystemTask& systemTask;
|
||||||
|
|
||||||
lv_obj_t *time, *lblampm, *btnStop, *txtStop, *btnMinutesUp, *btnMinutesDown, *btnHoursUp, *btnHoursDown, *txtMinUp,
|
lv_obj_t *time, *lblampm, *btnStop, *txtStop, *btnMinutesUp, *btnMinutesDown, *btnHoursUp, *btnHoursDown, *txtMinUp, *txtMinDown,
|
||||||
*txtMinDown, *txtHrUp, *txtHrDown, *btnRecur, *txtRecur, *btnInfo, *txtInfo, *enableSwitch;
|
*txtHrUp, *txtHrDown, *btnRecur, *txtRecur, *btnInfo, *txtInfo, *enableSwitch;
|
||||||
lv_obj_t* txtMessage = nullptr;
|
lv_obj_t* txtMessage = nullptr;
|
||||||
lv_obj_t* btnMessage = nullptr;
|
lv_obj_t* btnMessage = nullptr;
|
||||||
lv_task_t* taskStopAlarm = nullptr;
|
lv_task_t* taskStopAlarm = nullptr;
|
||||||
|
|
|
@ -15,6 +15,7 @@ namespace Pinetime {
|
||||||
|
|
||||||
static const char* GetUnknownIcon();
|
static const char* GetUnknownIcon();
|
||||||
static const char* GetPlugIcon(bool isCharging);
|
static const char* GetPlugIcon(bool isCharging);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
lv_obj_t* batteryImg;
|
lv_obj_t* batteryImg;
|
||||||
lv_obj_t* batteryJuice;
|
lv_obj_t* batteryJuice;
|
||||||
|
|
|
@ -75,13 +75,22 @@ std::unique_ptr<Screen> Clock::WatchFaceDigitalScreen() {
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<Screen> Clock::WatchFaceAnalogScreen() {
|
std::unique_ptr<Screen> Clock::WatchFaceAnalogScreen() {
|
||||||
return std::make_unique<Screens::WatchFaceAnalog>(
|
return std::make_unique<Screens::WatchFaceAnalog>(app,
|
||||||
app, dateTimeController, batteryController, bleController, notificatioManager, settingsController);
|
dateTimeController,
|
||||||
|
batteryController,
|
||||||
|
bleController,
|
||||||
|
notificatioManager,
|
||||||
|
settingsController);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<Screen> Clock::WatchFacePineTimeStyleScreen() {
|
std::unique_ptr<Screen> Clock::WatchFacePineTimeStyleScreen() {
|
||||||
return std::make_unique<Screens::WatchFacePineTimeStyle>(
|
return std::make_unique<Screens::WatchFacePineTimeStyle>(app,
|
||||||
app, dateTimeController, batteryController, bleController, notificatioManager, settingsController, motionController);
|
dateTimeController,
|
||||||
|
batteryController,
|
||||||
|
bleController,
|
||||||
|
notificatioManager,
|
||||||
|
settingsController,
|
||||||
|
motionController);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<Screen> Clock::WatchFaceTerminalScreen() {
|
std::unique_ptr<Screen> Clock::WatchFaceTerminalScreen() {
|
||||||
|
|
|
@ -9,8 +9,7 @@ namespace {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Error::Error(Pinetime::Applications::DisplayApp* app, System::BootErrors error)
|
Error::Error(Pinetime::Applications::DisplayApp* app, System::BootErrors error) : Screen(app) {
|
||||||
: Screen(app) {
|
|
||||||
|
|
||||||
lv_obj_t* warningLabel = lv_label_create(lv_scr_act(), nullptr);
|
lv_obj_t* warningLabel = lv_label_create(lv_scr_act(), nullptr);
|
||||||
lv_obj_set_style_local_text_color(warningLabel, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_ORANGE);
|
lv_obj_set_style_local_text_color(warningLabel, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_ORANGE);
|
||||||
|
|
|
@ -13,6 +13,7 @@ namespace Pinetime {
|
||||||
~Error() override;
|
~Error() override;
|
||||||
|
|
||||||
void ButtonEventHandler();
|
void ButtonEventHandler();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
lv_obj_t* btnOk;
|
lv_obj_t* btnOk;
|
||||||
};
|
};
|
||||||
|
|
|
@ -34,7 +34,8 @@ FirmwareValidation::FirmwareValidation(Pinetime::Applications::DisplayApp* app,
|
||||||
if (validator.IsValidated())
|
if (validator.IsValidated())
|
||||||
lv_label_set_text_static(labelIsValidated, "You have already\n#00ff00 validated# this firmware#");
|
lv_label_set_text_static(labelIsValidated, "You have already\n#00ff00 validated# this firmware#");
|
||||||
else {
|
else {
|
||||||
lv_label_set_text_static(labelIsValidated, "Please #00ff00 Validate# this version or\n#ff0000 Reset# to rollback to the previous version.");
|
lv_label_set_text_static(labelIsValidated,
|
||||||
|
"Please #00ff00 Validate# this version or\n#ff0000 Reset# to rollback to the previous version.");
|
||||||
|
|
||||||
buttonValidate = lv_btn_create(lv_scr_act(), nullptr);
|
buttonValidate = lv_btn_create(lv_scr_act(), nullptr);
|
||||||
buttonValidate->user_data = this;
|
buttonValidate->user_data = this;
|
||||||
|
|
|
@ -28,7 +28,7 @@ FlashLight::FlashLight(Pinetime::Applications::DisplayApp* app,
|
||||||
lv_label_set_text_static(flashLight, Symbols::highlight);
|
lv_label_set_text_static(flashLight, Symbols::highlight);
|
||||||
lv_obj_align(flashLight, nullptr, LV_ALIGN_CENTER, 0, 0);
|
lv_obj_align(flashLight, nullptr, LV_ALIGN_CENTER, 0, 0);
|
||||||
|
|
||||||
for (auto & i : indicators) {
|
for (auto& i : indicators) {
|
||||||
i = lv_obj_create(lv_scr_act(), nullptr);
|
i = lv_obj_create(lv_scr_act(), nullptr);
|
||||||
lv_obj_set_size(i, 15, 10);
|
lv_obj_set_size(i, 15, 10);
|
||||||
lv_obj_set_style_local_border_width(i, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, 2);
|
lv_obj_set_style_local_border_width(i, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, 2);
|
||||||
|
@ -64,7 +64,7 @@ void FlashLight::SetColors() {
|
||||||
if (isOn) {
|
if (isOn) {
|
||||||
lv_obj_set_style_local_bg_color(lv_scr_act(), LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE);
|
lv_obj_set_style_local_bg_color(lv_scr_act(), LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE);
|
||||||
lv_obj_set_style_local_text_color(flashLight, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_MAKE(0xb0, 0xb0, 0xb0));
|
lv_obj_set_style_local_text_color(flashLight, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_MAKE(0xb0, 0xb0, 0xb0));
|
||||||
for (auto & i : indicators) {
|
for (auto& i : indicators) {
|
||||||
lv_obj_set_style_local_bg_color(i, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_MAKE(0xb0, 0xb0, 0xb0));
|
lv_obj_set_style_local_bg_color(i, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_MAKE(0xb0, 0xb0, 0xb0));
|
||||||
lv_obj_set_style_local_bg_color(i, LV_OBJ_PART_MAIN, LV_STATE_DISABLED, LV_COLOR_WHITE);
|
lv_obj_set_style_local_bg_color(i, LV_OBJ_PART_MAIN, LV_STATE_DISABLED, LV_COLOR_WHITE);
|
||||||
lv_obj_set_style_local_border_color(i, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_MAKE(0xb0, 0xb0, 0xb0));
|
lv_obj_set_style_local_border_color(i, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_MAKE(0xb0, 0xb0, 0xb0));
|
||||||
|
@ -72,7 +72,7 @@ void FlashLight::SetColors() {
|
||||||
} else {
|
} else {
|
||||||
lv_obj_set_style_local_bg_color(lv_scr_act(), LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK);
|
lv_obj_set_style_local_bg_color(lv_scr_act(), LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK);
|
||||||
lv_obj_set_style_local_text_color(flashLight, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE);
|
lv_obj_set_style_local_text_color(flashLight, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE);
|
||||||
for (auto & i : indicators) {
|
for (auto& i : indicators) {
|
||||||
lv_obj_set_style_local_bg_color(i, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE);
|
lv_obj_set_style_local_bg_color(i, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE);
|
||||||
lv_obj_set_style_local_bg_color(i, LV_OBJ_PART_MAIN, LV_STATE_DISABLED, LV_COLOR_BLACK);
|
lv_obj_set_style_local_bg_color(i, LV_OBJ_PART_MAIN, LV_STATE_DISABLED, LV_COLOR_BLACK);
|
||||||
lv_obj_set_style_local_border_color(i, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE);
|
lv_obj_set_style_local_border_color(i, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE);
|
||||||
|
|
|
@ -30,7 +30,7 @@ namespace Pinetime {
|
||||||
|
|
||||||
lv_obj_t *bpmArc, *bpmTap, *bpmValue;
|
lv_obj_t *bpmArc, *bpmTap, *bpmValue;
|
||||||
lv_obj_t *bpbDropdown, *currentBpbText;
|
lv_obj_t *bpbDropdown, *currentBpbText;
|
||||||
lv_obj_t *playPause;
|
lv_obj_t* playPause;
|
||||||
|
|
||||||
lv_task_t* taskRefresh;
|
lv_task_t* taskRefresh;
|
||||||
};
|
};
|
||||||
|
|
|
@ -198,12 +198,12 @@ Notifications::NotificationItem::NotificationItem(const char* title,
|
||||||
|
|
||||||
lv_obj_t* alert_type = lv_label_create(lv_scr_act(), nullptr);
|
lv_obj_t* alert_type = lv_label_create(lv_scr_act(), nullptr);
|
||||||
lv_obj_set_style_local_text_color(alert_type, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_MAKE(0xb0, 0xb0, 0xb0));
|
lv_obj_set_style_local_text_color(alert_type, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_MAKE(0xb0, 0xb0, 0xb0));
|
||||||
if(title == nullptr) {
|
if (title == nullptr) {
|
||||||
lv_label_set_text_static(alert_type, "Notification");
|
lv_label_set_text_static(alert_type, "Notification");
|
||||||
} else {
|
} else {
|
||||||
// copy title to label and replace newlines with spaces
|
// copy title to label and replace newlines with spaces
|
||||||
lv_label_set_text(alert_type, title);
|
lv_label_set_text(alert_type, title);
|
||||||
char *pchar = strchr(lv_label_get_text(alert_type), '\n');
|
char* pchar = strchr(lv_label_get_text(alert_type), '\n');
|
||||||
while (pchar != nullptr) {
|
while (pchar != nullptr) {
|
||||||
*pchar = ' ';
|
*pchar = ' ';
|
||||||
pchar = strchr(pchar + 1, '\n');
|
pchar = strchr(pchar + 1, '\n');
|
||||||
|
|
|
@ -53,7 +53,7 @@ void Paddle::Refresh() {
|
||||||
if (ballX >= LV_HOR_RES - ballSize - 1) {
|
if (ballX >= LV_HOR_RES - ballSize - 1) {
|
||||||
dx *= -1;
|
dx *= -1;
|
||||||
dy += rand() % 3 - 1; // add a little randomization in wall bounce direction, one of [-1, 0, 1]
|
dy += rand() % 3 - 1; // add a little randomization in wall bounce direction, one of [-1, 0, 1]
|
||||||
if (dy > 5) { // limit dy to be in range [-5 to 5]
|
if (dy > 5) { // limit dy to be in range [-5 to 5]
|
||||||
dy = 5;
|
dy = 5;
|
||||||
}
|
}
|
||||||
if (dy < -5) {
|
if (dy < -5) {
|
||||||
|
|
|
@ -14,4 +14,3 @@ PassKey::PassKey(Pinetime::Applications::DisplayApp* app, uint32_t key) : Screen
|
||||||
PassKey::~PassKey() {
|
PassKey::~PassKey() {
|
||||||
lv_obj_clean(lv_scr_act());
|
lv_obj_clean(lv_scr_act());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,8 +17,12 @@ namespace Pinetime {
|
||||||
uint8_t initScreen,
|
uint8_t initScreen,
|
||||||
const std::array<std::function<std::unique_ptr<Screen>()>, N>&& screens,
|
const std::array<std::function<std::unique_ptr<Screen>()>, N>&& screens,
|
||||||
ScreenListModes mode)
|
ScreenListModes mode)
|
||||||
: Screen(app), initScreen {initScreen}, screens {std::move(screens)}, mode {mode}, screenIndex{initScreen}, current {this->screens[initScreen]()} {
|
: Screen(app),
|
||||||
|
initScreen {initScreen},
|
||||||
|
screens {std::move(screens)},
|
||||||
|
mode {mode},
|
||||||
|
screenIndex {initScreen},
|
||||||
|
current {this->screens[initScreen]()} {
|
||||||
}
|
}
|
||||||
|
|
||||||
ScreenList(const ScreenList&) = delete;
|
ScreenList(const ScreenList&) = delete;
|
||||||
|
|
|
@ -166,8 +166,12 @@ void StopWatch::stopLapBtnEventHandler(lv_event_t event) {
|
||||||
lapBuffer.addLaps(currentTimeSeparated);
|
lapBuffer.addLaps(currentTimeSeparated);
|
||||||
lapNr++;
|
lapNr++;
|
||||||
if (lapBuffer[1]) {
|
if (lapBuffer[1]) {
|
||||||
lv_label_set_text_fmt(
|
lv_label_set_text_fmt(lapOneText,
|
||||||
lapOneText, "#%2d %2d:%02d.%02d", (lapNr - 1), lapBuffer[1]->mins, lapBuffer[1]->secs, lapBuffer[1]->hundredths);
|
"#%2d %2d:%02d.%02d",
|
||||||
|
(lapNr - 1),
|
||||||
|
lapBuffer[1]->mins,
|
||||||
|
lapBuffer[1]->secs,
|
||||||
|
lapBuffer[1]->hundredths);
|
||||||
}
|
}
|
||||||
if (lapBuffer[0]) {
|
if (lapBuffer[0]) {
|
||||||
lv_label_set_text_fmt(lapTwoText, "#%2d %2d:%02d.%02d", lapNr, lapBuffer[0]->mins, lapBuffer[0]->secs, lapBuffer[0]->hundredths);
|
lv_label_set_text_fmt(lapTwoText, "#%2d %2d:%02d.%02d", lapNr, lapBuffer[0]->mins, lapBuffer[0]->secs, lapBuffer[0]->hundredths);
|
||||||
|
|
|
@ -120,7 +120,8 @@ void Tile::UpdateScreen() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Tile::OnValueChangedEvent(lv_obj_t* obj, uint32_t buttonId) {
|
void Tile::OnValueChangedEvent(lv_obj_t* obj, uint32_t buttonId) {
|
||||||
if(obj != btnm1) return;
|
if (obj != btnm1)
|
||||||
|
return;
|
||||||
|
|
||||||
app->StartApp(apps[buttonId], DisplayApp::FullRefreshDirections::Up);
|
app->StartApp(apps[buttonId], DisplayApp::FullRefreshDirections::Up);
|
||||||
running = false;
|
running = false;
|
||||||
|
|
|
@ -12,35 +12,33 @@ LV_IMG_DECLARE(bg_clock);
|
||||||
using namespace Pinetime::Applications::Screens;
|
using namespace Pinetime::Applications::Screens;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
constexpr int16_t HourLength = 70;
|
constexpr int16_t HourLength = 70;
|
||||||
constexpr int16_t MinuteLength = 90;
|
constexpr int16_t MinuteLength = 90;
|
||||||
constexpr int16_t SecondLength = 110;
|
constexpr int16_t SecondLength = 110;
|
||||||
|
|
||||||
// sin(90) = 1 so the value of _lv_trigo_sin(90) is the scaling factor
|
// sin(90) = 1 so the value of _lv_trigo_sin(90) is the scaling factor
|
||||||
const auto LV_TRIG_SCALE = _lv_trigo_sin(90);
|
const auto LV_TRIG_SCALE = _lv_trigo_sin(90);
|
||||||
|
|
||||||
int16_t Cosine(int16_t angle) {
|
int16_t Cosine(int16_t angle) {
|
||||||
return _lv_trigo_sin(angle + 90);
|
return _lv_trigo_sin(angle + 90);
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t Sine(int16_t angle) {
|
int16_t Sine(int16_t angle) {
|
||||||
return _lv_trigo_sin(angle);
|
return _lv_trigo_sin(angle);
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t CoordinateXRelocate(int16_t x) {
|
int16_t CoordinateXRelocate(int16_t x) {
|
||||||
return (x + LV_HOR_RES / 2);
|
return (x + LV_HOR_RES / 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t CoordinateYRelocate(int16_t y) {
|
int16_t CoordinateYRelocate(int16_t y) {
|
||||||
return std::abs(y - LV_HOR_RES / 2);
|
return std::abs(y - LV_HOR_RES / 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
lv_point_t CoordinateRelocate(int16_t radius, int16_t angle) {
|
lv_point_t CoordinateRelocate(int16_t radius, int16_t angle) {
|
||||||
return lv_point_t{
|
return lv_point_t {.x = CoordinateXRelocate(radius * static_cast<int32_t>(Sine(angle)) / LV_TRIG_SCALE),
|
||||||
.x = CoordinateXRelocate(radius * static_cast<int32_t>(Sine(angle)) / LV_TRIG_SCALE),
|
.y = CoordinateYRelocate(radius * static_cast<int32_t>(Cosine(angle)) / LV_TRIG_SCALE)};
|
||||||
.y = CoordinateYRelocate(radius * static_cast<int32_t>(Cosine(angle)) / LV_TRIG_SCALE)
|
}
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -160,11 +160,19 @@ void WatchFaceDigital::Refresh() {
|
||||||
|
|
||||||
if ((year != currentYear) || (month != currentMonth) || (dayOfWeek != currentDayOfWeek) || (day != currentDay)) {
|
if ((year != currentYear) || (month != currentMonth) || (dayOfWeek != currentDayOfWeek) || (day != currentDay)) {
|
||||||
if (settingsController.GetClockType() == Controllers::Settings::ClockType::H24) {
|
if (settingsController.GetClockType() == Controllers::Settings::ClockType::H24) {
|
||||||
lv_label_set_text_fmt(
|
lv_label_set_text_fmt(label_date,
|
||||||
label_date, "%s %d %s %d", dateTimeController.DayOfWeekShortToString(), day, dateTimeController.MonthShortToString(), year);
|
"%s %d %s %d",
|
||||||
|
dateTimeController.DayOfWeekShortToString(),
|
||||||
|
day,
|
||||||
|
dateTimeController.MonthShortToString(),
|
||||||
|
year);
|
||||||
} else {
|
} else {
|
||||||
lv_label_set_text_fmt(
|
lv_label_set_text_fmt(label_date,
|
||||||
label_date, "%s %s %d %d", dateTimeController.DayOfWeekShortToString(), dateTimeController.MonthShortToString(), day, year);
|
"%s %s %d %d",
|
||||||
|
dateTimeController.DayOfWeekShortToString(),
|
||||||
|
dateTimeController.MonthShortToString(),
|
||||||
|
day,
|
||||||
|
year);
|
||||||
}
|
}
|
||||||
lv_obj_realign(label_date);
|
lv_obj_realign(label_date);
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ namespace {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsBleIconVisible(bool isRadioEnabled, bool isConnected) {
|
bool IsBleIconVisible(bool isRadioEnabled, bool isConnected) {
|
||||||
if(!isRadioEnabled) {
|
if (!isRadioEnabled) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return isConnected;
|
return isConnected;
|
||||||
|
@ -52,12 +52,12 @@ namespace {
|
||||||
}
|
}
|
||||||
|
|
||||||
WatchFacePineTimeStyle::WatchFacePineTimeStyle(DisplayApp* app,
|
WatchFacePineTimeStyle::WatchFacePineTimeStyle(DisplayApp* app,
|
||||||
Controllers::DateTime& dateTimeController,
|
Controllers::DateTime& dateTimeController,
|
||||||
Controllers::Battery& batteryController,
|
Controllers::Battery& batteryController,
|
||||||
Controllers::Ble& bleController,
|
Controllers::Ble& bleController,
|
||||||
Controllers::NotificationManager& notificatioManager,
|
Controllers::NotificationManager& notificatioManager,
|
||||||
Controllers::Settings& settingsController,
|
Controllers::Settings& settingsController,
|
||||||
Controllers::MotionController& motionController)
|
Controllers::MotionController& motionController)
|
||||||
: Screen(app),
|
: Screen(app),
|
||||||
currentDateTime {{}},
|
currentDateTime {{}},
|
||||||
dateTimeController {dateTimeController},
|
dateTimeController {dateTimeController},
|
||||||
|
|
|
@ -25,12 +25,12 @@ namespace Pinetime {
|
||||||
class WatchFacePineTimeStyle : public Screen {
|
class WatchFacePineTimeStyle : public Screen {
|
||||||
public:
|
public:
|
||||||
WatchFacePineTimeStyle(DisplayApp* app,
|
WatchFacePineTimeStyle(DisplayApp* app,
|
||||||
Controllers::DateTime& dateTimeController,
|
Controllers::DateTime& dateTimeController,
|
||||||
Controllers::Battery& batteryController,
|
Controllers::Battery& batteryController,
|
||||||
Controllers::Ble& bleController,
|
Controllers::Ble& bleController,
|
||||||
Controllers::NotificationManager& notificatioManager,
|
Controllers::NotificationManager& notificatioManager,
|
||||||
Controllers::Settings& settingsController,
|
Controllers::Settings& settingsController,
|
||||||
Controllers::MotionController& motionController);
|
Controllers::MotionController& motionController);
|
||||||
~WatchFacePineTimeStyle() override;
|
~WatchFacePineTimeStyle() override;
|
||||||
|
|
||||||
bool OnTouchEvent(TouchEvents event) override;
|
bool OnTouchEvent(TouchEvents event) override;
|
||||||
|
@ -38,7 +38,7 @@ namespace Pinetime {
|
||||||
|
|
||||||
void Refresh() override;
|
void Refresh() override;
|
||||||
|
|
||||||
void UpdateSelected(lv_obj_t *object, lv_event_t event);
|
void UpdateSelected(lv_obj_t* object, lv_event_t event);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint8_t displayedHour = -1;
|
uint8_t displayedHour = -1;
|
||||||
|
|
|
@ -89,7 +89,7 @@ void WatchFaceTerminal::Refresh() {
|
||||||
bleState = bleController.IsConnected();
|
bleState = bleController.IsConnected();
|
||||||
bleRadioEnabled = bleController.IsRadioEnabled();
|
bleRadioEnabled = bleController.IsRadioEnabled();
|
||||||
if (bleState.IsUpdated() || bleRadioEnabled.IsUpdated()) {
|
if (bleState.IsUpdated() || bleRadioEnabled.IsUpdated()) {
|
||||||
if(!bleRadioEnabled.Get()) {
|
if (!bleRadioEnabled.Get()) {
|
||||||
lv_label_set_text_static(connectState, "[STAT]#0082fc Disabled#");
|
lv_label_set_text_static(connectState, "[STAT]#0082fc Disabled#");
|
||||||
} else {
|
} else {
|
||||||
if (bleState.Get()) {
|
if (bleState.Get()) {
|
||||||
|
|
|
@ -44,7 +44,7 @@ QuickSettings::QuickSettings(Pinetime::Applications::DisplayApp* app,
|
||||||
static constexpr uint8_t barHeight = 20 + innerDistance;
|
static constexpr uint8_t barHeight = 20 + innerDistance;
|
||||||
static constexpr uint8_t buttonHeight = (LV_VER_RES_MAX - barHeight - innerDistance) / 2;
|
static constexpr uint8_t buttonHeight = (LV_VER_RES_MAX - barHeight - innerDistance) / 2;
|
||||||
static constexpr uint8_t buttonWidth = (LV_HOR_RES_MAX - innerDistance) / 2; // wide buttons
|
static constexpr uint8_t buttonWidth = (LV_HOR_RES_MAX - innerDistance) / 2; // wide buttons
|
||||||
//static constexpr uint8_t buttonWidth = buttonHeight; // square buttons
|
// static constexpr uint8_t buttonWidth = buttonHeight; // square buttons
|
||||||
static constexpr uint8_t buttonXOffset = (LV_HOR_RES_MAX - buttonWidth * 2 - innerDistance) / 2;
|
static constexpr uint8_t buttonXOffset = (LV_HOR_RES_MAX - buttonWidth * 2 - innerDistance) / 2;
|
||||||
|
|
||||||
lv_style_init(&btn_style);
|
lv_style_init(&btn_style);
|
||||||
|
@ -67,7 +67,7 @@ QuickSettings::QuickSettings(Pinetime::Applications::DisplayApp* app,
|
||||||
lv_obj_set_event_cb(btn2, ButtonEventHandler);
|
lv_obj_set_event_cb(btn2, ButtonEventHandler);
|
||||||
lv_obj_add_style(btn2, LV_BTN_PART_MAIN, &btn_style);
|
lv_obj_add_style(btn2, LV_BTN_PART_MAIN, &btn_style);
|
||||||
lv_obj_set_size(btn2, buttonWidth, buttonHeight);
|
lv_obj_set_size(btn2, buttonWidth, buttonHeight);
|
||||||
lv_obj_align(btn2, nullptr, LV_ALIGN_IN_TOP_RIGHT, - buttonXOffset, barHeight);
|
lv_obj_align(btn2, nullptr, LV_ALIGN_IN_TOP_RIGHT, -buttonXOffset, barHeight);
|
||||||
|
|
||||||
lv_obj_t* lbl_btn;
|
lv_obj_t* lbl_btn;
|
||||||
lbl_btn = lv_label_create(btn2, nullptr);
|
lbl_btn = lv_label_create(btn2, nullptr);
|
||||||
|
@ -98,7 +98,7 @@ QuickSettings::QuickSettings(Pinetime::Applications::DisplayApp* app,
|
||||||
lv_obj_set_event_cb(btn4, ButtonEventHandler);
|
lv_obj_set_event_cb(btn4, ButtonEventHandler);
|
||||||
lv_obj_add_style(btn4, LV_BTN_PART_MAIN, &btn_style);
|
lv_obj_add_style(btn4, LV_BTN_PART_MAIN, &btn_style);
|
||||||
lv_obj_set_size(btn4, buttonWidth, buttonHeight);
|
lv_obj_set_size(btn4, buttonWidth, buttonHeight);
|
||||||
lv_obj_align(btn4, nullptr, LV_ALIGN_IN_BOTTOM_RIGHT, - buttonXOffset, 0);
|
lv_obj_align(btn4, nullptr, LV_ALIGN_IN_BOTTOM_RIGHT, -buttonXOffset, 0);
|
||||||
|
|
||||||
lbl_btn = lv_label_create(btn4, nullptr);
|
lbl_btn = lv_label_create(btn4, nullptr);
|
||||||
lv_obj_set_style_local_text_font(lbl_btn, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &lv_font_sys_48);
|
lv_obj_set_style_local_text_font(lbl_btn, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &lv_font_sys_48);
|
||||||
|
|
|
@ -90,4 +90,3 @@ void SettingBluetooth::OnBluetoothEnabled(lv_obj_t* object, lv_event_t event) {
|
||||||
settingsController.SetBleRadioEnabled(true);
|
settingsController.SetBleRadioEnabled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ SettingDisplay::SettingDisplay(Pinetime::Applications::DisplayApp* app, Pinetime
|
||||||
char buffer[12];
|
char buffer[12];
|
||||||
for (unsigned int i = 0; i < options.size(); i++) {
|
for (unsigned int i = 0; i < options.size(); i++) {
|
||||||
cbOption[i] = lv_checkbox_create(container1, nullptr);
|
cbOption[i] = lv_checkbox_create(container1, nullptr);
|
||||||
sprintf(buffer, "%3d seconds", options[i] / 1000);
|
sprintf(buffer, "%3d seconds", options[i] / 1000);
|
||||||
lv_checkbox_set_text(cbOption[i], buffer);
|
lv_checkbox_set_text(cbOption[i], buffer);
|
||||||
cbOption[i]->user_data = this;
|
cbOption[i]->user_data = this;
|
||||||
lv_obj_set_event_cb(cbOption[i], event_handler);
|
lv_obj_set_event_cb(cbOption[i], event_handler);
|
||||||
|
|
|
@ -15,23 +15,22 @@ namespace {
|
||||||
constexpr int16_t POS_Y_TEXT = -6;
|
constexpr int16_t POS_Y_TEXT = -6;
|
||||||
constexpr int16_t POS_Y_MINUS = 40;
|
constexpr int16_t POS_Y_MINUS = 40;
|
||||||
|
|
||||||
void event_handler(lv_obj_t * obj, lv_event_t event) {
|
void event_handler(lv_obj_t* obj, lv_event_t event) {
|
||||||
auto* screen = static_cast<SettingSetDate *>(obj->user_data);
|
auto* screen = static_cast<SettingSetDate*>(obj->user_data);
|
||||||
screen->HandleButtonPress(obj, event);
|
screen->HandleButtonPress(obj, event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SettingSetDate::SettingSetDate(Pinetime::Applications::DisplayApp *app, Pinetime::Controllers::DateTime &dateTimeController) :
|
SettingSetDate::SettingSetDate(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::DateTime& dateTimeController)
|
||||||
Screen(app),
|
: Screen(app), dateTimeController {dateTimeController} {
|
||||||
dateTimeController {dateTimeController} {
|
lv_obj_t* title = lv_label_create(lv_scr_act(), nullptr);
|
||||||
lv_obj_t * title = lv_label_create(lv_scr_act(), nullptr);
|
|
||||||
lv_label_set_text_static(title, "Set current date");
|
lv_label_set_text_static(title, "Set current date");
|
||||||
lv_label_set_align(title, LV_LABEL_ALIGN_CENTER);
|
lv_label_set_align(title, LV_LABEL_ALIGN_CENTER);
|
||||||
lv_obj_align(title, lv_scr_act(), LV_ALIGN_IN_TOP_MID, 15, 15);
|
lv_obj_align(title, lv_scr_act(), LV_ALIGN_IN_TOP_MID, 15, 15);
|
||||||
|
|
||||||
lv_obj_t * icon = lv_label_create(lv_scr_act(), nullptr);
|
lv_obj_t* icon = lv_label_create(lv_scr_act(), nullptr);
|
||||||
lv_obj_set_style_local_text_color(icon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_ORANGE);
|
lv_obj_set_style_local_text_color(icon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_ORANGE);
|
||||||
|
|
||||||
lv_label_set_text_static(icon, Symbols::clock);
|
lv_label_set_text_static(icon, Symbols::clock);
|
||||||
lv_label_set_align(icon, LV_LABEL_ALIGN_CENTER);
|
lv_label_set_align(icon, LV_LABEL_ALIGN_CENTER);
|
||||||
lv_obj_align(icon, title, LV_ALIGN_OUT_LEFT_MID, -10, 0);
|
lv_obj_align(icon, title, LV_ALIGN_OUT_LEFT_MID, -10, 0);
|
||||||
|
@ -113,7 +112,7 @@ SettingSetDate::~SettingSetDate() {
|
||||||
lv_obj_clean(lv_scr_act());
|
lv_obj_clean(lv_scr_act());
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingSetDate::HandleButtonPress(lv_obj_t *object, lv_event_t event) {
|
void SettingSetDate::HandleButtonPress(lv_obj_t* object, lv_event_t event) {
|
||||||
if (event != LV_EVENT_CLICKED)
|
if (event != LV_EVENT_CLICKED)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -194,5 +193,6 @@ void SettingSetDate::CheckDay() {
|
||||||
|
|
||||||
void SettingSetDate::UpdateMonthLabel() {
|
void SettingSetDate::UpdateMonthLabel() {
|
||||||
lv_label_set_text_static(
|
lv_label_set_text_static(
|
||||||
lblMonth, Pinetime::Controllers::DateTime::MonthShortToStringLow(static_cast<Pinetime::Controllers::DateTime::Months>(monthValue)));
|
lblMonth,
|
||||||
|
Pinetime::Controllers::DateTime::MonthShortToStringLow(static_cast<Pinetime::Controllers::DateTime::Months>(monthValue)));
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,33 +8,33 @@
|
||||||
namespace Pinetime {
|
namespace Pinetime {
|
||||||
namespace Applications {
|
namespace Applications {
|
||||||
namespace Screens {
|
namespace Screens {
|
||||||
class SettingSetDate : public Screen{
|
class SettingSetDate : public Screen {
|
||||||
public:
|
public:
|
||||||
SettingSetDate(DisplayApp* app, Pinetime::Controllers::DateTime &dateTimeController);
|
SettingSetDate(DisplayApp* app, Pinetime::Controllers::DateTime& dateTimeController);
|
||||||
~SettingSetDate() override;
|
~SettingSetDate() override;
|
||||||
|
|
||||||
void HandleButtonPress(lv_obj_t *object, lv_event_t event);
|
void HandleButtonPress(lv_obj_t* object, lv_event_t event);
|
||||||
|
|
||||||
private:
|
|
||||||
Controllers::DateTime& dateTimeController;
|
|
||||||
|
|
||||||
int dayValue;
|
private:
|
||||||
int monthValue;
|
Controllers::DateTime& dateTimeController;
|
||||||
int yearValue;
|
|
||||||
lv_obj_t * lblDay;
|
|
||||||
lv_obj_t * lblMonth;
|
|
||||||
lv_obj_t * lblYear;
|
|
||||||
lv_obj_t * btnDayPlus;
|
|
||||||
lv_obj_t * btnDayMinus;
|
|
||||||
lv_obj_t * btnMonthPlus;
|
|
||||||
lv_obj_t * btnMonthMinus;
|
|
||||||
lv_obj_t * btnYearPlus;
|
|
||||||
lv_obj_t * btnYearMinus;
|
|
||||||
lv_obj_t * btnSetTime;
|
|
||||||
|
|
||||||
int MaximumDayOfMonth() const;
|
int dayValue;
|
||||||
void CheckDay();
|
int monthValue;
|
||||||
void UpdateMonthLabel();
|
int yearValue;
|
||||||
|
lv_obj_t* lblDay;
|
||||||
|
lv_obj_t* lblMonth;
|
||||||
|
lv_obj_t* lblYear;
|
||||||
|
lv_obj_t* btnDayPlus;
|
||||||
|
lv_obj_t* btnDayMinus;
|
||||||
|
lv_obj_t* btnMonthPlus;
|
||||||
|
lv_obj_t* btnMonthMinus;
|
||||||
|
lv_obj_t* btnYearPlus;
|
||||||
|
lv_obj_t* btnYearMinus;
|
||||||
|
lv_obj_t* btnSetTime;
|
||||||
|
|
||||||
|
int MaximumDayOfMonth() const;
|
||||||
|
void CheckDay();
|
||||||
|
void UpdateMonthLabel();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,9 +64,9 @@ SettingShakeThreshold::SettingShakeThreshold(DisplayApp* app,
|
||||||
vDecay = xTaskGetTickCount();
|
vDecay = xTaskGetTickCount();
|
||||||
calibrating = false;
|
calibrating = false;
|
||||||
EnableForCal = false;
|
EnableForCal = false;
|
||||||
if(!settingsController.isWakeUpModeOn(Pinetime::Controllers::Settings::WakeUpMode::Shake)){
|
if (!settingsController.isWakeUpModeOn(Pinetime::Controllers::Settings::WakeUpMode::Shake)) {
|
||||||
EnableForCal = true;
|
EnableForCal = true;
|
||||||
settingsController.setWakeUpMode(Pinetime::Controllers::Settings::WakeUpMode::Shake,true);
|
settingsController.setWakeUpMode(Pinetime::Controllers::Settings::WakeUpMode::Shake, true);
|
||||||
}
|
}
|
||||||
refreshTask = lv_task_create(RefreshTaskCallback, LV_DISP_DEF_REFR_PERIOD, LV_TASK_PRIO_MID, this);
|
refreshTask = lv_task_create(RefreshTaskCallback, LV_DISP_DEF_REFR_PERIOD, LV_TASK_PRIO_MID, this);
|
||||||
}
|
}
|
||||||
|
@ -74,8 +74,8 @@ SettingShakeThreshold::SettingShakeThreshold(DisplayApp* app,
|
||||||
SettingShakeThreshold::~SettingShakeThreshold() {
|
SettingShakeThreshold::~SettingShakeThreshold() {
|
||||||
settingsController.SetShakeThreshold(lv_arc_get_value(positionArc));
|
settingsController.SetShakeThreshold(lv_arc_get_value(positionArc));
|
||||||
|
|
||||||
if(EnableForCal){
|
if (EnableForCal) {
|
||||||
settingsController.setWakeUpMode(Pinetime::Controllers::Settings::WakeUpMode::Shake,false);
|
settingsController.setWakeUpMode(Pinetime::Controllers::Settings::WakeUpMode::Shake, false);
|
||||||
EnableForCal = false;
|
EnableForCal = false;
|
||||||
}
|
}
|
||||||
lv_task_del(refreshTask);
|
lv_task_del(refreshTask);
|
||||||
|
|
|
@ -28,8 +28,8 @@ namespace Pinetime {
|
||||||
System::SystemTask& systemTask;
|
System::SystemTask& systemTask;
|
||||||
uint8_t calibrating;
|
uint8_t calibrating;
|
||||||
bool EnableForCal;
|
bool EnableForCal;
|
||||||
uint32_t vDecay,vCalTime;
|
uint32_t vDecay, vCalTime;
|
||||||
lv_obj_t *positionArc, *animArc,*calButton, *calLabel;
|
lv_obj_t *positionArc, *animArc, *calButton, *calLabel;
|
||||||
lv_task_t* refreshTask;
|
lv_task_t* refreshTask;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,15 +12,12 @@ namespace {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SettingSteps::SettingSteps(
|
SettingSteps::SettingSteps(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Settings& settingsController)
|
||||||
Pinetime::Applications::DisplayApp *app, Pinetime::Controllers::Settings &settingsController) :
|
: Screen(app), settingsController {settingsController} {
|
||||||
Screen(app),
|
|
||||||
settingsController{settingsController}
|
|
||||||
{
|
|
||||||
|
|
||||||
lv_obj_t * container1 = lv_cont_create(lv_scr_act(), nullptr);
|
lv_obj_t* container1 = lv_cont_create(lv_scr_act(), nullptr);
|
||||||
|
|
||||||
//lv_obj_set_style_local_bg_color(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x111111));
|
// lv_obj_set_style_local_bg_color(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x111111));
|
||||||
lv_obj_set_style_local_bg_opa(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_TRANSP);
|
lv_obj_set_style_local_bg_opa(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_TRANSP);
|
||||||
lv_obj_set_style_local_pad_all(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, 10);
|
lv_obj_set_style_local_pad_all(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, 10);
|
||||||
lv_obj_set_style_local_pad_inner(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, 5);
|
lv_obj_set_style_local_pad_inner(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, 5);
|
||||||
|
@ -31,13 +28,13 @@ SettingSteps::SettingSteps(
|
||||||
lv_cont_set_layout(container1, LV_LAYOUT_COLUMN_LEFT);
|
lv_cont_set_layout(container1, LV_LAYOUT_COLUMN_LEFT);
|
||||||
|
|
||||||
lv_obj_t* title = lv_label_create(lv_scr_act(), nullptr);
|
lv_obj_t* title = lv_label_create(lv_scr_act(), nullptr);
|
||||||
lv_label_set_text_static(title,"Daily steps goal");
|
lv_label_set_text_static(title, "Daily steps goal");
|
||||||
lv_label_set_align(title, LV_LABEL_ALIGN_CENTER);
|
lv_label_set_align(title, LV_LABEL_ALIGN_CENTER);
|
||||||
lv_obj_align(title, lv_scr_act(), LV_ALIGN_IN_TOP_MID, 15, 15);
|
lv_obj_align(title, lv_scr_act(), LV_ALIGN_IN_TOP_MID, 15, 15);
|
||||||
|
|
||||||
lv_obj_t* icon = lv_label_create(lv_scr_act(), nullptr);
|
lv_obj_t* icon = lv_label_create(lv_scr_act(), nullptr);
|
||||||
lv_obj_set_style_local_text_color(icon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_ORANGE);
|
lv_obj_set_style_local_text_color(icon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_ORANGE);
|
||||||
|
|
||||||
lv_label_set_text_static(icon, Symbols::shoe);
|
lv_label_set_text_static(icon, Symbols::shoe);
|
||||||
lv_label_set_align(icon, LV_LABEL_ALIGN_CENTER);
|
lv_label_set_align(icon, LV_LABEL_ALIGN_CENTER);
|
||||||
lv_obj_align(icon, title, LV_ALIGN_OUT_LEFT_MID, -10, 0);
|
lv_obj_align(icon, title, LV_ALIGN_OUT_LEFT_MID, -10, 0);
|
||||||
|
@ -61,7 +58,6 @@ SettingSteps::SettingSteps(
|
||||||
lv_obj_set_event_cb(btnMinus, event_handler);
|
lv_obj_set_event_cb(btnMinus, event_handler);
|
||||||
lv_obj_align(btnMinus, lv_scr_act(), LV_ALIGN_CENTER, -55, 80);
|
lv_obj_align(btnMinus, lv_scr_act(), LV_ALIGN_CENTER, -55, 80);
|
||||||
lv_obj_set_style_local_value_str(btnMinus, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, "-");
|
lv_obj_set_style_local_value_str(btnMinus, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, "-");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SettingSteps::~SettingSteps() {
|
SettingSteps::~SettingSteps() {
|
||||||
|
@ -69,24 +65,23 @@ SettingSteps::~SettingSteps() {
|
||||||
settingsController.SaveSettings();
|
settingsController.SaveSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingSteps::UpdateSelected(lv_obj_t *object, lv_event_t event) {
|
void SettingSteps::UpdateSelected(lv_obj_t* object, lv_event_t event) {
|
||||||
uint32_t value = settingsController.GetStepsGoal();
|
uint32_t value = settingsController.GetStepsGoal();
|
||||||
if(object == btnPlus && (event == LV_EVENT_PRESSED)) {
|
if (object == btnPlus && (event == LV_EVENT_PRESSED)) {
|
||||||
value += 1000;
|
value += 1000;
|
||||||
if ( value <= 500000 ) {
|
if (value <= 500000) {
|
||||||
settingsController.SetStepsGoal(value);
|
settingsController.SetStepsGoal(value);
|
||||||
lv_label_set_text_fmt(stepValue, "%lu", settingsController.GetStepsGoal());
|
lv_label_set_text_fmt(stepValue, "%lu", settingsController.GetStepsGoal());
|
||||||
lv_obj_align(stepValue, lv_scr_act(), LV_ALIGN_CENTER, 0, -10);
|
lv_obj_align(stepValue, lv_scr_act(), LV_ALIGN_CENTER, 0, -10);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(object == btnMinus && (event == LV_EVENT_PRESSED)) {
|
if (object == btnMinus && (event == LV_EVENT_PRESSED)) {
|
||||||
value -= 1000;
|
value -= 1000;
|
||||||
if ( value >= 1000 ) {
|
if (value >= 1000) {
|
||||||
settingsController.SetStepsGoal(value);
|
settingsController.SetStepsGoal(value);
|
||||||
lv_label_set_text_fmt(stepValue, "%lu", settingsController.GetStepsGoal());
|
lv_label_set_text_fmt(stepValue, "%lu", settingsController.GetStepsGoal());
|
||||||
lv_obj_align(stepValue, lv_scr_act(), LV_ALIGN_CENTER, 0, -10);
|
lv_obj_align(stepValue, lv_scr_act(), LV_ALIGN_CENTER, 0, -10);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,18 +13,19 @@ Settings::Settings(Pinetime::Applications::DisplayApp* app, Pinetime::Controller
|
||||||
settingsController {settingsController},
|
settingsController {settingsController},
|
||||||
screens {app,
|
screens {app,
|
||||||
settingsController.GetSettingsMenu(),
|
settingsController.GetSettingsMenu(),
|
||||||
{[this]() -> std::unique_ptr<Screen> {
|
{
|
||||||
return CreateScreen1();
|
[this]() -> std::unique_ptr<Screen> {
|
||||||
},
|
return CreateScreen1();
|
||||||
[this]() -> std::unique_ptr<Screen> {
|
},
|
||||||
return CreateScreen2();
|
[this]() -> std::unique_ptr<Screen> {
|
||||||
},
|
return CreateScreen2();
|
||||||
[this]() -> std::unique_ptr<Screen> {
|
},
|
||||||
return CreateScreen3();
|
[this]() -> std::unique_ptr<Screen> {
|
||||||
},
|
return CreateScreen3();
|
||||||
[this]() -> std::unique_ptr<Screen> {
|
},
|
||||||
return CreateScreen4();
|
[this]() -> std::unique_ptr<Screen> {
|
||||||
},
|
return CreateScreen4();
|
||||||
|
},
|
||||||
},
|
},
|
||||||
Screens::ScreenListModes::UpDown} {
|
Screens::ScreenListModes::UpDown} {
|
||||||
}
|
}
|
||||||
|
@ -53,7 +54,8 @@ std::unique_ptr<Screen> Settings::CreateScreen2() {
|
||||||
{Symbols::shoe, "Steps", Apps::SettingSteps},
|
{Symbols::shoe, "Steps", Apps::SettingSteps},
|
||||||
{Symbols::clock, "Set date", Apps::SettingSetDate},
|
{Symbols::clock, "Set date", Apps::SettingSetDate},
|
||||||
{Symbols::clock, "Set time", Apps::SettingSetTime},
|
{Symbols::clock, "Set time", Apps::SettingSetTime},
|
||||||
{Symbols::batteryHalf, "Battery", Apps::BatteryInfo}}};
|
{Symbols::batteryHalf, "Battery", Apps::BatteryInfo},
|
||||||
|
}};
|
||||||
|
|
||||||
return std::make_unique<Screens::List>(1, 4, app, settingsController, applications);
|
return std::make_unique<Screens::List>(1, 4, app, settingsController, applications);
|
||||||
}
|
}
|
||||||
|
@ -64,7 +66,7 @@ std::unique_ptr<Screen> Settings::CreateScreen3() {
|
||||||
{Symbols::clock, "Chimes", Apps::SettingChimes},
|
{Symbols::clock, "Chimes", Apps::SettingChimes},
|
||||||
{Symbols::tachometer, "Shake Calib.", Apps::SettingShakeThreshold},
|
{Symbols::tachometer, "Shake Calib.", Apps::SettingShakeThreshold},
|
||||||
{Symbols::check, "Firmware", Apps::FirmwareValidation},
|
{Symbols::check, "Firmware", Apps::FirmwareValidation},
|
||||||
{Symbols::bluetooth, "Bluetooth", Apps::SettingBluetooth}
|
{Symbols::bluetooth, "Bluetooth", Apps::SettingBluetooth},
|
||||||
}};
|
}};
|
||||||
|
|
||||||
return std::make_unique<Screens::List>(2, 4, app, settingsController, applications);
|
return std::make_unique<Screens::List>(2, 4, app, settingsController, applications);
|
||||||
|
@ -76,7 +78,7 @@ std::unique_ptr<Screen> Settings::CreateScreen4() {
|
||||||
{Symbols::list, "About", Apps::SysInfo},
|
{Symbols::list, "About", Apps::SysInfo},
|
||||||
{Symbols::none, "None", Apps::None},
|
{Symbols::none, "None", Apps::None},
|
||||||
{Symbols::none, "None", Apps::None},
|
{Symbols::none, "None", Apps::None},
|
||||||
{Symbols::none, "None", Apps::None}
|
{Symbols::none, "None", Apps::None},
|
||||||
}};
|
}};
|
||||||
|
|
||||||
return std::make_unique<Screens::List>(3, 4, app, settingsController, applications);
|
return std::make_unique<Screens::List>(3, 4, app, settingsController, applications);
|
||||||
|
|
|
@ -42,10 +42,16 @@ void Bma421::Init() {
|
||||||
if (ret != BMA4_OK)
|
if (ret != BMA4_OK)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
switch(bma.chip_id) {
|
switch (bma.chip_id) {
|
||||||
case BMA423_CHIP_ID: deviceType = DeviceTypes::BMA421; break;
|
case BMA423_CHIP_ID:
|
||||||
case BMA425_CHIP_ID: deviceType = DeviceTypes::BMA425; break;
|
deviceType = DeviceTypes::BMA421;
|
||||||
default: deviceType = DeviceTypes::Unknown; break;
|
break;
|
||||||
|
case BMA425_CHIP_ID:
|
||||||
|
deviceType = DeviceTypes::BMA425;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
deviceType = DeviceTypes::Unknown;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = bma423_write_config_file(&bma);
|
ret = bma423_write_config_file(&bma);
|
||||||
|
|
|
@ -6,11 +6,7 @@ namespace Pinetime {
|
||||||
class TwiMaster;
|
class TwiMaster;
|
||||||
class Bma421 {
|
class Bma421 {
|
||||||
public:
|
public:
|
||||||
enum class DeviceTypes : uint8_t {
|
enum class DeviceTypes : uint8_t { Unknown, BMA421, BMA425 };
|
||||||
Unknown,
|
|
||||||
BMA421,
|
|
||||||
BMA425
|
|
||||||
};
|
|
||||||
struct Values {
|
struct Values {
|
||||||
uint32_t steps;
|
uint32_t steps;
|
||||||
int16_t x;
|
int16_t x;
|
||||||
|
|
|
@ -80,14 +80,9 @@ Cst816S::TouchInfos Cst816S::GetTouchInfo() {
|
||||||
Gestures gesture = static_cast<Gestures>(touchData[gestureIndex]);
|
Gestures gesture = static_cast<Gestures>(touchData[gestureIndex]);
|
||||||
|
|
||||||
// Validity check
|
// Validity check
|
||||||
if(x >= maxX || y >= maxY ||
|
if (x >= maxX || y >= maxY ||
|
||||||
(gesture != Gestures::None &&
|
(gesture != Gestures::None && gesture != Gestures::SlideDown && gesture != Gestures::SlideUp && gesture != Gestures::SlideLeft &&
|
||||||
gesture != Gestures::SlideDown &&
|
gesture != Gestures::SlideRight && gesture != Gestures::SingleTap && gesture != Gestures::DoubleTap &&
|
||||||
gesture != Gestures::SlideUp &&
|
|
||||||
gesture != Gestures::SlideLeft &&
|
|
||||||
gesture != Gestures::SlideRight &&
|
|
||||||
gesture != Gestures::SingleTap &&
|
|
||||||
gesture != Gestures::DoubleTap &&
|
|
||||||
gesture != Gestures::LongPress)) {
|
gesture != Gestures::LongPress)) {
|
||||||
info.isValid = false;
|
info.isValid = false;
|
||||||
return info;
|
return info;
|
||||||
|
|
|
@ -44,21 +44,22 @@ namespace Pinetime {
|
||||||
uint8_t GetFwVersion() const {
|
uint8_t GetFwVersion() const {
|
||||||
return fwVersion;
|
return fwVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool CheckDeviceIds();
|
bool CheckDeviceIds();
|
||||||
|
|
||||||
// Unused/Unavailable commented out
|
// Unused/Unavailable commented out
|
||||||
static constexpr uint8_t gestureIndex = 1;
|
static constexpr uint8_t gestureIndex = 1;
|
||||||
static constexpr uint8_t touchPointNumIndex = 2;
|
static constexpr uint8_t touchPointNumIndex = 2;
|
||||||
//static constexpr uint8_t touchEventIndex = 3;
|
// static constexpr uint8_t touchEventIndex = 3;
|
||||||
static constexpr uint8_t touchXHighIndex = 3;
|
static constexpr uint8_t touchXHighIndex = 3;
|
||||||
static constexpr uint8_t touchXLowIndex = 4;
|
static constexpr uint8_t touchXLowIndex = 4;
|
||||||
//static constexpr uint8_t touchIdIndex = 5;
|
// static constexpr uint8_t touchIdIndex = 5;
|
||||||
static constexpr uint8_t touchYHighIndex = 5;
|
static constexpr uint8_t touchYHighIndex = 5;
|
||||||
static constexpr uint8_t touchYLowIndex = 6;
|
static constexpr uint8_t touchYLowIndex = 6;
|
||||||
//static constexpr uint8_t touchStep = 6;
|
// static constexpr uint8_t touchStep = 6;
|
||||||
//static constexpr uint8_t touchXYIndex = 7;
|
// static constexpr uint8_t touchXYIndex = 7;
|
||||||
//static constexpr uint8_t touchMiscIndex = 8;
|
// static constexpr uint8_t touchMiscIndex = 8;
|
||||||
|
|
||||||
static constexpr uint8_t maxX = 240;
|
static constexpr uint8_t maxX = 240;
|
||||||
static constexpr uint8_t maxY = 240;
|
static constexpr uint8_t maxY = 240;
|
||||||
|
|
|
@ -3,18 +3,18 @@
|
||||||
|
|
||||||
namespace Pinetime {
|
namespace Pinetime {
|
||||||
namespace PinMap {
|
namespace PinMap {
|
||||||
|
|
||||||
#ifdef WATCH_P8
|
#ifdef WATCH_P8
|
||||||
// COLMI P8
|
// COLMI P8
|
||||||
static constexpr uint8_t Charging = 19;
|
static constexpr uint8_t Charging = 19;
|
||||||
static constexpr uint8_t Cst816sReset = 13;
|
static constexpr uint8_t Cst816sReset = 13;
|
||||||
static constexpr uint8_t Button = 17;
|
static constexpr uint8_t Button = 17;
|
||||||
#else
|
#else
|
||||||
// Pinetime
|
// Pinetime
|
||||||
static constexpr uint8_t Charging = 12;
|
static constexpr uint8_t Charging = 12;
|
||||||
static constexpr uint8_t Cst816sReset = 10;
|
static constexpr uint8_t Cst816sReset = 10;
|
||||||
static constexpr uint8_t Button = 13;
|
static constexpr uint8_t Button = 13;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static constexpr uint8_t Cst816sIrq = 28;
|
static constexpr uint8_t Cst816sIrq = 28;
|
||||||
static constexpr uint8_t PowerPresent = 19;
|
static constexpr uint8_t PowerPresent = 19;
|
||||||
|
|
|
@ -10,7 +10,7 @@ SpiMaster::SpiMaster(const SpiMaster::SpiModule spi, const SpiMaster::Parameters
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SpiMaster::Init() {
|
bool SpiMaster::Init() {
|
||||||
if(mutex == nullptr) {
|
if (mutex == nullptr) {
|
||||||
mutex = xSemaphoreCreateBinary();
|
mutex = xSemaphoreCreateBinary();
|
||||||
ASSERT(mutex != nullptr);
|
ASSERT(mutex != nullptr);
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,19 +13,13 @@ TwiMaster::TwiMaster(NRF_TWIM_Type* module, uint32_t frequency, uint8_t pinSda,
|
||||||
}
|
}
|
||||||
|
|
||||||
void TwiMaster::ConfigurePins() const {
|
void TwiMaster::ConfigurePins() const {
|
||||||
NRF_GPIO->PIN_CNF[pinScl] =
|
NRF_GPIO->PIN_CNF[pinScl] = (GPIO_PIN_CNF_DIR_Input << GPIO_PIN_CNF_DIR_Pos) | (GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) |
|
||||||
(GPIO_PIN_CNF_DIR_Input << GPIO_PIN_CNF_DIR_Pos) |
|
(GPIO_PIN_CNF_PULL_Disabled << GPIO_PIN_CNF_PULL_Pos) | (GPIO_PIN_CNF_DRIVE_S0D1 << GPIO_PIN_CNF_DRIVE_Pos) |
|
||||||
(GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) |
|
(GPIO_PIN_CNF_SENSE_Disabled << GPIO_PIN_CNF_SENSE_Pos);
|
||||||
(GPIO_PIN_CNF_PULL_Disabled << GPIO_PIN_CNF_PULL_Pos) |
|
|
||||||
(GPIO_PIN_CNF_DRIVE_S0D1 << GPIO_PIN_CNF_DRIVE_Pos) |
|
|
||||||
(GPIO_PIN_CNF_SENSE_Disabled << GPIO_PIN_CNF_SENSE_Pos);
|
|
||||||
|
|
||||||
NRF_GPIO->PIN_CNF[pinSda] =
|
NRF_GPIO->PIN_CNF[pinSda] = (GPIO_PIN_CNF_DIR_Input << GPIO_PIN_CNF_DIR_Pos) | (GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) |
|
||||||
(GPIO_PIN_CNF_DIR_Input << GPIO_PIN_CNF_DIR_Pos) |
|
(GPIO_PIN_CNF_PULL_Disabled << GPIO_PIN_CNF_PULL_Pos) | (GPIO_PIN_CNF_DRIVE_S0D1 << GPIO_PIN_CNF_DRIVE_Pos) |
|
||||||
(GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) |
|
(GPIO_PIN_CNF_SENSE_Disabled << GPIO_PIN_CNF_SENSE_Pos);
|
||||||
(GPIO_PIN_CNF_PULL_Disabled << GPIO_PIN_CNF_PULL_Pos) |
|
|
||||||
(GPIO_PIN_CNF_DRIVE_S0D1 << GPIO_PIN_CNF_DRIVE_Pos) |
|
|
||||||
(GPIO_PIN_CNF_SENSE_Disabled << GPIO_PIN_CNF_SENSE_Pos);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TwiMaster::Init() {
|
void TwiMaster::Init() {
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
using namespace Pinetime::Applications;
|
using namespace Pinetime::Applications;
|
||||||
|
|
||||||
HeartRateTask::HeartRateTask(Drivers::Hrs3300& heartRateSensor, Controllers::HeartRateController& controller)
|
HeartRateTask::HeartRateTask(Drivers::Hrs3300& heartRateSensor, Controllers::HeartRateController& controller)
|
||||||
: heartRateSensor {heartRateSensor}, controller {controller}, ppg{} {
|
: heartRateSensor {heartRateSensor}, controller {controller}, ppg {} {
|
||||||
}
|
}
|
||||||
|
|
||||||
void HeartRateTask::Start() {
|
void HeartRateTask::Start() {
|
||||||
|
|
|
@ -159,7 +159,7 @@ Pinetime::System::SystemTask systemTask(spi,
|
||||||
touchHandler,
|
touchHandler,
|
||||||
buttonHandler);
|
buttonHandler);
|
||||||
|
|
||||||
/* Variable Declarations for variables in noinit SRAM
|
/* Variable Declarations for variables in noinit SRAM
|
||||||
Increment NoInit_MagicValue upon adding variables to this area
|
Increment NoInit_MagicValue upon adding variables to this area
|
||||||
*/
|
*/
|
||||||
extern uint32_t __start_noinit_data;
|
extern uint32_t __start_noinit_data;
|
||||||
|
@ -168,7 +168,6 @@ static constexpr uint32_t NoInit_MagicValue = 0xDEAD0000;
|
||||||
uint32_t NoInit_MagicWord __attribute__((section(".noinit")));
|
uint32_t NoInit_MagicWord __attribute__((section(".noinit")));
|
||||||
std::chrono::time_point<std::chrono::system_clock, std::chrono::nanoseconds> NoInit_BackUpTime __attribute__((section(".noinit")));
|
std::chrono::time_point<std::chrono::system_clock, std::chrono::nanoseconds> NoInit_BackUpTime __attribute__((section(".noinit")));
|
||||||
|
|
||||||
|
|
||||||
void nrfx_gpiote_evt_handler(nrfx_gpiote_pin_t pin, nrf_gpiote_polarity_t action) {
|
void nrfx_gpiote_evt_handler(nrfx_gpiote_pin_t pin, nrf_gpiote_polarity_t action) {
|
||||||
if (pin == Pinetime::PinMap::Cst816sIrq) {
|
if (pin == Pinetime::PinMap::Cst816sIrq) {
|
||||||
systemTask.OnTouchEvent();
|
systemTask.OnTouchEvent();
|
||||||
|
@ -327,12 +326,11 @@ int main(void) {
|
||||||
// retrieve version stored by bootloader
|
// retrieve version stored by bootloader
|
||||||
Pinetime::BootloaderVersion::SetVersion(NRF_TIMER2->CC[0]);
|
Pinetime::BootloaderVersion::SetVersion(NRF_TIMER2->CC[0]);
|
||||||
|
|
||||||
|
|
||||||
if (NoInit_MagicWord == NoInit_MagicValue) {
|
if (NoInit_MagicWord == NoInit_MagicValue) {
|
||||||
dateTimeController.SetCurrentTime(NoInit_BackUpTime);
|
dateTimeController.SetCurrentTime(NoInit_BackUpTime);
|
||||||
} else {
|
} else {
|
||||||
//Clear Memory to known state
|
// Clear Memory to known state
|
||||||
memset(&__start_noinit_data,0,(uintptr_t)&__stop_noinit_data-(uintptr_t)&__start_noinit_data);
|
memset(&__start_noinit_data, 0, (uintptr_t) &__stop_noinit_data - (uintptr_t) &__start_noinit_data);
|
||||||
NoInit_MagicWord = NoInit_MagicValue;
|
NoInit_MagicWord = NoInit_MagicValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,6 @@ Pinetime::Logging::NrfLogger logger;
|
||||||
Pinetime::Logging::DummyLogger logger;
|
Pinetime::Logging::DummyLogger logger;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static constexpr uint8_t displayWidth = 240;
|
static constexpr uint8_t displayWidth = 240;
|
||||||
static constexpr uint8_t displayHeight = 240;
|
static constexpr uint8_t displayHeight = 240;
|
||||||
static constexpr uint8_t bytesPerPixel = 2;
|
static constexpr uint8_t bytesPerPixel = 2;
|
||||||
|
|
|
@ -2,36 +2,36 @@
|
||||||
|
|
||||||
namespace Pinetime {
|
namespace Pinetime {
|
||||||
namespace System {
|
namespace System {
|
||||||
enum class Messages {
|
enum class Messages {
|
||||||
GoToSleep,
|
GoToSleep,
|
||||||
GoToRunning,
|
GoToRunning,
|
||||||
TouchWakeUp,
|
TouchWakeUp,
|
||||||
OnNewTime,
|
OnNewTime,
|
||||||
OnNewNotification,
|
OnNewNotification,
|
||||||
OnTimerDone,
|
OnTimerDone,
|
||||||
OnNewCall,
|
OnNewCall,
|
||||||
BleConnected,
|
BleConnected,
|
||||||
UpdateTimeOut,
|
UpdateTimeOut,
|
||||||
BleFirmwareUpdateStarted,
|
BleFirmwareUpdateStarted,
|
||||||
BleFirmwareUpdateFinished,
|
BleFirmwareUpdateFinished,
|
||||||
OnTouchEvent,
|
OnTouchEvent,
|
||||||
HandleButtonEvent,
|
HandleButtonEvent,
|
||||||
HandleButtonTimerEvent,
|
HandleButtonTimerEvent,
|
||||||
OnDisplayTaskSleeping,
|
OnDisplayTaskSleeping,
|
||||||
EnableSleeping,
|
EnableSleeping,
|
||||||
DisableSleeping,
|
DisableSleeping,
|
||||||
OnNewDay,
|
OnNewDay,
|
||||||
OnNewHour,
|
OnNewHour,
|
||||||
OnNewHalfHour,
|
OnNewHalfHour,
|
||||||
OnChargingEvent,
|
OnChargingEvent,
|
||||||
OnPairing,
|
OnPairing,
|
||||||
SetOffAlarm,
|
SetOffAlarm,
|
||||||
StopRinging,
|
StopRinging,
|
||||||
MeasureBatteryTimerExpired,
|
MeasureBatteryTimerExpired,
|
||||||
BatteryPercentageUpdated,
|
BatteryPercentageUpdated,
|
||||||
StartFileTransfer,
|
StartFileTransfer,
|
||||||
StopFileTransfer,
|
StopFileTransfer,
|
||||||
BleRadioEnableToggle
|
BleRadioEnableToggle
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
#include "systemtask/SystemTask.h"
|
#include "systemtask/SystemTask.h"
|
||||||
#if configUSE_TRACE_FACILITY == 1
|
#if configUSE_TRACE_FACILITY == 1
|
||||||
// FreeRtosMonitor
|
// FreeRtosMonitor
|
||||||
#include <FreeRTOS.h>
|
#include <FreeRTOS.h>
|
||||||
#include <task.h>
|
#include <task.h>
|
||||||
#include <nrf_log.h>
|
#include <nrf_log.h>
|
||||||
|
|
||||||
void Pinetime::System::SystemMonitor::Process() {
|
void Pinetime::System::SystemMonitor::Process() {
|
||||||
if (xTaskGetTickCount() - lastTick > 10000) {
|
if (xTaskGetTickCount() - lastTick > 10000) {
|
||||||
|
@ -14,13 +14,14 @@ void Pinetime::System::SystemMonitor::Process() {
|
||||||
NRF_LOG_INFO("Task [%s] - %d", tasksStatus[i].pcTaskName, tasksStatus[i].usStackHighWaterMark);
|
NRF_LOG_INFO("Task [%s] - %d", tasksStatus[i].pcTaskName, tasksStatus[i].usStackHighWaterMark);
|
||||||
if (tasksStatus[i].usStackHighWaterMark < 20)
|
if (tasksStatus[i].usStackHighWaterMark < 20)
|
||||||
NRF_LOG_INFO("WARNING!!! Task %s task is nearly full, only %dB available",
|
NRF_LOG_INFO("WARNING!!! Task %s task is nearly full, only %dB available",
|
||||||
tasksStatus[i].pcTaskName,
|
tasksStatus[i].pcTaskName,
|
||||||
tasksStatus[i].usStackHighWaterMark * 4);
|
tasksStatus[i].usStackHighWaterMark * 4);
|
||||||
}
|
}
|
||||||
lastTick = xTaskGetTickCount();
|
lastTick = xTaskGetTickCount();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
// DummyMonitor
|
// DummyMonitor
|
||||||
void Pinetime::System::SystemMonitor::Process() {}
|
void Pinetime::System::SystemMonitor::Process() {
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -11,30 +11,30 @@ namespace Pinetime {
|
||||||
}
|
}
|
||||||
namespace Controllers {
|
namespace Controllers {
|
||||||
class TouchHandler {
|
class TouchHandler {
|
||||||
public:
|
public:
|
||||||
explicit TouchHandler(Drivers::Cst816S&, Components::LittleVgl&);
|
explicit TouchHandler(Drivers::Cst816S&, Components::LittleVgl&);
|
||||||
void CancelTap();
|
void CancelTap();
|
||||||
bool GetNewTouchInfo();
|
bool GetNewTouchInfo();
|
||||||
void UpdateLvglTouchPoint();
|
void UpdateLvglTouchPoint();
|
||||||
|
|
||||||
bool IsTouching() const {
|
bool IsTouching() const {
|
||||||
return info.touching;
|
return info.touching;
|
||||||
}
|
}
|
||||||
uint8_t GetX() const {
|
uint8_t GetX() const {
|
||||||
return info.x;
|
return info.x;
|
||||||
}
|
}
|
||||||
uint8_t GetY() const {
|
uint8_t GetY() const {
|
||||||
return info.y;
|
return info.y;
|
||||||
}
|
}
|
||||||
Pinetime::Applications::TouchEvents GestureGet();
|
Pinetime::Applications::TouchEvents GestureGet();
|
||||||
private:
|
|
||||||
|
|
||||||
Pinetime::Drivers::Cst816S::TouchInfos info;
|
private:
|
||||||
Pinetime::Drivers::Cst816S& touchPanel;
|
Pinetime::Drivers::Cst816S::TouchInfos info;
|
||||||
Pinetime::Components::LittleVgl& lvgl;
|
Pinetime::Drivers::Cst816S& touchPanel;
|
||||||
Pinetime::Applications::TouchEvents gesture;
|
Pinetime::Components::LittleVgl& lvgl;
|
||||||
bool isCancelled = false;
|
Pinetime::Applications::TouchEvents gesture;
|
||||||
bool gestureReleased = true;
|
bool isCancelled = false;
|
||||||
|
bool gestureReleased = true;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user