From 5060aa3cf609fb5701df1b2c2e66793b5c54d61d Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Thu, 8 Sep 2022 22:14:02 -0400 Subject: [PATCH] fixed phase to byte conversion --- cubesatsim/cubesatsim.ino | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index dbf0bedd..827fafa6 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -1364,7 +1364,7 @@ void write_wave(int i, byte *buffer) // else // buffer[ctr++] = (short int)(amplitude * 0.4 * phase * sin((float)(2*M_PI*i*freq_Hz/S_RATE))); buffer[ctr++] = (short int)(amplitude * phase * sin((float)(2*M_PI*i*freq_Hz/S_RATE))); // buffer[ctr++] = (short int)(phase * sin_map[ctr % sin_samples]); } - buffer[ctr++] = (byte)(phase); + buffer[ctr++] = (byte)(phase == 1); } // printf("%d %d \n", i, buffer[ctr - 1]); // if (ctr > BUFFER_SIZE) { @@ -1377,7 +1377,7 @@ void write_wave(int i, byte *buffer) Serial.println(millis()); } } - Serial.printf(" c: b: %d is %d ", ctr - 1, buffer[ctr - 1]); + Serial.printf(" b: %d ", buffer[ctr - 1]); }