summaryrefslogtreecommitdiff
path: root/anzeige.c
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-10-23 11:46:56 +0200
committerErich Eckner <git@eckner.net>2018-10-23 11:46:56 +0200
commit9f93cef448a07c102685c1f31b7e0c722b784f98 (patch)
tree81b27b13c75666fa868f152333095057acd0f238 /anzeige.c
parent8bb5c8d45bd83dccd4fba224ccd347e6cdd74cf0 (diff)
downloadanzeige-9f93cef448a07c102685c1f31b7e0c722b784f98.tar.xz
anzeige.c: längerer Text-Puffer, kleine Bugs entfernt
Diffstat (limited to 'anzeige.c')
-rw-r--r--anzeige.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/anzeige.c b/anzeige.c
index b10d319..77b0cc3 100644
--- a/anzeige.c
+++ b/anzeige.c
@@ -20,6 +20,7 @@ int main(int argc, char **argv)
pthread_t thread_id;
t_display_data display_data;
int ret_val;
+ #define TEXT_BUFFER_LENGTH 42
unsigned char *text_buffer;
t_scroll_buffer scroll_buffers[2];
@@ -43,24 +44,24 @@ int main(int argc, char **argv)
int i,j,k;
- text_buffer = malloc(24);
+ text_buffer = malloc(TEXT_BUFFER_LENGTH);
if (text_buffer == NULL) {
fprintf(stderr, "malloc failed to allocate 24 bytes\n");
exit(EXIT_FAILURE);
}
- memset(text_buffer, 0, sizeof(text_buffer));
+ memset(text_buffer, 0, TEXT_BUFFER_LENGTH);
- ret_val = gadgets_retrieve_temperature(text_buffer,sizeof(text_buffer));
+ ret_val = gadgets_retrieve_temperature(text_buffer,TEXT_BUFFER_LENGTH);
if (ret_val) {
free(text_buffer);
exit(ret_val);
}
- scroll_buffers[0].scroll_len = render(text_buffer, sizeof(text_buffer), scroll_buffers[0].buf, sizeof(scroll_buffers[0].buf), 1);
+ scroll_buffers[0].scroll_len = render(text_buffer, TEXT_BUFFER_LENGTH, scroll_buffers[0].buf, sizeof(scroll_buffers[0].buf), 1);
- for (i=0; i<100; i++) {
- usleep(250000);
- for (j=0; j<39; j++)
+ for (i=0; i<250; i++) {
+ usleep(100000);
+ for (j=0; j<40; j++)
display_data.buf[(display_data.should_buf+1)%3][j] = scroll_buffers[0].buf[(i+j) % scroll_buffers[0].scroll_len];
display_data.should_buf = (display_data.should_buf+1)%3;
}