]> oss.titaniummirror.com Git - rgblamp.git/blobdiff - main.c
mplabx file updates
[rgblamp.git] / main.c
diff --git a/main.c b/main.c
index 840d83aab4542727f239d6614fca593239885f84..602e7aa81ad70594ad9addfb20c64138c2be8233 100644 (file)
--- a/main.c
+++ b/main.c
@@ -15,8 +15,8 @@
  * - ( 9) RB3 - CCP1 PWM for red LED
  * - (10) RB4 - rocker switch position B (right)
  * - (11) RB5 - rocker switch position A (left)
- * - (12) RB6 - unused
- * - (13) RB7 - unused
+ * - (12) RB6 - unused (future crystal)
+ * - (13) RB7 - unused (future crystal)
  * - (14) Vdd
  * - (15) RA6 - unused
  * - (16) RA7 - CCP2 PWM for grn LED
@@ -32,6 +32,7 @@
 #include "buttons.h"
 #include "rgb.h"
 #include "timer.h"
+#include "adc_random.h"
 
 #define AUTO_OFF_COUNT          549316UL /* 5 hrs in 32.768 ms units */
 #define reset_steps()           do { incolor_steps = 1; fade_steps = 0; } \
@@ -88,7 +89,6 @@ int main(void)
     int fade_steps;
     unsigned long auto_off = 0;
 
-
     pic_init();
     unused_init();
     buttons_init();
@@ -96,6 +96,7 @@ int main(void)
     timer_init();
     dbgpin_init();
 
+    srand((adc_random() << 8) + adc_random());
     reset_steps();
     if (buttons_on())
       rgb_on();
@@ -163,7 +164,7 @@ int main(void)
 
               /* Next incolor and fade steps */
               incolor_steps = rand_incolor_steps(speed);
-              fade_steps = (buttons & IN_ROCKERA) ? 1 : rand_fade_steps(speed);
+              fade_steps = rand_fade_steps(speed);
 
               /* Compute increment and remainder for each led */
               red.increment = (newr - red.value) / fade_steps;