From d69584a6979886ec5e45032a5adfaf5214a9af3e Mon Sep 17 00:00:00 2001 From: root Date: Fri, 30 Aug 2013 06:33:44 +0000 Subject: [PATCH] Use const. --- .../LoLShield_BasicTest/LoLShield_BasicTest.pde | 2 +- .../LoLShield_Breathe/LoLShield_Breathe.pde | 8 ++++---- .../LoLShield_DoubleHelix.ino | 16 ++++++++-------- .../LoLShield_FadeTest/LoLShield_FadeTest.pde | 8 ++++---- lib/examples/LoLShield_Life/LoLShield_Life.pde | 2 +- lib/examples/LoLShield_Pong/LoLShield_Pong.pde | 2 +- 6 files changed, 19 insertions(+), 19 deletions(-) diff --git a/lib/examples/LoLShield_BasicTest/LoLShield_BasicTest.pde b/lib/examples/LoLShield_BasicTest/LoLShield_BasicTest.pde index ee76c23..689908e 100644 --- a/lib/examples/LoLShield_BasicTest/LoLShield_BasicTest.pde +++ b/lib/examples/LoLShield_BasicTest/LoLShield_BasicTest.pde @@ -33,7 +33,7 @@ //Initialized in setup. //Sets the time each frame is shown (milliseconds) -unsigned int blinkdelay = 1000 / 50; +const unsigned int blinkdelay = 1000 / 50; /* The BitMap array is what contains the frame data. Each line is one full frame. diff --git a/lib/examples/LoLShield_Breathe/LoLShield_Breathe.pde b/lib/examples/LoLShield_Breathe/LoLShield_Breathe.pde index ad990e5..e09a8ba 100644 --- a/lib/examples/LoLShield_Breathe/LoLShield_Breathe.pde +++ b/lib/examples/LoLShield_Breathe/LoLShield_Breathe.pde @@ -22,10 +22,10 @@ #include "Charliplexing.h" -unsigned int inhale_time_ms = 500; -unsigned int hold_breath_ms = 600; -unsigned int exhale_time_ms = 800; -unsigned int pause_breath_ms = 2000; +const unsigned int inhale_time_ms = 500; +const unsigned int hold_breath_ms = 600; +const unsigned int exhale_time_ms = 800; +const unsigned int pause_breath_ms = 2000; void setup() // run once, when the sketch starts { diff --git a/lib/examples/LoLShield_DoubleHelix/LoLShield_DoubleHelix.ino b/lib/examples/LoLShield_DoubleHelix/LoLShield_DoubleHelix.ino index 500d46c..bb120cd 100644 --- a/lib/examples/LoLShield_DoubleHelix/LoLShield_DoubleHelix.ino +++ b/lib/examples/LoLShield_DoubleHelix/LoLShield_DoubleHelix.ino @@ -20,23 +20,23 @@ // You can tweak these values to create a custom DNA molecule :) // -float stretch = 0.44; // The width of each sine wave. Smaller values create wider sine waves. I like 0.44 . +const float stretch = 0.44; // The width of each sine wave. Smaller values create wider sine waves. I like 0.44 . -float phaseIncrement = 0.1; // How fast the sines move. I like 0.1 . +const float phaseIncrement = 0.1; // How fast the sines move. I like 0.1 . // The phase of the "darker" sine wave will drift (relative to the "lighter" sine wave). // This makes the DoubleHelix more organic/hypnotic . -float driftIncrement = 0.019; // The speed it drifts back and forth. Larger == faster. I like 0.019 . -float driftForce = 0.4; // The visual amount of drift. I like 0.4 . +const float driftIncrement = 0.019; // The speed it drifts back and forth. Larger == faster. I like 0.019 . +const float driftForce = 0.4; // The visual amount of drift. I like 0.4 . // On every other column, light the LEDs between the sine waves, resembling the nucleotides of a DNA molecule. // This looks good if we switch between lighting odd columns, then even columns -- the molecule appears to be moving. -float barPhaseIncrement = 0.09; // Bar movement speed. Plz use values between 0..1 . I like 0.09 . +const float barPhaseIncrement = 0.09; // Bar movement speed. Plz use values between 0..1 . I like 0.09 . // Brightness values. Range is 0..7 -byte lightSineBrightness = 7; -byte darkSineBrightness = 3; -byte barBrightness = 1; +const byte lightSineBrightness = 7; +const byte darkSineBrightness = 3; +const byte barBrightness = 1; // (End tweak section) ///////////////////////////////////////////////////////////////////////////// diff --git a/lib/examples/LoLShield_FadeTest/LoLShield_FadeTest.pde b/lib/examples/LoLShield_FadeTest/LoLShield_FadeTest.pde index 8baa1b6..6aaab07 100644 --- a/lib/examples/LoLShield_FadeTest/LoLShield_FadeTest.pde +++ b/lib/examples/LoLShield_FadeTest/LoLShield_FadeTest.pde @@ -25,13 +25,13 @@ #include "Charliplexing.h" // Screen "refresh" -unsigned int fps = 40; -unsigned int fps_ms = 1000 / fps; +const unsigned int fps = 40; +const unsigned int fps_ms = 1000 / fps; unsigned int frames = 0; // number of frames to wait before advance animation -unsigned int frames_per_step = 10; +const unsigned int frames_per_step = 10; void setup() // run once, when the sketch starts { @@ -41,7 +41,7 @@ void setup() // run once, when the sketch starts uint8_t i = 0; void loop() // run over and over again { - static unsigned long start = 0; + unsigned long start = 0; unsigned long end; for (int row = 0; row < DISPLAY_ROWS; row++) diff --git a/lib/examples/LoLShield_Life/LoLShield_Life.pde b/lib/examples/LoLShield_Life/LoLShield_Life.pde index 1810f3b..1a69bd2 100644 --- a/lib/examples/LoLShield_Life/LoLShield_Life.pde +++ b/lib/examples/LoLShield_Life/LoLShield_Life.pde @@ -36,7 +36,7 @@ #define SIZEX DISPLAY_COLS //Sets the X axis size #define SIZEY DISPLAY_ROWS //Sets the Y axis size byte world[2][SIZEX][SIZEY]; //Creates a double buffer world -long density = 50; //Sets density % during seeding +const int density = 50; //Sets density % during seeding int geck = 0; //Counter for re-seeding void setup() { diff --git a/lib/examples/LoLShield_Pong/LoLShield_Pong.pde b/lib/examples/LoLShield_Pong/LoLShield_Pong.pde index e6c81be..9081d49 100644 --- a/lib/examples/LoLShield_Pong/LoLShield_Pong.pde +++ b/lib/examples/LoLShield_Pong/LoLShield_Pong.pde @@ -15,7 +15,7 @@ /* ---------------------------------------------------------------------------*/ /** The figures from 0 to 9 encoded in 7 lines of 5 bits : */ -uint16_t figures[][7] = { +const uint16_t figures[][7] = { {14,17,17,17,17,17,14}, {4,6,4,4,4,4,14}, {14,17,16,14,1,1,31},