mirror of
https://github.com/gunner47/GyverLamp.git
synced 2025-08-08 17:30:59 +03:00
Оптимизация использования памяти
This commit is contained in:
@@ -3,16 +3,17 @@
|
||||
// залить все
|
||||
void fillAll(CRGB color)
|
||||
{
|
||||
for (int32_t i = 0; i < NUM_LEDS; i++) {
|
||||
for (int32_t i = 0; i < NUM_LEDS; i++)
|
||||
{
|
||||
leds[i] = color;
|
||||
}
|
||||
}
|
||||
|
||||
// функция отрисовки точки по координатам X Y
|
||||
void drawPixelXY(int8_t x, int8_t y, CRGB color)
|
||||
void drawPixelXY(uint8_t x, uint8_t y, CRGB color)
|
||||
{
|
||||
if (x < 0 || x > WIDTH - 1 || y < 0 || y > HEIGHT - 1) return;
|
||||
int32_t thisPixel = getPixelNumber(x, y) * SEGMENTS;
|
||||
uint32_t thisPixel = getPixelNumber(x, y) * SEGMENTS;
|
||||
for (uint8_t i = 0; i < SEGMENTS; i++)
|
||||
{
|
||||
leds[thisPixel + i] = color;
|
||||
@@ -28,7 +29,7 @@ uint32_t getPixColor(uint32_t thisSegm)
|
||||
}
|
||||
|
||||
// функция получения цвета пикселя в матрице по его координатам
|
||||
uint32_t getPixColorXY(int8_t x, int8_t y)
|
||||
uint32_t getPixColorXY(uint8_t x, uint8_t y)
|
||||
{
|
||||
return getPixColor(getPixelNumber(x, y));
|
||||
}
|
||||
@@ -83,7 +84,7 @@ uint32_t getPixColorXY(int8_t x, int8_t y)
|
||||
#endif
|
||||
|
||||
// получить номер пикселя в ленте по координатам
|
||||
uint16_t getPixelNumber(int8_t x, int8_t y)
|
||||
uint16_t getPixelNumber(uint8_t x, uint8_t y)
|
||||
{
|
||||
if ((THIS_Y % 2 == 0) || MATRIX_TYPE) // если чётная строка
|
||||
{
|
||||
|
Reference in New Issue
Block a user