mirror of
https://github.com/brmlab/ledbar.git
synced 2025-06-11 22:33:59 +02:00
Add synchronization byte \xAC at the beginning of RGB burst
This commit is contained in:
parent
62602ef940
commit
35822a08c9
3 changed files with 11 additions and 2 deletions
|
@ -23,6 +23,11 @@ void setup()
|
|||
void loop()
|
||||
{
|
||||
int led, i;
|
||||
/* Wait for synchronization. */
|
||||
do {
|
||||
while (!Serial.available());
|
||||
} while (Serial.read() != 0xAC);
|
||||
/* Set LEDs. */
|
||||
for (led = 0; led < cpinsets; led++) {
|
||||
for (i = 0; i < CH; i++) {
|
||||
while (!Serial.available());
|
||||
|
|
|
@ -298,6 +298,9 @@ void drawScreen(SDL_Surface* screen, int t, FILE* fp)
|
|||
|
||||
if(SDL_MUSTLOCK(screen) && SDL_LockSurface(screen) < 0) return;
|
||||
|
||||
if (fp)
|
||||
fwrite("\xAC", 1, 1, fp);
|
||||
|
||||
for (i=0; i<BOXES; ++i) {
|
||||
program(i, t, &r, &g, &b);
|
||||
if (fp) {
|
||||
|
@ -316,6 +319,7 @@ void drawScreen(SDL_Surface* screen, int t, FILE* fp)
|
|||
|
||||
if (SDL_MUSTLOCK(screen)) SDL_UnlockSurface(screen);
|
||||
SDL_Flip(screen);
|
||||
if (fp)
|
||||
fflush(fp);
|
||||
}
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ def main():
|
|||
|
||||
try:
|
||||
while True:
|
||||
data = ''
|
||||
data = '\xAC'
|
||||
to_read = number*3
|
||||
while to_read > 0:
|
||||
read = sys.stdin.read(to_read)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue