Mercurial > controller
changeset 2:9f41bcaa3cee
Handle servo updates in the main loop
| author | Radomir Dopieralski <sheep-devel@sheep.art.pl> |
|---|---|
| date | Wed, 27 Jan 2016 11:59:41 +0100 |
| parents | 7b2d0a758e63 |
| children | ecf4808f2b29 |
| files | controller.ino |
| diffstat | 1 files changed, 6 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/controller.ino Tue Jan 12 22:28:22 2016 +0100 +++ b/controller.ino Wed Jan 27 11:59:41 2016 +0100 @@ -16,6 +16,7 @@ 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, }; +volatile bool changed = false; void receive(int16_t count) { @@ -33,7 +34,7 @@ pwm_set_phase_batch(servo, bytes2int.value); ++servo; } - pwm_apply_batch(); + changed = true; } @@ -49,4 +50,8 @@ void loop() { + if (changed) { + pwm_apply_batch(); + changed = false; + } }
