projects
/
svn42.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
a61aa40
)
better wait (still not really good)
author
Bernhard Tittelbach
<xro@realraum.at>
Sun, 7 Mar 2010 03:31:16 +0000
(
03:31
+0000)
committer
Bernhard Tittelbach
<xro@realraum.at>
Sun, 7 Mar 2010 03:31:16 +0000
(
03:31
+0000)
rf433ctl/rf433ctl.pde
patch
|
blob
|
history
diff --git
a/rf433ctl/rf433ctl.pde
b/rf433ctl/rf433ctl.pde
index
e6ba1bd
..
b4749bc
100644
(file)
--- a/
rf433ctl/rf433ctl.pde
+++ b/
rf433ctl/rf433ctl.pde
@@
-240,12
+240,32
@@
void printLightLevel()
//********************************************************************//
//********************************************************************//
+unsigned long wm_start_=0;
+bool wait_millis(unsigned long ms)
+{
+ if (wm_start_ > 0)
+ {
+ if (millis() < wm_start_ || millis() > wm_start_+ ms)
+ {
+ wm_start_=0;
+ return false;
+ }
+ else
+ return true;
+ }
+ else
+ {
+ wm_start_=millis();
+ return true;
+ }
+}
+
unsigned int flash_led_time_=0;
void calculate_led_level(unsigned int pwm_pin)
{
if (flash_led_time_ == 0)
return;
unsigned int flash_led_time_=0;
void calculate_led_level(unsigned int pwm_pin)
{
if (flash_led_time_ == 0)
return;
- if (millis() % 10)
+ if (wait_millis(10))
return;
flash_led_time_--;
int c = abs(sin(float(flash_led_time_) / 100.0)) * 256;
return;
flash_led_time_--;
int c = abs(sin(float(flash_led_time_) / 100.0)) * 256;