From 6f6510991cde3669a1ae7b3a11e13adc46bee28c Mon Sep 17 00:00:00 2001 From: Dirk Petrautzki Date: Sat, 17 Apr 2021 13:13:44 +0200 Subject: [PATCH 1/2] Use all four colors in random pixel example --- examples/RandomPixels/RandomPixels.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/RandomPixels/RandomPixels.ino b/examples/RandomPixels/RandomPixels.ino index acbabaa..9018a8d 100644 --- a/examples/RandomPixels/RandomPixels.ino +++ b/examples/RandomPixels/RandomPixels.ino @@ -9,5 +9,5 @@ void setup() { void loop() { static unsigned cnt; cnt++; - vga.putpixel(rand()%VGAX_WIDTH, rand()%VGAX_HEIGHT, cnt%3); + vga.putpixel(rand()%VGAX_WIDTH, rand()%VGAX_HEIGHT, cnt%4); } \ No newline at end of file From 502c5bcc76014369af5ccddc1fc9b960aeb1e9cb Mon Sep 17 00:00:00 2001 From: Dirk Petrautzki Date: Sat, 17 Apr 2021 13:14:32 +0200 Subject: [PATCH 2/2] Fix vtimer overflowing --- VGAX.cpp | 2 +- VGAX.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/VGAX.cpp b/VGAX.cpp index 21636c0..2574378 100644 --- a/VGAX.cpp +++ b/VGAX.cpp @@ -35,7 +35,7 @@ You can modify this value to center the framebuffer vertically, or not*/ #endif static byte afreq, afreq0; -unsigned vtimer; +unsigned long vtimer; static byte aline, rlinecnt; static byte vskip; byte vgaxfb[VGAX_HEIGHT*VGAX_BWIDTH]; diff --git a/VGAX.h b/VGAX.h index 3d6f49b..7590479 100644 --- a/VGAX.h +++ b/VGAX.h @@ -52,7 +52,7 @@ HERE you can find some inline documentation about the VGAX library class extern byte vgaxfb[VGAX_HEIGHT*VGAX_BWIDTH]; //clock replacement. this is increment in the VSYNC interrupt, so run at 60Hz -extern unsigned vtimer; +extern unsigned long vtimer; //VGAX class. This is a static class. Multiple instances will not work class VGAX { @@ -224,7 +224,7 @@ class VGAX { * millis() * return the number of milliseconds ellapsed */ - static inline unsigned millis() { + static inline unsigned long millis() { return vtimer*16; } /*