diff --git a/emulator/include/RtcDS3231.h b/emulator/include/RtcDS3231.h index 7d523ec51..c4bff3d0a 100644 --- a/emulator/include/RtcDS3231.h +++ b/emulator/include/RtcDS3231.h @@ -19,9 +19,9 @@ class RtcDateTime { uint8_t Minute(); uint8_t Second(); - uint32_t DayOfWeek(); - uint32_t Day(); - uint32_t Month(); + uint8_t DayOfWeek(); + uint8_t Day(); + uint8_t Month(); uint32_t Year(); private: time_t time = 0; diff --git a/emulator/src/RtcDS3231.cpp b/emulator/src/RtcDS3231.cpp index 18eae43a6..51be2fadd 100644 --- a/emulator/src/RtcDS3231.cpp +++ b/emulator/src/RtcDS3231.cpp @@ -17,15 +17,15 @@ uint8_t RtcDateTime::Second() { return parts->tm_sec; } -uint32_t RtcDateTime::DayOfWeek() { +uint8_t RtcDateTime::DayOfWeek() { struct tm* parts = std::localtime(&this->time); return parts->tm_wday; } -uint32_t RtcDateTime::Day() { +uint8_t RtcDateTime::Day() { struct tm* parts = std::localtime(&this->time); return parts->tm_mday; } -uint32_t RtcDateTime::Month() { +uint8_t RtcDateTime::Month() { struct tm* parts = std::localtime(&this->time); return parts->tm_mon + 1; } diff --git a/include/apps/tools/OswAppStepStats.h b/include/apps/tools/OswAppStepStats.h index 3b100266a..ad389c614 100644 --- a/include/apps/tools/OswAppStepStats.h +++ b/include/apps/tools/OswAppStepStats.h @@ -18,7 +18,7 @@ class OswAppStepStats : public OswApp { #endif virtual void stop() override; ~OswAppStepStats() {}; - static void drawInfoPanel(OswUI* ui, uint32_t pos, uint32_t lastWeekData, uint32_t todayData, uint32_t average, uint32_t total, const String& unit = String("")); + static void drawInfoPanel(OswUI* ui, uint8_t pos, uint32_t lastWeekData, uint32_t todayData, uint32_t average, uint32_t total, const String& unit = String("")); private: void showStickChart(); diff --git a/include/apps/watchfaces/OswAppWatchfaceDigital.h b/include/apps/watchfaces/OswAppWatchfaceDigital.h index 259ddb645..27364009e 100644 --- a/include/apps/watchfaces/OswAppWatchfaceDigital.h +++ b/include/apps/watchfaces/OswAppWatchfaceDigital.h @@ -21,8 +21,8 @@ class OswAppWatchfaceDigital: public OswAppV2 { static void refreshDateFormatCache(); static void drawSteps(); static void digitalWatch(short timeZone, uint8_t fontSize, uint8_t dateCoordY, uint8_t timeCoordY); - static void timeOutput(uint32_t hour, uint32_t minute, uint32_t second, bool showSecond = true); - static void dateOutput(uint32_t yearInt, uint32_t monthInt, uint32_t dayInt); + static void timeOutput(uint8_t hour, uint8_t minute, uint8_t second, bool showSecond = true); + static void dateOutput(uint32_t yearInt, uint8_t monthInt, uint8_t dayInt); static void displayWeekDay3(const char* weekday); private: diff --git a/src/apps/tools/OswAppDistStats.cpp b/src/apps/tools/OswAppDistStats.cpp index f2addd5e0..a08e9482e 100644 --- a/src/apps/tools/OswAppDistStats.cpp +++ b/src/apps/tools/OswAppDistStats.cpp @@ -15,8 +15,8 @@ void OswAppDistStats::drawChart() { uint8_t interval = 20; uint16_t goalValue = OswConfigAllKeys::distPerDay.get(); - uint32_t weekDay = 0; - uint32_t dayOfMonth = 0; + uint8_t weekDay = 0; + uint8_t dayOfMonth = 0; hal->getLocalDate(&dayOfMonth, &weekDay); for (uint8_t index = 0; index < 7; index++) { @@ -51,8 +51,8 @@ void OswAppDistStats::showStickChart() { void OswAppDistStats::setup() { OswHal* hal = OswHal::getInstance(); - uint32_t weekDay = 0; - uint32_t dayOfMonth = 0; + uint8_t weekDay = 0; + uint8_t dayOfMonth = 0; hal->getLocalDate(&dayOfMonth, &weekDay); cursorPos = weekDay; } diff --git a/src/apps/tools/OswAppKcalStats.cpp b/src/apps/tools/OswAppKcalStats.cpp index 53889a15a..b26cf662d 100644 --- a/src/apps/tools/OswAppKcalStats.cpp +++ b/src/apps/tools/OswAppKcalStats.cpp @@ -14,7 +14,7 @@ uint32_t findCursorWeekDay(uint8_t Index) { // Show the day of the week that cursor (Dynamic weekDay--info) OswHal* hal = OswHal::getInstance(); - uint32_t d, wD = 0; + uint8_t d, wD = 0; hal->getLocalDate(&d, &wD); int cursorWeekDay = wD - (6 - Index); int findWeekDay = (cursorWeekDay >= 0) ? cursorWeekDay : (cursorWeekDay + 7); diff --git a/src/apps/tools/OswAppStepStats.cpp b/src/apps/tools/OswAppStepStats.cpp index eee20f443..89a07c474 100644 --- a/src/apps/tools/OswAppStepStats.cpp +++ b/src/apps/tools/OswAppStepStats.cpp @@ -14,8 +14,8 @@ void OswAppStepStats::drawChart() { uint8_t interval = 20; uint16_t goalValue = OswConfigAllKeys::stepsPerDay.get(); - uint32_t weekDay = 0; - uint32_t dayOfMonth = 0; + uint8_t weekDay = 0; + uint8_t dayOfMonth = 0; hal->getLocalDate(&dayOfMonth, &weekDay); for (uint8_t index = 0; index < 7; index++) { @@ -33,7 +33,7 @@ void OswAppStepStats::drawChart() { } } -void OswAppStepStats::drawInfoPanel(OswUI* ui, uint32_t pos, uint32_t lastWeekData, uint32_t todayData, uint32_t average, uint32_t total,const String& unit) { +void OswAppStepStats::drawInfoPanel(OswUI* ui, uint8_t pos, uint32_t lastWeekData, uint32_t todayData, uint32_t average, uint32_t total,const String& unit) { OswHal* hal = OswHal::getInstance(); uint8_t coord_X = 30; @@ -69,8 +69,8 @@ void OswAppStepStats::showStickChart() { void OswAppStepStats::setup() { OswHal* hal = OswHal::getInstance(); - uint32_t weekDay = 0; - uint32_t dayOfMonth = 0; + uint8_t weekDay = 0; + uint8_t dayOfMonth = 0; hal->getLocalDate(&dayOfMonth, &weekDay); cursorPos = weekDay; } diff --git a/src/apps/tools/OswAppTimeConfig.cpp b/src/apps/tools/OswAppTimeConfig.cpp index f5be04736..9a5e1982e 100644 --- a/src/apps/tools/OswAppTimeConfig.cpp +++ b/src/apps/tools/OswAppTimeConfig.cpp @@ -15,11 +15,11 @@ void OswAppTimeConfig::setup() {} void OswAppTimeConfig::enterManualMode() { - uint32_t second = 0; - uint32_t minute = 0; - uint32_t hour = 0; - uint32_t day = 0; - uint32_t month = 0; + uint8_t second = 0; + uint8_t minute = 0; + uint8_t hour = 0; + uint8_t day = 0; + uint8_t month = 0; uint32_t year = 0; OswHal::getInstance()->getLocalTime(&hour, &minute, &second); OswHal::getInstance()->getLocalDate(&day, &month, &year); @@ -197,9 +197,9 @@ void OswAppTimeConfig::loop() { hal->gfx()->setTextLeftAligned(); hal->gfx()->setTextCursor(120 - hal->gfx()->getTextOfsetColumns(4), 120); - uint32_t second = 0; - uint32_t minute = 0; - uint32_t hour = 0; + uint8_t second = 0; + uint8_t minute = 0; + uint8_t hour = 0; hal->getLocalTime(&hour, &minute, &second); hal->gfx()->printDecimal(hour, 2); hal->gfx()->print(":"); diff --git a/src/apps/watchfaces/OswAppWatchface.cpp b/src/apps/watchfaces/OswAppWatchface.cpp index 859c776d1..14d24b788 100644 --- a/src/apps/watchfaces/OswAppWatchface.cpp +++ b/src/apps/watchfaces/OswAppWatchface.cpp @@ -28,8 +28,8 @@ const char* OswAppWatchface::getAppName() { void OswAppWatchface::drawStepHistory(OswUI* ui, uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint32_t max) { OswHal* hal = OswHal::getInstance(); OswUI::getInstance()->resetTextColors(); - uint32_t weekDay = 0; - uint32_t dayOfMonth = 0; + uint8_t weekDay = 0; + uint8_t dayOfMonth = 0; hal->getLocalDate(&dayOfMonth, &weekDay); for (uint8_t i = 0; i < 7; i++) { uint32_t s = hal->environment()->getStepsOnDay(i); @@ -91,15 +91,15 @@ void OswAppWatchface::drawWatch() { // hal->gfx()->drawArc(120, 120, 0, bat, 180, 57, 7, dimColor(COLOR_BLUE, 25)); // hal->gfx()->drawArc(120, 120, 0, bat, 180, 57, 6, COLOR_BLUE); - uint32_t second = 0; - uint32_t minute = 0; - uint32_t hour = 0; + uint8_t second = 0; + uint8_t minute = 0; + uint8_t hour = 0; hal->getLocalTime(&hour, &minute, &second); if(OswConfigAllKeys::settingDisplayDualHourTick.get()) { - uint32_t dualSecond = 0; - uint32_t dualMinute = 0; - uint32_t dualHour = 0; + uint8_t dualSecond = 0; + uint8_t dualMinute = 0; + uint8_t dualHour = 0; hal->getDualTime(&dualHour, &dualMinute, &dualSecond); // dual-hours diff --git a/src/apps/watchfaces/OswAppWatchfaceBinary.cpp b/src/apps/watchfaces/OswAppWatchfaceBinary.cpp index 00d894078..e3e60a211 100644 --- a/src/apps/watchfaces/OswAppWatchfaceBinary.cpp +++ b/src/apps/watchfaces/OswAppWatchfaceBinary.cpp @@ -14,9 +14,9 @@ #define COLOR_WHxITE rgb565(255, 255, 255) void OswAppWatchfaceBinary::drawWatch() { - uint32_t second = 0; - uint32_t minute = 0; - uint32_t hour = 0; + uint8_t second = 0; + uint8_t minute = 0; + uint8_t hour = 0; bool afterNoon = false; OswHal* hal = OswHal::getInstance(); hal->getLocalTime(&hour, &minute, &second, &afterNoon); diff --git a/src/apps/watchfaces/OswAppWatchfaceDigital.cpp b/src/apps/watchfaces/OswAppWatchfaceDigital.cpp index ca74c6d41..c2258657c 100644 --- a/src/apps/watchfaces/OswAppWatchfaceDigital.cpp +++ b/src/apps/watchfaces/OswAppWatchfaceDigital.cpp @@ -33,7 +33,7 @@ void OswAppWatchfaceDigital::displayWeekDay3(const char* weekday) { hal->gfx()->print(weekday3); } -void OswAppWatchfaceDigital::dateOutput(uint32_t yearInt, uint32_t monthInt, uint32_t dayInt) { +void OswAppWatchfaceDigital::dateOutput(uint32_t yearInt, uint8_t monthInt, uint8_t dayInt) { OswHal* hal = OswHal::getInstance(); switch (OswAppWatchfaceDigital::getDateFormat()) { case 1: // 0 : mm/dd/yyyy @@ -61,8 +61,8 @@ void OswAppWatchfaceDigital::dateOutput(uint32_t yearInt, uint32_t monthInt, uin } static void drawDate(time_t timeZone, uint8_t fontSize, uint8_t CoordY) { - uint32_t dayInt = 0; - uint32_t monthInt = 0; + uint8_t dayInt = 0; + uint8_t monthInt = 0; uint32_t yearInt = 0; OswHal* hal = OswHal::getInstance(); const char* weekday = hal->getWeekday(timeZone); @@ -89,7 +89,7 @@ static void drawDate(time_t timeZone, uint8_t fontSize, uint8_t CoordY) { OswAppWatchfaceDigital::dateOutput(yearInt, monthInt, dayInt); } -void OswAppWatchfaceDigital::timeOutput(uint32_t hour, uint32_t minute, uint32_t second,bool showSecond) { +void OswAppWatchfaceDigital::timeOutput(uint8_t hour, uint8_t minute, uint8_t second,bool showSecond) { OswHal* hal = OswHal::getInstance(); hal->gfx()->printDecimal(hour, 2); hal->gfx()->print(":"); @@ -101,9 +101,9 @@ void OswAppWatchfaceDigital::timeOutput(uint32_t hour, uint32_t minute, uint32_t } static void drawTime(time_t timeZone,uint8_t CoordY) { - uint32_t second = 0; - uint32_t minute = 0; - uint32_t hour = 0; + uint8_t second = 0; + uint8_t minute = 0; + uint8_t hour = 0; bool afterNoon = false; char am[] = "AM"; char pm[] = "PM"; diff --git a/src/apps/watchfaces/OswAppWatchfaceDual.cpp b/src/apps/watchfaces/OswAppWatchfaceDual.cpp index 2e49d2107..55f3b9349 100644 --- a/src/apps/watchfaces/OswAppWatchfaceDual.cpp +++ b/src/apps/watchfaces/OswAppWatchfaceDual.cpp @@ -32,9 +32,9 @@ void OswAppWatchfaceDual::drawProgressBar(OswUI* ui,uint8_t cx, uint8_t cy, uint void OswAppWatchfaceDual::drawAnimSec() { OswHal* hal = OswHal::getInstance(); uint8_t barWidth = 140; - uint32_t Hs, Ms, Ss = 0; + uint8_t Hs, Ms, Ss = 0; hal->getLocalTime(&Hs,&Ms,&Ss); - uint32_t onlySecond = Ss; + uint8_t onlySecond = Ss; uint16_t barValue = ((float)onlySecond / 60) * barWidth; barValue = barValue < 2 ? 0 : barValue; uint8_t coordX = (DISP_W - barWidth) / 2; diff --git a/src/apps/watchfaces/OswAppWatchfaceFitness.cpp b/src/apps/watchfaces/OswAppWatchfaceFitness.cpp index d7fe46baf..b88c5716f 100644 --- a/src/apps/watchfaces/OswAppWatchfaceFitness.cpp +++ b/src/apps/watchfaces/OswAppWatchfaceFitness.cpp @@ -25,8 +25,8 @@ uint32_t OswAppWatchfaceFitness::calculateKcalorie(uint32_t steps) { } void dateDisplay() { - uint32_t dayInt = 0; - uint32_t monthInt = 0; + uint8_t dayInt = 0; + uint8_t monthInt = 0; uint32_t yearInt = 0; OswHal* hal = OswHal::getInstance(); const char* weekday = hal->getLocalWeekday(); @@ -62,9 +62,9 @@ void timeDisplay(uint32_t hour, uint32_t minute, uint32_t second) { } void digitalWatchDisplay() { - uint32_t second = 0; - uint32_t minute = 0; - uint32_t hour = 0; + uint8_t second = 0; + uint8_t minute = 0; + uint8_t hour = 0; bool afterNoon = false; char am[] = "AM"; char pm[] = "PM"; diff --git a/src/apps/watchfaces/OswAppWatchfaceFitnessAnalog.cpp b/src/apps/watchfaces/OswAppWatchfaceFitnessAnalog.cpp index 63562eff0..39b1e5575 100644 --- a/src/apps/watchfaces/OswAppWatchfaceFitnessAnalog.cpp +++ b/src/apps/watchfaces/OswAppWatchfaceFitnessAnalog.cpp @@ -110,7 +110,7 @@ void OswAppWatchfaceFitnessAnalog::drawWatchFace(OswHal* hal, uint32_t hour, uin #endif } -void OswAppWatchfaceFitnessAnalog::drawDateFace(OswHal* hal, uint32_t hour, uint32_t minute, uint32_t second, bool afterNoon) { +void OswAppWatchfaceFitnessAnalog::drawDateFace(OswHal* hal, uint8_t hour, uint8_t minute, uint8_t second, bool afterNoon) { const char* weekday = hal->getLocalWeekday(); hal->gfx()->setTextSize(2); @@ -119,8 +119,8 @@ void OswAppWatchfaceFitnessAnalog::drawDateFace(OswHal* hal, uint32_t hour, uint OswAppWatchfaceDigital::displayWeekDay3(weekday); // Date - uint32_t dayInt = 0; - uint32_t monthInt = 0; + uint8_t dayInt = 0; + uint8_t monthInt = 0; uint32_t yearInt = 0; hal->getLocalDate(&dayInt, &monthInt, &yearInt); hal->gfx()->setTextSize(3); @@ -207,9 +207,9 @@ void OswAppWatchfaceFitnessAnalog::onDraw() { OswHal* hal = OswHal::getInstance(); - uint32_t second = 0; - uint32_t minute = 0; - uint32_t hour = 0; + uint8_t second = 0; + uint8_t minute = 0; + uint8_t hour = 0; bool afterNoon; hal->getLocalTime(&hour, &minute, &second, &afterNoon); diff --git a/src/apps/watchfaces/OswAppWatchfaceMix.cpp b/src/apps/watchfaces/OswAppWatchfaceMix.cpp index 51633f877..d5fb840c1 100644 --- a/src/apps/watchfaces/OswAppWatchfaceMix.cpp +++ b/src/apps/watchfaces/OswAppWatchfaceMix.cpp @@ -23,9 +23,9 @@ const char* OswAppWatchfaceMix::getAppName() { void OswAppWatchfaceMix::analogWatchDisplay() { OswHal* hal = OswHal::getInstance(); - uint32_t second = 0; - uint32_t minute = 0; // Unused, but required by function signature - uint32_t hour = 0; // Unused, but required by function signature + uint8_t second = 0; + uint8_t minute = 0; + uint8_t hour = 0; hal->getLocalTime(&hour, &minute, &second); hal->gfx()->drawCircle((int)(DISP_W*0.5)-OFF_SET_ANALOG_WATCH_X_COORD, 100, 50, ui->getForegroundColor()); @@ -49,8 +49,8 @@ void OswAppWatchfaceMix::analogWatchDisplay() { } void OswAppWatchfaceMix::dateDisplay() { - uint32_t dayInt = 0; - uint32_t monthInt = 0; + uint8_t dayInt = 0; + uint8_t monthInt = 0; uint32_t yearInt = 0; OswHal* hal = OswHal::getInstance(); const char* weekday = hal->getLocalWeekday(); @@ -76,9 +76,9 @@ void OswAppWatchfaceMix::dateDisplay() { } void OswAppWatchfaceMix::digitalWatchDisplay() { - uint32_t second = 0; - uint32_t minute = 0; - uint32_t hour = 0; + uint8_t second = 0; + uint8_t minute = 0; + uint8_t hour = 0; bool afterNoon = false; char am[] = "AM"; char pm[] = "PM"; diff --git a/src/apps/watchfaces/OswAppWatchfaceMonotimer.cpp b/src/apps/watchfaces/OswAppWatchfaceMonotimer.cpp index 996f6c4b2..34769b3eb 100644 --- a/src/apps/watchfaces/OswAppWatchfaceMonotimer.cpp +++ b/src/apps/watchfaces/OswAppWatchfaceMonotimer.cpp @@ -104,15 +104,15 @@ void OswAppWatchfaceMonotimer::drawWatch() { #endif // ticks - uint32_t second = 0; - uint32_t minute = 0; - uint32_t hour = 0; + uint8_t second = 0; + uint8_t minute = 0; + uint8_t hour = 0; hal->getLocalTime(&hour, &minute, &second); if (OswConfigAllKeys::settingDisplayDualHourTick.get()) { - uint32_t dualSecond = 0; - uint32_t dualMinute = 0; - uint32_t dualHour = 0; + uint8_t dualSecond = 0; + uint8_t dualMinute = 0; + uint8_t dualHour = 0; hal->getDualTime(&dualHour, &dualMinute, &dualSecond); hal->gfx()->drawThickTick(120, 120, 0, 105, (360.0f * (60 * dualHour + dualMinute)) / 720.0f, 1, ui->getBackgroundDimmedColor()); diff --git a/src/apps/watchfaces/OswAppWatchfaceNumerals.cpp b/src/apps/watchfaces/OswAppWatchfaceNumerals.cpp index ab5d49a92..e4d5473aa 100644 --- a/src/apps/watchfaces/OswAppWatchfaceNumerals.cpp +++ b/src/apps/watchfaces/OswAppWatchfaceNumerals.cpp @@ -33,8 +33,8 @@ void OswAppWatchfaceNumerals::drawWatch() { OswAppWatchfaceMonotimer::drawHour(); - uint32_t dayInt = 0; - uint32_t monthInt = 0; + uint8_t dayInt = 0; + uint8_t monthInt = 0; uint32_t yearInt = 0; hal->getLocalDate(&dayInt, &monthInt, &yearInt); hal->gfx()->setTextCenterAligned(); @@ -61,14 +61,14 @@ void OswAppWatchfaceNumerals::drawWatch() { #endif // ticks - uint32_t second = 0; - uint32_t minute = 0; - uint32_t hour = 0; + uint8_t second = 0; + uint8_t minute = 0; + uint8_t hour = 0; hal->getLocalTime(&hour, &minute, &second); if(OswConfigAllKeys::settingDisplayDualHourTick.get()) { - uint32_t dualSecond = 0; - uint32_t dualMinute = 0; - uint32_t dualHour = 0; + uint8_t dualSecond = 0; + uint8_t dualMinute = 0; + uint8_t dualHour = 0; hal->getDualTime(&dualHour, &dualMinute, &dualSecond); // dual-hours diff --git a/src/hal/environment.cpp b/src/hal/environment.cpp index b233e94cb..b3f4e5ebc 100644 --- a/src/hal/environment.cpp +++ b/src/hal/environment.cpp @@ -132,9 +132,8 @@ void OswHal::Environment::setupStepStatistics() { * @param alwaysPrintStepStatistics Set to true to print the step history to the console */ void OswHal::Environment::commitStepStatistics(const bool& alwaysPrintStepStatistics) { - uint32_t currDoM = 0; // Unused, but required by function signature - uint32_t currDoW = 0; - OswHal::getInstance()->getLocalDate(&currDoM, &currDoW); + uint8_t currDoW = 0; + OswHal::getInstance()->getLocalDate(nullptr, &currDoW); bool changedDoW = currDoW != this->_stepsLastDoW; if(changedDoW) { Preferences prefs; @@ -196,8 +195,8 @@ void OswHal::Environment::commitStepStatistics(const bool& alwaysPrintStepStatis uint32_t OswHal::Environment::getStepsOnDay(uint8_t dayOfWeek, bool lastWeek) { this->commitStepStatistics(); - uint32_t day = 0; - uint32_t weekday = 0; + uint8_t day = 0; + uint8_t weekday = 0; OswHal::getInstance()->getLocalDate(&day, &weekday); if (!lastWeek and dayOfWeek == weekday) @@ -225,9 +224,8 @@ uint32_t OswHal::Environment::getStepsTotalWeek() { #ifdef OSW_FEATURE_STATS_STEPS this->commitStepStatistics(); uint32_t sum = 0; - uint32_t currDoM = 0; // Unused, but required by function signature - uint32_t currDoW = 0; - OswHal::getInstance()->getLocalDate(&currDoM, &currDoW); + uint8_t currDoW = 0; + OswHal::getInstance()->getLocalDate(nullptr, &currDoW); for (uint8_t i = 0; i < 7; i++) { if (i == currDoW) { sum = sum + this->getStepsToday();