Skip to content

Commit

Permalink
fix some compiler warnings
Browse files Browse the repository at this point in the history
bugfix for some out-of-range variables
  • Loading branch information
softhack007 committed Aug 26, 2023
1 parent 3b7fd35 commit a7aae27
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion wled00/FX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2113,7 +2113,7 @@ uint16_t WS2812FX::mode_railway()

//4 bytes
typedef struct Ripple {
uint8_t state;
int8_t state;
uint8_t color;
uint16_t pos;
} ripple;
Expand Down
4 changes: 2 additions & 2 deletions wled00/audio_reactive.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ uint8_t targetAgc = 60; // This is our setPoint at 20% o
uint8_t myVals[32]; // Used to store a pile of samples because WLED frame rate and WLED sample rate are not synchronized. Frame rate is too low.
bool samplePeak = 0; // Boolean flag for peak. Responding routine must reset this flag
bool udpSamplePeak = 0; // Boolean flag for peak. Set at the same tiem as samplePeak, but reset by transmitAudioData
int delayMs = 10; // I don't want to sample too often and overload WLED
constexpr unsigned delayMs = 10; // I don't want to sample too often and overload WLED
int micIn; // Current sample starts with negative values and large values, which is why it's 16 bit signed
int sample; // Current sample. Must only be updated ONCE!!!
int tmpSample; // An interim sample variable used for calculatioins.
Expand Down Expand Up @@ -146,7 +146,7 @@ void getSample() {

if (userVar1 == 0) samplePeak = 0;
// Poor man's beat detection by seeing if sample > Average + some value.
if (sample > (sampleAvg + maxVol) && millis() > (peakTime + 100)) {
if ((sample > (sampleAvg + maxVol)) && ((millis() - peakTime) > 100)) {
// Then we got a peak, else we don't. Display routines need to reset the samplepeak value in case they miss the trigger.
samplePeak = 1;
timeOfPeak = millis();
Expand Down
2 changes: 1 addition & 1 deletion wled00/usermod.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ void userLoop() {

// Begin UDP Microphone Sync
if (audioSyncEnabled & (1 << 1)) { // Only run the audio listener code if we're in Receive mode
if (millis()-lastTime > delayMs) {
if ((millis()-lastTime) > delayMs) {
if (udpSyncConnected) {
//Serial.println("Checking for UDP Microphone Packet");
int packetSize = fftUdp.parsePacket();
Expand Down

0 comments on commit a7aae27

Please sign in to comment.