Skip to content

Commit

Permalink
Fixed update of peak indicator
Browse files Browse the repository at this point in the history
  • Loading branch information
adamples committed May 14, 2018
1 parent ac765da commit e31dd53
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ vu_meter_update(vu_meter_t *meter, uint8_t angle)

needle_sprite_draw(&(meter->needle), angle);
needle_sprite_add_to_extents(&(meter->needle), &(meter->update_extents));
progmem_image_sprite_add_to_extents(&PEAK_INDICATOR_SPRITE, &(meter->update_extents));
update_extents_optimize(&(meter->update_extents));

display_update_partial_async(&(meter->display), &(meter->update_extents));
Expand Down
8 changes: 8 additions & 0 deletions src/progmem_image_sprite.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,11 @@ progmem_image_sprite_init(progmem_image_sprite_t *image, const uint8_t *data, ui
image->height = pgm_read_byte(data + 1) / SSD1306_PAGE_HEIGHT;
image->data = data + 2;
}


void
progmem_image_sprite_add_to_extents(progmem_image_sprite_t *image, update_extents_t *extents)
{
for (uint8_t page = image->page; page < image->page + image->height; ++page)
update_extents_add_region(extents, page, image->column, image->column + image->width - 1);
}
2 changes: 2 additions & 0 deletions src/progmem_image_sprite.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,7 @@ typedef struct progmem_image_sprite_t_ {
void progmem_image_sprite_init(progmem_image_sprite_t *image,
const uint8_t *data, uint8_t column, uint8_t page);

void progmem_image_sprite_add_to_extents(progmem_image_sprite_t *needle, update_extents_t *extents);


#endif /* PROGMEM_IMAGE_SPRITE_H */

0 comments on commit e31dd53

Please sign in to comment.