Skip to content

Commit

Permalink
fix: show pixel logs
Browse files Browse the repository at this point in the history
  • Loading branch information
silvelo committed Jul 19, 2024
1 parent 04654b5 commit 9c5f4e0
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 7 deletions.
25 changes: 19 additions & 6 deletions include/LedManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,30 @@ class LedManager {
{true, true, true, true, true, true, false},
};

/* bool minuteSegments[10][7] = {
{true, true, true, false, true, true, true},
{false, false, true, false, false, false, true},
{true, true, false, true, false, true, true},
{false, true, true, true, false, true, true},
{false, false, true, true, true, false, true},
{false, true, true, true, true, true, false},
{true, true, true, true, true, true, false},
{false, false, true, false, false, true, true},
{true, true, true, true, true, true, true},
{false, true, true, true, true, true, true},
}; */

bool minuteSegments[10][7] = {
{true, true, true, false, true, true, true},
{false, false, true, false, false, false, true},
{true, true, false, true, false, true, true},
{false, true, true, true, false, true, true},
{false, false, true, true, true, false, true},
{false, true, true, true, true, true, false},
{true, true, true, true, true, true, false},
{false, false, true, false, false, true, true},
{false, true, true, true, false, true, true},
{true, false, true, true, false, true, true},
{true, true, false, true, false, true, true},
{true, true, false, true, true, true, true},
{false, true, true, false, false, false, true},
{true, true, true, true, true, true, true},
{false, true, true, true, true, true, true},
{true, true, true, true, false, true, true},
};
};

Expand Down
1 change: 1 addition & 0 deletions include/TimeManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class TimeManager {
void update();
int getHours();
int getMinutes();
int getSeconds();
String getFormattedTime();
void setTimeOffset(int offset);

Expand Down
16 changes: 16 additions & 0 deletions src/LedManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,16 +90,32 @@ void LedManager::showHourDigit(int number, int startPixel, uint32_t color) {
}

void LedManager::showMinuteDigit(int number, int startPixel, uint32_t color) {
Serial.println("Number " + String(number));
for (int i = 0; i < MINUTE_SEGMENT; i++) {
Serial.println("Segment number " + String(i));
if (minuteSegments[number][i]) {
Serial.println("Power On pixels:");
for (int j = 0; j < ledsPerSegment; j++) {
Serial.print("[");
Serial.print(" Start Pixel: ");
Serial.print(startPixel);
Serial.print(" i: ");
Serial.print(i);
Serial.print(" ledsPerSegment: ");
Serial.print(ledsPerSegment);
Serial.print(" j: ");
Serial.print(j);
Serial.print("] - ");
Serial.print(startPixel + (i * ledsPerSegment) + j);
minutesStrip.setPixelColor(startPixel + (i * ledsPerSegment) + j, color);
Serial.println();
}
} else {
for (int j = 0; j < ledsPerSegment; j++) {
minutesStrip.setPixelColor(startPixel + (i * ledsPerSegment) + j,
minutesStrip.Color(0, 0, 0));
}
}
Serial.println();
}
}
3 changes: 3 additions & 0 deletions src/SleepManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ void SleepManager::setHours() {
}

bool SleepManager::update(String actualDate) {
if (startHour == "" || endHour == "") {
return false;
}
std::pair<bool, int> result = isCurrentTimeBetween(actualDate, startHour, endHour);
return result.first;
}
Expand Down
5 changes: 5 additions & 0 deletions src/TimeManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ int TimeManager::getMinutes() {
return timeClient->getMinutes();
}

int TimeManager::getSeconds() {
Serial.println("Get Seconds");
return timeClient->getSeconds();
}

void TimeManager::setTimeOffset(int offset) {
Serial.println("Change Time Offset");
timeClient->setTimeOffset(offset * 3600);
Expand Down
3 changes: 2 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,13 @@ void loop() {
timeManager.update();

bool isSleep = sleepManager.update(timeManager.getFormattedTime());
Serial.println("Is Sleep:" + String(isSleep));
if (isSleep) {
Serial.println("Is Sleep:" + String(isSleep));
ledManager.end();
} else {
int hours = timeManager.getHours();
int minutes = timeManager.getMinutes();
// int minutes = timeManager.getSeconds();

Serial.println(timeManager.getFormattedTime());

Expand Down

0 comments on commit 9c5f4e0

Please sign in to comment.