Skip to content

Commit

Permalink
0.52
Browse files Browse the repository at this point in the history
- Changes setting keys to keep data small, please update your API requests!
- Adds setting to disable weekdays. closes #58
- Adds setting to change weekday color
- Smaller bugfixes
  • Loading branch information
Blueforcer committed Apr 15, 2023
1 parent f24249e commit 17c3434
Show file tree
Hide file tree
Showing 13 changed files with 290 additions and 123 deletions.
29 changes: 17 additions & 12 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,18 +230,23 @@ Each property is optional; you do not need to send all.

| Key | Type | Description | Value Range | Default |
| --- | --- | --- | --- | --- |
| `apptime` | number | Determines the duration an app is displayed in milliseconds. | Any positive integer value. | 7000 |
| `transition` | number | The time the transition to the next app takes in milliseconds. | Any positive integer value. | 500 |
| `textcolor` | string / array of ints| A color in hexadecimal format. | an array of RGB values `[255,0,0]` or any valid 6-digit hexadecimal color value, e.g. "#FF0000" for red. | N/A |
| `fps` | number | Determines the frame rate at which the matrix is updated. | Any positive integer value. | 23 |
| `brightness` | number | Determines the brightness of the matrix. | An integer between 0 and 255. | N/A |
| `auto_brightness` | boolean | Determines if automatic brightness control is active. | `true` or `false`. | N/A |
| `auto_transition` | boolean | Determines if automatic switching to the next app is active. | `true` or `false`. | N/A |
| `color_correction` | array of ints | Sets the color correction for the matrix | an array of RGB values | N/A |
| `color_temperature` | array of ints | Sets the color temperature for the matrix | an array of RGB values | N/A |
| `gamma` | float | Sets the gamma for the matrix | 2.5 | N/A |
| `timeformat` | string | Sets the timeformat for the TimeApp | see below | N/A |
| `dateformat` | string | Sets the dateformat for the DateApp | see below | N/A |
| `ATIME` | number | Determines the duration an app is displayed in milliseconds. | Any positive integer value. | 7000 |
| `TSPEED` | number | The time the transition to the next app takes in milliseconds. | Any positive integer value. | 500 |
| `TCOL` | string / array of ints| Sets the textcolor | an array of RGB values `[255,0,0]` or any valid 6-digit hexadecimal color value, e.g. "#FF0000" for red. | N/A |
| `WD` | bool | Enable or disable the weekday display | true/false | true |
| `WDCA` | string / array of ints| Sets the active weekday color | an array of RGB values `[255,0,0]` or any valid 6-digit hexadecimal color value, e.g. "#FF0000" for red. | N/A |
| `WDCI` | string / array of ints| Sets the inactive weekday color | an array of RGB values `[255,0,0]` or any valid 6-digit hexadecimal color value, e.g. "#FFFF" for red. | N/A |
| `FPS` | number | Determines the frame rate at which the matrix is updated. | Any positive integer value. | 23 |
| `BRI` | number | Determines the brightness of the matrix. | An integer between 0 and 255. | N/A |
| `ABRI` | boolean | Determines if automatic brightness control is active. | `true` or `false`. | N/A |
| `ATRANS` | boolean | Determines if automatic switching to the next app is active. | `true` or `false`. | N/A |
| `CCORRECTION` | array of ints | Sets the color correction for the matrix | an array of RGB values | N/A |
| `CTEMP` | array of ints | Sets the color temperature for the matrix | an array of RGB values | N/A |
| `GAMMA` | float | Sets the gamma for the matrix | 2.5 | N/A |
| `TFORMAT` | string | Sets the timeformat for the TimeApp | see below | N/A |
| `DFORMAT` | string | Sets the dateformat for the DateApp | see below | N/A |
| `SOM` | bool | Sets the start of the week to sunday | true/false | false |


**Timeformats:**
```bash
Expand Down
8 changes: 8 additions & 0 deletions lib/MatrixUI/MatrixDisplayUi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,14 @@ void MatrixDisplayUi::resetState()
}
}

void MatrixDisplayUi::forceResetState()
{
this->state.lastUpdate = 0;
this->state.ticksSinceLastStateSwitch = 0;
this->state.appState = FIXED;
this->state.currentApp = 0;
}

void MatrixDisplayUi::drawOverlays()
{
for (uint8_t i = 0; i < this->overlayCount; i++)
Expand Down
2 changes: 1 addition & 1 deletion lib/MatrixUI/MatrixDisplayUi.h
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ class MatrixDisplayUi
void setApps(const std::vector<std::pair<String, AppCallback>> &appPairs);

// Overlay

void forceResetState();
/**
* Add overlays drawing functions that are draw independent of the Apps
*/
Expand Down
12 changes: 6 additions & 6 deletions src/Apps.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ Notification notify;

std::vector<std::pair<String, AppCallback>> Apps;

CustomApp *getCustomAppById(String name)
CustomApp *getCustomAppByName(String name)
{
return customApps.count(name) ? &customApps[name] : nullptr;
}
Expand Down Expand Up @@ -154,11 +154,11 @@ void TimeApp(FastLED_NeoMatrix *matrix, MatrixDisplayUiState *state, int16_t x,
{
if (i == (timeInfo->tm_wday + 6 + dayOffset) % 7)
{
matrix->drawLine((2 + i * 4) + x, y + 7, (i * 4 + 4) + x, y + 7, matrix->Color(200, 200, 200));
matrix->drawLine((2 + i * 4) + x, y + 7, (i * 4 + 4) + x, y + 7, WDC_ACTIVE);
}
else
{
matrix->drawLine((2 + i * 4) + x, y + 7, (i * 4 + 4) + x, y + 7, matrix->Color(100, 100, 100));
matrix->drawLine((2 + i * 4) + x, y + 7, (i * 4 + 4) + x, y + 7, WDC_INACTIVE);
}
}
}
Expand All @@ -182,11 +182,11 @@ void DateApp(FastLED_NeoMatrix *matrix, MatrixDisplayUiState *state, int16_t x,
{
if (i == (timeInfo->tm_wday + 6 + dayOffset) % 7)
{
matrix->drawLine((2 + i * 4) + x, y + 7, (i * 4 + 4) + x, y + 7, matrix->Color(200, 200, 200));
matrix->drawLine((2 + i * 4) + x, y + 7, (i * 4 + 4) + x, y + 7, WDC_ACTIVE);
}
else
{
matrix->drawLine((2 + i * 4) + x, y + 7, (i * 4 + 4) + x, y + 7, matrix->Color(100, 100, 100));
matrix->drawLine((2 + i * 4) + x, y + 7, (i * 4 + 4) + x, y + 7, WDC_INACTIVE);
}
}
}
Expand Down Expand Up @@ -312,7 +312,7 @@ void ShowCustomApp(String name, FastLED_NeoMatrix *matrix, MatrixDisplayUiState
}

// Get custom App by ID
CustomApp *ca = getCustomAppById(name);
CustomApp *ca = getCustomAppByName(name);

// Abort if custom App not found
if (ca == nullptr)
Expand Down
Loading

0 comments on commit 17c3434

Please sign in to comment.