aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authormrfaptastic <12006953+mrfaptastic@users.noreply.github.com>2020-12-07 18:19:31 +0000
committerGitHub <noreply@github.com>2020-12-07 18:19:31 +0000
commit3cda03ab83cc9309bf237f37c03b9e09a0cc2501 (patch)
tree9253bfad7645761e6cbcd486d3578e0331a33b07 /examples
parentc72dbb136056e6a2176005a9ef6d4220dedaf182 (diff)
parentfd4694046449ef27dc73e055af654a650db9e7e5 (diff)
Merge pull request #44 from vortigont/brtctrl
FastMode with brightness control + various other code optimisations.
Diffstat (limited to 'examples')
-rw-r--r--examples/AuroraDemo/AuroraDemo.ino13
-rw-r--r--examples/AuroraDemo/PatternSwirl.h2
-rw-r--r--examples/FM6126Panel/FM6126Panel.ino36
3 files changed, 44 insertions, 7 deletions
diff --git a/examples/AuroraDemo/AuroraDemo.ino b/examples/AuroraDemo/AuroraDemo.ino
index a85d524..002a1ed 100644
--- a/examples/AuroraDemo/AuroraDemo.ino
+++ b/examples/AuroraDemo/AuroraDemo.ino
@@ -47,6 +47,19 @@ void setup()
Serial.begin(115200);
delay(250);
matrix.begin(R1_PIN, G1_PIN, B1_PIN, R2_PIN, G2_PIN, B2_PIN, A_PIN, B_PIN, C_PIN, D_PIN, E_PIN, LAT_PIN, OE_PIN, CLK_PIN ); // setup the LED matrix
+ /**
+ * this demos runs pretty fine in fast-mode which gives much better fps on large matrixes (>128x64)
+ * see comments in the lib header on what does that means
+ */
+ //dma_display.setFastMode(true);
+
+ // SETS THE BRIGHTNESS HERE. MAX value is MATRIX_WIDTH, 2/3 OR LOWER IDEAL, default is about 50%
+ // dma_display.setPanelBrightness(30);
+ /* another way to change brightness is to use
+ * dma_display.setPanelBrightness8(uint8_t brt); // were brt is within range 0-255
+ * it will recalculate to consider matrix width automatically
+ */
+ //dma_display.setPanelBrightness8(180);
Serial.println("**************** Starting Aurora Effects Demo ****************");
diff --git a/examples/AuroraDemo/PatternSwirl.h b/examples/AuroraDemo/PatternSwirl.h
index e3baf2f..74e5305 100644
--- a/examples/AuroraDemo/PatternSwirl.h
+++ b/examples/AuroraDemo/PatternSwirl.h
@@ -44,7 +44,7 @@ class PatternSwirl : public Drawable {
// Note that we never actually clear the matrix, we just constantly
// blur it repeatedly. Since the blurring is 'lossy', there's
// an automatic trend toward black -- by design.
- uint8_t blurAmount = beatsin8(2, 10, 255)
+ uint8_t blurAmount = beatsin8(2, 10, 255);
#if FASTLED_VERSION >= 3001000
blur2d(effects.leds, MATRIX_WIDTH > 255 ? 255 : MATRIX_WIDTH, MATRIX_HEIGHT > 255 ? 255 : MATRIX_HEIGHT, blurAmount);
diff --git a/examples/FM6126Panel/FM6126Panel.ino b/examples/FM6126Panel/FM6126Panel.ino
index e5d92bc..45eae70 100644
--- a/examples/FM6126Panel/FM6126Panel.ino
+++ b/examples/FM6126Panel/FM6126Panel.ino
@@ -44,8 +44,8 @@ MatrixPanel_I2S_DMA dma_display;
// End of default setup for RGB Matrix 64x32 panel
///////////////////////////////////////////////////////////////
-int time_counter = 0;
-int cycles = 0;
+uint16_t time_counter = 0, cycles = 0, fps = 0;
+unsigned long fps_timer;
CRGB currentColor;
CRGBPalette16 palettes[] = {HeatColors_p, LavaColors_p, RainbowColors_p, RainbowStripeColors_p, CloudColors_p};
@@ -62,13 +62,28 @@ void setup(){
// Panels are the same - some seem to display ghosting artefacts at lower brightness levels.
// In the setup() function do something like:
- dma_display.setPanelBrightness(30); // SETS THE BRIGHTNESS HERE. 60 OR LOWER IDEAL.
+ // SETS THE BRIGHTNESS HERE. MAX value is MATRIX_WIDTH, 2/3 OR LOWER IDEAL, default is about 50%
+ // dma_display.setPanelBrightness(30);
+
+ /* another way to change brightness is to use
+ * dma_display.setPanelBrightness8(uint8_t brt); // were brt is within range 0-255
+ * it will recalculate to consider matrix width automatically
+ */
+ //dma_display.setPanelBrightness8(180);
+
+ /**
+ * this demo runs pretty fine in fast-mode which gives much better fps on large matrixes (>128x64)
+ * see comments in the lib header on what does that means
+ */
+ dma_display.setFastMode(true);
/**
- * be sure to specify 'FM6126A' as last parametr to the begin(),
+ * Run display on our matrix, be sure to specify 'FM6126A' as last parametr to the begin(),
* it would reset 6126 registers and enables the matrix
*/
dma_display.begin(R1, G1, BL1, R2, G2, BL2, CH_A, CH_B, CH_C, CH_D, CH_E, LAT, OE, CLK, FM6126A);
+
+ fps_timer = millis();
}
void loop(){
@@ -85,12 +100,21 @@ void loop(){
}
}
- time_counter += 1;
- cycles++;
+ ++time_counter;
+ ++cycles;
+ ++fps;
if (cycles >= 1024) {
time_counter = 0;
cycles = 0;
currentPalette = palettes[random(0,sizeof(palettes)/sizeof(palettes[0]))];
}
+
+ // print FPS rate every 5 seconds
+ // Note: this is NOT a matrix refresh rate, it's the number of data frames being drawn to the DMA buffer per second
+ if (fps_timer + 5000 < millis()){
+ Serial.printf_P(PSTR("Effect fps: %d\n"), fps/5);
+ fps_timer = millis();
+ fps = 0;
+ }
} \ No newline at end of file