Hi all,
i am working on a project which uses a SSD1306 display connected to a Teensy 3.2. At first i was updating the display whenever something happened which should cause the display to be updated. That didn't work and i've now gone to a different approach which is to just update the display on a regular basis (20 times per second or 20Hz) no matter whether the display needs updated or not.
I'm wondering if anyone has any strategies for updating a display which will allow me to go back to my first approach of updating the display when something changes in my code which should cause an update to take place.
The reason i had problems with my first approach is that i have 4 clocks running and they can all be at different speeds and timings between pulses. This means that each clock "could" update the display independently but that causes issues where one clock is updating the display but other clocks want to update the display. I was getting some glitches in the display which is why i went to the second method of a 20Hz refresh rate instead. Without getting into the code for my first version specifically (i don't have any of it left since i reworked the code for my second approach), does anyone have a method where i could update the display for each clock independently as in my first approach but would mean that only one clock could update the display at a time and the other clocks would wait till the display was free to update it themselves. I also had problems when the screen was being updated because of user input at the same time that a clock would want to update the display. Glitches were worse in those situations.
I tried to simply have a variable which would keep track of whether the display was being updated or not (1 = being updated and 0 = display is free to be updated) and if it was then no other updates could happen until the variable went from 1 back to 0 but that didn't work.
I know i haven't posted any code here for my first approach (it's all been re-written since then) but it's overall strategies i am looking for here, not specifically code.
Thanks
NM
i am working on a project which uses a SSD1306 display connected to a Teensy 3.2. At first i was updating the display whenever something happened which should cause the display to be updated. That didn't work and i've now gone to a different approach which is to just update the display on a regular basis (20 times per second or 20Hz) no matter whether the display needs updated or not.
I'm wondering if anyone has any strategies for updating a display which will allow me to go back to my first approach of updating the display when something changes in my code which should cause an update to take place.
The reason i had problems with my first approach is that i have 4 clocks running and they can all be at different speeds and timings between pulses. This means that each clock "could" update the display independently but that causes issues where one clock is updating the display but other clocks want to update the display. I was getting some glitches in the display which is why i went to the second method of a 20Hz refresh rate instead. Without getting into the code for my first version specifically (i don't have any of it left since i reworked the code for my second approach), does anyone have a method where i could update the display for each clock independently as in my first approach but would mean that only one clock could update the display at a time and the other clocks would wait till the display was free to update it themselves. I also had problems when the screen was being updated because of user input at the same time that a clock would want to update the display. Glitches were worse in those situations.
I tried to simply have a variable which would keep track of whether the display was being updated or not (1 = being updated and 0 = display is free to be updated) and if it was then no other updates could happen until the variable went from 1 back to 0 but that didn't work.
I know i haven't posted any code here for my first approach (it's all been re-written since then) but it's overall strategies i am looking for here, not specifically code.
Thanks
NM