From e4ccc6109435115c1c71dc57f38117308af6e11f Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Thu, 8 Sep 2022 17:06:12 -0400 Subject: [PATCH] fixed buffer error --- cubesatsim/cubesatsim.ino | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index f9bd747f..c0688a72 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -1352,7 +1352,7 @@ void write_wave(int i, byte *buffer) // if ((ctr - flip_ctr) < smaller) // No wave shaping // buffer[ctr++] = (short int)(0.1 * phase * (ctr - flip_ctr) / smaller); // else - buffer[ctr++] = (short int)(0.25 * amplitude * phase); + buffer[ctr++] = (byte)(0.25 * amplitude * phase); // Serial.print(buffer[ctr - 1]); // Serial.print(" "); } @@ -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++] = (short int)(phase); + buffer[ctr++] = (byte)(phase); } // printf("%d %d \n", i, buffer[ctr - 1]); // if (ctr > BUFFER_SIZE) {