Skip to content

Commit

Permalink
#43 You cannot do a sizeof() in a *pointer
Browse files Browse the repository at this point in the history
  • Loading branch information
martinberlin committed Jul 13, 2021
1 parent c09a2c9 commit e2740fa
Show file tree
Hide file tree
Showing 2 changed files with 1,646 additions and 4 deletions.
8 changes: 4 additions & 4 deletions components/CalEPD/models/color/wave5i7Color.cpp
Expand Up @@ -32,12 +32,12 @@ void Wave5i7Color::fillScreen(uint16_t color)
{
uint8_t pv = _color7(color);
uint8_t pv2 = pv | pv << 4;
for (uint32_t x = 0; x < sizeof(_buffer); x++)
for (uint32_t x = 0; x < WAVE5I7COLOR_BUFFER_SIZE; x++)
{
_buffer[x] = pv2;
}

if (debug_enabled) printf("fillScreen(%x) black/red _buffer len:%d\n", color, sizeof(_buffer));
if (debug_enabled) printf("fillScreen(%x) buffer size:%d\n", color, WAVE5I7COLOR_BUFFER_SIZE);
}

void Wave5i7Color::_wakeUp(){
Expand Down Expand Up @@ -114,7 +114,7 @@ void Wave5i7Color::update()
{
for (uint16_t x = 1; x <= xLineBytes; x++)
{
uint8_t data = i < sizeof(_buffer) ? _buffer[i] : 0x33;
uint8_t data = i < WAVE5I7COLOR_BUFFER_SIZE ? _buffer[i] : 0x33;
x1buf[x - 1] = data;
if (x == xLineBytes)
{ // Flush the X line buffer to SPI
Expand All @@ -129,7 +129,7 @@ void Wave5i7Color::update()
}

} else {
for (uint32_t i = 0; i < sizeof(_buffer); i++) {
for (uint32_t i = 0; i < WAVE5I7COLOR_BUFFER_SIZE; i++) {
IO.data(_buffer[i]);
}
}
Expand Down

0 comments on commit e2740fa

Please sign in to comment.