fix(color): spectrum analyzer on non 480x272 screens (#7324)
This commit is contained in:
@@ -160,28 +160,14 @@ static void processMultiScannerPacket(const uint8_t *data, const uint8_t moduleI
|
||||
for (uint8_t channel = 0; channel <5; channel++) {
|
||||
uint8_t power = max<int>(0,(data[channel+1] - 34) >> 1); // remove everything below -120dB
|
||||
|
||||
#if LCD_W == 480
|
||||
coord_t x = cur_channel*2;
|
||||
if (x < LCD_W) {
|
||||
reusableBuffer.spectrumAnalyser.bars[x] = power;
|
||||
if (x + 1 < LCD_W) {
|
||||
reusableBuffer.spectrumAnalyser.bars[x + 1] = power;
|
||||
}
|
||||
if (power > reusableBuffer.spectrumAnalyser.max[x]) {
|
||||
reusableBuffer.spectrumAnalyser.max[x] = power;
|
||||
if (x + 1 < LCD_W) {
|
||||
reusableBuffer.spectrumAnalyser.max[x + 1] = power;
|
||||
}
|
||||
}
|
||||
if (power > reusableBuffer.spectrumAnalyser.peak[x]) {
|
||||
reusableBuffer.spectrumAnalyser.peak[x] = power;
|
||||
if (x + 1 < LCD_W) {
|
||||
reusableBuffer.spectrumAnalyser.peak[x + 1] = power;
|
||||
}
|
||||
}
|
||||
#elif LCD_W == 212
|
||||
coord_t x = cur_channel;
|
||||
if (x < LCD_W) {
|
||||
// Spread the (MULTI_SCANNER_MAX_CHANNEL + 1) channels across the full
|
||||
// chart width so the spectrum fills the screen on any LCD size.
|
||||
coord_t x_start =
|
||||
((coord_t)cur_channel * LCD_W) / (MULTI_SCANNER_MAX_CHANNEL + 1);
|
||||
coord_t x_end = ((coord_t)(cur_channel + 1) * LCD_W) /
|
||||
(MULTI_SCANNER_MAX_CHANNEL + 1);
|
||||
if (x_end <= x_start) x_end = x_start + 1;
|
||||
for (coord_t x = x_start; x < x_end && x < LCD_W; x++) {
|
||||
reusableBuffer.spectrumAnalyser.bars[x] = power;
|
||||
if (power > reusableBuffer.spectrumAnalyser.max[x]) {
|
||||
reusableBuffer.spectrumAnalyser.max[x] = power;
|
||||
@@ -189,17 +175,6 @@ static void processMultiScannerPacket(const uint8_t *data, const uint8_t moduleI
|
||||
if (power > reusableBuffer.spectrumAnalyser.peak[x]) {
|
||||
reusableBuffer.spectrumAnalyser.peak[x] = power;
|
||||
}
|
||||
#else
|
||||
coord_t x = cur_channel / 2 + 1;
|
||||
if (x < LCD_W) {
|
||||
reusableBuffer.spectrumAnalyser.bars[x] = power;
|
||||
if (power > reusableBuffer.spectrumAnalyser.max[x]) {
|
||||
reusableBuffer.spectrumAnalyser.max[x] = power;
|
||||
}
|
||||
if (power > reusableBuffer.spectrumAnalyser.peak[x]) {
|
||||
reusableBuffer.spectrumAnalyser.peak[x] = power;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
if (++cur_channel > MULTI_SCANNER_MAX_CHANNEL)
|
||||
cur_channel = 0;
|
||||
|
||||
Reference in New Issue
Block a user