Used: F:\arduino-1.8.19\portable\packages\esp32\hardware\esp32\3.0.1\libraries\WiFi
Using library AsyncTelegram2 at version 2.3.1 in folder: F:\arduino-1.8.19\portable\sketchbook\libraries\AsyncTelegram2
Using library ArduinoJson at version 7.0.4 in folder: F:\arduino-1.8.19\portable\sketchbook\libraries\ArduinoJson
1) Replace:
// Lamp Control
void setLamp(int newVal) {
if (newVal != -1) {
// Apply a logarithmic function to the scale.
int brightness = round((pow(2, (1 + (newVal * 0.02))) - 2) / 6 * pwmMax);
ledcWrite(lampChannel, brightness);
Serial.print("Lamp: ");
Serial.print(newVal);
Serial.print("%, pwm = ");
Serial.println(brightness);
}
}
With:
// Lamp Control
void setLamp(int newVal) {
if (newVal != -1) {
// Apply a logarithmic function to the scale.
int brightness = round((pow(2, (1 + (newVal * 0.02))) - 2) / 6 * pwmMax);
ledcWrite(LAMP_PIN, brightness);
Serial.print("Lamp: ");
Serial.print(newVal);
Serial.print("%, pwm = ");
Serial.println(brightness);
}
}
2) Replace:
WRITE_PERI_REG(RTC_CNTL_BROWN_OUT_REG, 0); // disable brownout detector
pinMode(LAMP_PIN, OUTPUT); // set the lamp pin as output
ledcSetup(lampChannel, pwmfreq, pwmresolution); // configure LED PWM channel
setLamp(0); // set default value
ledcAttachPin(LAMP_PIN, lampChannel); // attach the GPIO pin to the channel
With:
WRITE_PERI_REG(RTC_CNTL_BROWN_OUT_REG, 0); // disable brownout detector
pinMode(LAMP_PIN, OUTPUT); // set the lamp pin as output
ledcAttach(LAMP_PIN, pwmfreq, pwmresolution); // configure LED PWM channel
setLamp(0); // set default value
1) Replace:
With:
2) Replace:
With: