diff --git a/include/apps/watchfaces/OswAppWatchfaceDigital.h b/include/apps/watchfaces/OswAppWatchfaceDigital.h index c1610d15f..a077f49fb 100644 --- a/include/apps/watchfaces/OswAppWatchfaceDigital.h +++ b/include/apps/watchfaces/OswAppWatchfaceDigital.h @@ -22,7 +22,7 @@ class OswAppWatchfaceDigital: public OswAppV2 { static void drawSteps(); static void digitalWatch(short timeZone, uint8_t fontSize, uint8_t dateCoordY, uint8_t timeCoordY); static void timeOutput(uint8_t hour, uint8_t minute, uint8_t second, bool showSecond = true); - static void dateOutput(uint16_t yearInt, uint8_t monthInt, uint8_t dayInt); + static void dateOutput(uint16_t year, uint8_t month, uint8_t day); static void displayWeekDay3(const char* weekday); private: diff --git a/include/services/OswServiceTaskBLEServer.h b/include/services/OswServiceTaskBLEServer.h index 0ae4ee26f..d9c6f2546 100644 --- a/include/services/OswServiceTaskBLEServer.h +++ b/include/services/OswServiceTaskBLEServer.h @@ -44,7 +44,7 @@ class OswServiceTaskBLEServer : public OswServiceTask { }; class CurrentTimeCharacteristicCallbacks: public NimBLECharacteristicCallbacks { void onRead(NimBLECharacteristic* pCharacteristic); - uint8_t bytesCurrentTime[9+1]; // will be read from (9 exact-time-256, 1 reason) + uint8_t bytes[9+1]; // will be read from (9 exact-time-256, 1 reason) }; class FirmwareRevisionCharacteristicCallbacks: public NimBLECharacteristicCallbacks { void onRead(NimBLECharacteristic* pCharacteristic); @@ -69,23 +69,23 @@ class OswServiceTaskBLEServer : public OswServiceTask { }; class StepsTodayCharacteristicCallbacks: public NimBLECharacteristicCallbacks { void onRead(NimBLECharacteristic* pCharacteristic); - uint8_t bytesStepsToday[4]; // this is a 4-byte array of a uint_32_t number + uint8_t bytes[4]; // this is a 4-byte array of a uint_32_t number }; class StepsTotalWeekCharacteristicCallbacks: public NimBLECharacteristicCallbacks { void onRead(NimBLECharacteristic* pCharacteristic); - uint8_t bytesStepsTotalWeek[4]; // this is a 4-byte array of a uint_32_t number + uint8_t bytes[4]; // this is a 4-byte array of a uint_32_t number }; class StepsTotalCharacteristicCallbacks: public NimBLECharacteristicCallbacks { void onRead(NimBLECharacteristic* pCharacteristic); - uint8_t bytesStepsTotal[4]; // this is a 4-byte array of a uint_32_t number + uint8_t bytes[4]; // this is a 4-byte array of a uint_32_t number }; class StepsAverageCharacteristicCallbacks: public NimBLECharacteristicCallbacks { void onRead(NimBLECharacteristic* pCharacteristic); - uint8_t bytesStepsAverage[4]; // this is a 4-byte array of a uint_32_t number + uint8_t bytes[4]; // this is a 4-byte array of a uint_32_t number }; class StepsDayHistoryCharacteristicCallbacks: public NimBLECharacteristicCallbacks { void onRead(NimBLECharacteristic* pCharacteristic); - uint8_t bytesStepsDayHistory[4 * 7]; // this is a 28-byte array of a seven uint_32_t number + uint8_t bytes[4 * 7]; // this is a 28-byte array of seven uint_32_t numbers }; diff --git a/src/apps/watchfaces/OswAppWatchfaceDigital.cpp b/src/apps/watchfaces/OswAppWatchfaceDigital.cpp index 865a1f208..888b0abf0 100644 --- a/src/apps/watchfaces/OswAppWatchfaceDigital.cpp +++ b/src/apps/watchfaces/OswAppWatchfaceDigital.cpp @@ -47,36 +47,36 @@ void OswAppWatchfaceDigital::displayWeekDay3(const char* weekday) { hal->gfx()->print(weekday3); } -void OswAppWatchfaceDigital::dateOutput(uint16_t yearInt, uint8_t monthInt, uint8_t dayInt) { +void OswAppWatchfaceDigital::dateOutput(uint16_t year, uint8_t month, uint8_t day) { OswHal* hal = OswHal::getInstance(); switch (OswAppWatchfaceDigital::getDateFormat()) { case 0: - hal->gfx()->printDecimal(monthInt, 2); + hal->gfx()->printDecimal(month, 2); hal->gfx()->print("/"); - hal->gfx()->printDecimal(dayInt, 2); + hal->gfx()->printDecimal(day, 2); hal->gfx()->print("/"); - hal->gfx()->print(yearInt); + hal->gfx()->print(year); break; case 1: - hal->gfx()->printDecimal(dayInt, 2); + hal->gfx()->printDecimal(day, 2); hal->gfx()->print("."); - hal->gfx()->printDecimal(monthInt, 2); + hal->gfx()->printDecimal(month, 2); hal->gfx()->print("."); - hal->gfx()->print(yearInt); + hal->gfx()->print(year); break; case 2: - hal->gfx()->print(yearInt); + hal->gfx()->print(year); hal->gfx()->print("."); - hal->gfx()->printDecimal(monthInt, 2); + hal->gfx()->printDecimal(month, 2); hal->gfx()->print("/"); - hal->gfx()->printDecimal(dayInt, 2); + hal->gfx()->printDecimal(day, 2); break; case 3: - hal->gfx()->printDecimal(dayInt, 2); + hal->gfx()->printDecimal(day, 2); hal->gfx()->print("/"); - hal->gfx()->printDecimal(monthInt, 2); + hal->gfx()->printDecimal(month, 2); hal->gfx()->print("/"); - hal->gfx()->print(yearInt); + hal->gfx()->print(year); break; } } diff --git a/src/services/OswServiceTaskBLEServer.cpp b/src/services/OswServiceTaskBLEServer.cpp index 65c992bcb..842cfbf7d 100644 --- a/src/services/OswServiceTaskBLEServer.cpp +++ b/src/services/OswServiceTaskBLEServer.cpp @@ -306,17 +306,17 @@ void OswServiceTaskBLEServer::CurrentTimeCharacteristicCallbacks::onRead(NimBLEC OswTime oswTime; OswHal::getInstance()->getTime(offset, oswTime); - this->bytesCurrentTime[0] = (uint8_t) oswDate.year; // Exact Time 256 -> Day Date Time -> Date Time -> Year #1 - this->bytesCurrentTime[1] = (uint8_t) (oswDate.year >> 8); // Exact Time 256 -> Day Date Time -> Date Time -> Year #2 - this->bytesCurrentTime[2] = (uint8_t) oswDate.month; // Exact Time 256 -> Day Date Time -> Date Time -> Month - this->bytesCurrentTime[3] = (uint8_t) oswDate.day; // Exact Time 256 -> Day Date Time -> Date Time -> Day - this->bytesCurrentTime[4] = (uint8_t) oswTime.hour; // Exact Time 256 -> Day Date Time -> Date Time -> Hours - this->bytesCurrentTime[5] = (uint8_t) oswTime.minute; // Exact Time 256 -> Day Date Time -> Date Time -> Minutes - this->bytesCurrentTime[6] = (uint8_t) oswTime.second; // Exact Time 256 -> Day Date Time -> Date Time -> Seconds - this->bytesCurrentTime[7] = (uint8_t) (oswDate.weekDay == 0 ? 7 : oswDate.weekDay); // Exact Time 256 -> Day Date Time -> Day of Week - this->bytesCurrentTime[8] = 0b00000000; // Exact Time 256 -> Fractions256 - this->bytesCurrentTime[9] = 0b00000001; // Adjust Reason: External Reference Time Update - pCharacteristic->setValue(this->bytesCurrentTime, sizeof(this->bytesCurrentTime)); + this->bytes[0] = (uint8_t) oswDate.year; // Exact Time 256 -> Day Date Time -> Date Time -> Year #1 + this->bytes[1] = (uint8_t) (oswDate.year >> 8); // Exact Time 256 -> Day Date Time -> Date Time -> Year #2 + this->bytes[2] = (uint8_t) oswDate.month; // Exact Time 256 -> Day Date Time -> Date Time -> Month + this->bytes[3] = (uint8_t) oswDate.day; // Exact Time 256 -> Day Date Time -> Date Time -> Day + this->bytes[4] = (uint8_t) oswTime.hour; // Exact Time 256 -> Day Date Time -> Date Time -> Hours + this->bytes[5] = (uint8_t) oswTime.minute; // Exact Time 256 -> Day Date Time -> Date Time -> Minutes + this->bytes[6] = (uint8_t) oswTime.second; // Exact Time 256 -> Day Date Time -> Date Time -> Seconds + this->bytes[7] = (uint8_t) (oswDate.weekDay == 0 ? 7 : oswDate.weekDay); // Exact Time 256 -> Day Date Time -> Day of Week + this->bytes[8] = 0b00000000; // Exact Time 256 -> Fractions256 + this->bytes[9] = 0b00000001; // Adjust Reason: External Reference Time Update + pCharacteristic->setValue(this->bytes, sizeof(this->bytes)); } void OswServiceTaskBLEServer::FirmwareRevisionCharacteristicCallbacks::onRead(NimBLECharacteristic* pCharacteristic) { @@ -331,58 +331,58 @@ void OswServiceTaskBLEServer::HardwareRevisionCharacteristicCallbacks::onRead(Ni void OswServiceTaskBLEServer::StepsTodayCharacteristicCallbacks::onRead(NimBLECharacteristic* pCharacteristic) { uint32_t stepsToday = OswHal::getInstance()->environment()->getStepsToday(); - this->bytesStepsToday[0] = (uint8_t) stepsToday; - this->bytesStepsToday[1] = (uint8_t) (stepsToday >> 8); - this->bytesStepsToday[2] = (uint8_t) (stepsToday >> 16); - this->bytesStepsToday[3] = (uint8_t) (stepsToday >> 24); + this->bytes[0] = (uint8_t) stepsToday; + this->bytes[1] = (uint8_t) (stepsToday >> 8); + this->bytes[2] = (uint8_t) (stepsToday >> 16); + this->bytes[3] = (uint8_t) (stepsToday >> 24); - pCharacteristic->setValue(this->bytesStepsToday, sizeof(this->bytesStepsToday)); + pCharacteristic->setValue(this->bytes, sizeof(this->bytes)); } void OswServiceTaskBLEServer::StepsTotalCharacteristicCallbacks::onRead(NimBLECharacteristic* pCharacteristic) { uint32_t stepsTotal = OswHal::getInstance()->environment()->getStepsTotal(); - this->bytesStepsTotal[0] = (uint8_t) stepsTotal; - this->bytesStepsTotal[1] = (uint8_t) (stepsTotal >> 8); - this->bytesStepsTotal[2] = (uint8_t) (stepsTotal >> 16); - this->bytesStepsTotal[3] = (uint8_t) (stepsTotal >> 24); + this->bytes[0] = (uint8_t) stepsTotal; + this->bytes[1] = (uint8_t) (stepsTotal >> 8); + this->bytes[2] = (uint8_t) (stepsTotal >> 16); + this->bytes[3] = (uint8_t) (stepsTotal >> 24); - pCharacteristic->setValue(this->bytesStepsTotal, sizeof(this->bytesStepsTotal)); + pCharacteristic->setValue(this->bytes, sizeof(this->bytes)); } void OswServiceTaskBLEServer::StepsTotalWeekCharacteristicCallbacks::onRead(NimBLECharacteristic* pCharacteristic) { uint32_t stepsTotalWeek = OswHal::getInstance()->environment()->getStepsTotalWeek(); - this->bytesStepsTotalWeek[0] = (uint8_t) stepsTotalWeek; - this->bytesStepsTotalWeek[1] = (uint8_t) (stepsTotalWeek >> 8); - this->bytesStepsTotalWeek[2] = (uint8_t) (stepsTotalWeek >> 16); - this->bytesStepsTotalWeek[3] = (uint8_t) (stepsTotalWeek >> 24); + this->bytes[0] = (uint8_t) stepsTotalWeek; + this->bytes[1] = (uint8_t) (stepsTotalWeek >> 8); + this->bytes[2] = (uint8_t) (stepsTotalWeek >> 16); + this->bytes[3] = (uint8_t) (stepsTotalWeek >> 24); - pCharacteristic->setValue(this->bytesStepsTotalWeek, sizeof(this->bytesStepsTotalWeek)); + pCharacteristic->setValue(this->bytes, sizeof(this->bytes)); } #ifdef OSW_FEATURE_STATS_STEPS void OswServiceTaskBLEServer::StepsAverageCharacteristicCallbacks::onRead(NimBLECharacteristic* pCharacteristic) { uint32_t stepsAverage = OswHal::getInstance()->environment()->getStepsAverage(); - this->bytesStepsAverage[0] = (uint8_t) stepsAverage; - this->bytesStepsAverage[1] = (uint8_t) (stepsAverage >> 8); - this->bytesStepsAverage[2] = (uint8_t) (stepsAverage >> 16); - this->bytesStepsAverage[3] = (uint8_t) (stepsAverage >> 24); + this->bytes[0] = (uint8_t) stepsAverage; + this->bytes[1] = (uint8_t) (stepsAverage >> 8); + this->bytes[2] = (uint8_t) (stepsAverage >> 16); + this->bytes[3] = (uint8_t) (stepsAverage >> 24); - pCharacteristic->setValue(this->bytesStepsAverage, sizeof(this->bytesStepsAverage)); + pCharacteristic->setValue(this->bytes, sizeof(this->bytes)); } void OswServiceTaskBLEServer::StepsDayHistoryCharacteristicCallbacks::onRead(NimBLECharacteristic* pCharacteristic) { for (uint8_t indexOfWeek = 0; indexOfWeek < 7; indexOfWeek++) { uint32_t value = OswHal::getInstance()->environment()->getStepsOnDay(indexOfWeek, false); - this->bytesStepsDayHistory[0 + indexOfWeek * 4] = (uint8_t) value; - this->bytesStepsDayHistory[1 + indexOfWeek * 4] = (uint8_t) (value >> 8); - this->bytesStepsDayHistory[2 + indexOfWeek * 4] = (uint8_t) (value >> 16); - this->bytesStepsDayHistory[3 + indexOfWeek * 4] = (uint8_t) (value >> 24); + this->bytes[0 + indexOfWeek * 4] = (uint8_t) value; + this->bytes[1 + indexOfWeek * 4] = (uint8_t) (value >> 8); + this->bytes[2 + indexOfWeek * 4] = (uint8_t) (value >> 16); + this->bytes[3 + indexOfWeek * 4] = (uint8_t) (value >> 24); } - pCharacteristic->setValue(this->bytesStepsDayHistory, sizeof(this->bytesStepsDayHistory)); + pCharacteristic->setValue(this->bytes, sizeof(this->bytes)); } #endif #endif