mirror of
https://github.com/gunner47/GyverLamp.git
synced 2025-08-08 09:20:59 +03:00
Исправлена ошибка работы будильника
This commit is contained in:
@@ -51,7 +51,7 @@ uint8_t line[WIDTH];
|
|||||||
uint8_t pcnt = 0;
|
uint8_t pcnt = 0;
|
||||||
|
|
||||||
//these values are substracetd from the generated values to give a shape to the animation
|
//these values are substracetd from the generated values to give a shape to the animation
|
||||||
const uint8_t valueMask[8][16] PROGMEM =
|
static const uint8_t valueMask[8][16] PROGMEM =
|
||||||
{
|
{
|
||||||
{32 , 0 , 0 , 0 , 0 , 0 , 0 , 32 , 32 , 0 , 0 , 0 , 0 , 0 , 0 , 32 },
|
{32 , 0 , 0 , 0 , 0 , 0 , 0 , 32 , 32 , 0 , 0 , 0 , 0 , 0 , 0 , 32 },
|
||||||
{64 , 0 , 0 , 0 , 0 , 0 , 0 , 64 , 64 , 0 , 0 , 0 , 0 , 0 , 0 , 64 },
|
{64 , 0 , 0 , 0 , 0 , 0 , 0 , 64 , 64 , 0 , 0 , 0 , 0 , 0 , 0 , 64 },
|
||||||
@@ -65,7 +65,7 @@ const uint8_t valueMask[8][16] PROGMEM =
|
|||||||
|
|
||||||
//these are the hues for the fire,
|
//these are the hues for the fire,
|
||||||
//should be between 0 (red) to about 25 (yellow)
|
//should be between 0 (red) to about 25 (yellow)
|
||||||
const uint8_t hueMask[8][16] PROGMEM =
|
static const uint8_t hueMask[8][16] PROGMEM =
|
||||||
{
|
{
|
||||||
{1 , 11, 19, 25, 25, 22, 11, 1 , 1 , 11, 19, 25, 25, 22, 11, 1 },
|
{1 , 11, 19, 25, 25, 22, 11, 1 , 1 , 11, 19, 25, 25, 22, 11, 1 },
|
||||||
{1 , 8 , 13, 19, 25, 19, 8 , 1 , 1 , 8 , 13, 19, 25, 19, 8 , 1 },
|
{1 , 8 , 13, 19, 25, 19, 8 , 1 , 1 , 8 , 13, 19, 25, 19, 8 , 1 },
|
||||||
@@ -145,10 +145,10 @@ void drawFrame(uint8_t pcnt)
|
|||||||
nextv =
|
nextv =
|
||||||
(((100.0 - pcnt) * matrixValue[y][newX]
|
(((100.0 - pcnt) * matrixValue[y][newX]
|
||||||
+ pcnt * matrixValue[y - 1][newX]) / 100.0)
|
+ pcnt * matrixValue[y - 1][newX]) / 100.0)
|
||||||
- pgm_read_byte(&(valueMask[y][newX]));
|
- pgm_read_byte(&valueMask[y][newX]);
|
||||||
|
|
||||||
CRGB color = CHSV(
|
CRGB color = CHSV(
|
||||||
modes[EFF_FIRE].Scale * 2.5 + pgm_read_byte(&(hueMask[y][newX])), // H
|
modes[EFF_FIRE].Scale * 2.5 + pgm_read_byte(&hueMask[y][newX]), // H
|
||||||
255, // S
|
255, // S
|
||||||
(uint8_t)max(0, nextv) // V
|
(uint8_t)max(0, nextv) // V
|
||||||
);
|
);
|
||||||
|
@@ -47,20 +47,21 @@ void timeTick()
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
byte thisDay = timeClient.getDay();
|
byte thisDay = timeClient.getDay();
|
||||||
if (thisDay == 0) thisDay = 7; // воскресенье это 0
|
if (thisDay == 0) thisDay = 7; // воскресенье это 0
|
||||||
thisDay--;
|
thisDay--;
|
||||||
thisTime = timeClient.getHours() * 60 + timeClient.getMinutes();
|
thisTime = timeClient.getHours() * 60 + timeClient.getMinutes();
|
||||||
|
|
||||||
// проверка рассвета
|
// проверка рассвета
|
||||||
if (alarms[thisDay].State && // день будильника
|
if (alarms[thisDay].State && // день будильника
|
||||||
thisTime >= (alarms[thisDay].Time - dawnOffsets[dawnMode]) && // позже начала
|
thisTime >= (alarms[thisDay].Time - pgm_read_byte(&dawnOffsets[dawnMode])) && // позже начала
|
||||||
thisTime < (alarms[thisDay].Time + DAWN_TIMEOUT)) // раньше конца + минута
|
thisTime < (alarms[thisDay].Time + DAWN_TIMEOUT)) // раньше конца + минута
|
||||||
{
|
{
|
||||||
if (!manualOff) // будильник не был выключен вручную (из приложения или кнопкой)
|
if (!manualOff) // будильник не был выключен вручную (из приложения или кнопкой)
|
||||||
{
|
{
|
||||||
// величина рассвета 0-255
|
// величина рассвета 0-255
|
||||||
int32_t dawnPosition = 255 * ((float)(thisTime - (alarms[thisDay].Time - dawnOffsets[dawnMode])) / dawnOffsets[dawnMode]);
|
int32_t dawnPosition = 255 * ((float)(thisTime - (alarms[thisDay].Time - pgm_read_byte(&dawnOffsets[dawnMode]))) / pgm_read_byte(&dawnOffsets[dawnMode]));
|
||||||
dawnPosition = constrain(dawnPosition, 0, 255);
|
dawnPosition = constrain(dawnPosition, 0, 255);
|
||||||
CHSV dawnColor = CHSV(map(dawnPosition, 0, 255, 10, 35),
|
CHSV dawnColor = CHSV(map(dawnPosition, 0, 255, 10, 35),
|
||||||
map(dawnPosition, 0, 255, 255, 170),
|
map(dawnPosition, 0, 255, 255, 170),
|
||||||
|
Reference in New Issue
Block a user