Merge experimental branch.

pull/35/head
guido 2020-10-09 13:10:39 +02:00
commit 80908e7b81
1 zmienionych plików z 10 dodań i 5 usunięć

Wyświetl plik

@ -3536,6 +3536,14 @@ void fatal(const __FlashStringHelper* msg, int value = 0, char unit = '\0') {
wdt_reset();
}
//refresh LUT based on pwm_min, pwm_max
void build_lut()
{
for(uint16_t i = 0; i != 256; i++) // refresh LUT based on pwm_min, pwm_max
lut[i] = (i * (pwm_max - pwm_min)) / 255 + pwm_min;
//lut[i] = min(pwm_max, (float)106*log(i) + pwm_min); // compressed microphone output: drive=0, pwm_min=115, pwm_max=220
}
void setup()
{
digitalWrite(KEY_OUT, LOW); // for safety: to prevent exploding PA MOSFETs, in case there was something still biasing them.
@ -3781,8 +3789,7 @@ void setup()
change = true;
prev_bandval = bandval;
for(uint16_t i = 0; i != 256; i++) // refresh LUT based on pwm_min, pwm_max
lut[i] = (float)i / ((float)255 / ((float)pwm_max - (float)pwm_min)) + pwm_min;
build_lut();
show_banner(); // remove release number
@ -4188,9 +4195,7 @@ void loop()
change = true;
}
if((menu == PWM_MIN) || (menu == PWM_MAX)){
for(uint16_t i = 0; i != 256; i++) // refresh LUT based on pwm_min, pwm_max
lut[i] = (float)i / ((float)255 / ((float)pwm_max - (float)pwm_min)) + pwm_min;
//lut[i] = min(pwm_max, (float)106*log(i) + pwm_min); // compressed microphone output: drive=0, pwm_min=115, pwm_max=220
build_lut();
}
if(menu == CWTONE){
if(dsp_cap){ cw_offset = (cw_tone == 0) ? tones[0] : tones[1]; paramAction(SAVE, CWOFF); }