add error codes to CTS; cosmetics

This commit is contained in:
uli 2022-05-29 16:35:35 +02:00
parent 688d5f04f5
commit 11fa523166
4 changed files with 34 additions and 36 deletions

View File

@ -44,8 +44,7 @@ int CurrentTimeService::OnCurrentTimeAccessed(uint16_t conn_handle, uint16_t att
if (res < 0) {
NRF_LOG_ERROR("Error reading BLE Data writing to CTS Current Time (too little data)")
// return OK/0 anyway, we did consume the request, we just ignored the invalid value´
return 0;
return BLE_ATT_ERR_INVALID_ATTR_VALUE_LEN;
}
uint16_t year = ((uint16_t) result.year_MSO << 8) + result.year_LSO;
@ -82,8 +81,7 @@ int CurrentTimeService::OnLocalTimeAccessed(uint16_t conn_handle, uint16_t attr_
if (res < 0) {
NRF_LOG_ERROR("Error reading BLE Data writing to CTS Local Time (too little data)")
// return OK/0 anyway, we did consume the request, we just ignored the invalid value´
return 0;
return BLE_ATT_ERR_INVALID_ATTR_VALUE_LEN;
}
NRF_LOG_INFO("Received data: %d %d", result.timezone, result.dst);

View File

@ -5,7 +5,6 @@
#include <string>
#include "components/settings/Settings.h"
namespace Pinetime {
namespace System {
class SystemTask;

View File

@ -140,15 +140,14 @@ namespace Pinetime {
return settings.screenTimeOut;
};
void SetShakeThreshold(uint16_t thresh){
if(settings.shakeWakeThreshold != thresh){
void SetShakeThreshold(uint16_t thresh) {
if (settings.shakeWakeThreshold != thresh) {
settings.shakeWakeThreshold = thresh;
settingsChanged = true;
}
}
int16_t GetShakeThreshold() const{
int16_t GetShakeThreshold() const {
return settings.shakeWakeThreshold;
}

View File

@ -70,15 +70,17 @@ void SettingTimeFormat::UpdateSelected(lv_obj_t* object, lv_event_t event) {
if (object == cbOption[i]) {
lv_checkbox_set_checked(cbOption[i], true);
if (i == 0) {
switch (i) {
case 0:
settingsController.SetClockType(Controllers::Settings::ClockType::H12);
};
if (i == 1) {
break;
case 1:
settingsController.SetClockType(Controllers::Settings::ClockType::H24);
};
if (i == 2) {
break;
case 2:
settingsController.SetClockType(Controllers::Settings::ClockType::UTC);
};
break;
}
} else {
lv_checkbox_set_checked(cbOption[i], false);