mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-27 22:52:19 +03:00
add board ESP32-C6 4mb and 8mb
This commit is contained in:
@@ -92,6 +92,12 @@
|
||||
"esp32*": [
|
||||
"dfrobot/DFRobotDFPlayerMini @ ^1.0.5"
|
||||
],
|
||||
"esp32c6_4mb": [
|
||||
"exclude"
|
||||
],
|
||||
"esp32c6_8mb": [
|
||||
"exclude"
|
||||
],
|
||||
"esp82*": [
|
||||
"dfrobot/DFRobotDFPlayerMini @ ^1.0.5"
|
||||
]
|
||||
|
||||
@@ -8,15 +8,15 @@
|
||||
extern IoTGpio IoTgpio;
|
||||
|
||||
class Pwm32 : public IoTItem {
|
||||
private:
|
||||
private:
|
||||
int _pin;
|
||||
int _freq;
|
||||
int _freq;
|
||||
int _apin, _oldValue;
|
||||
bool _freezVal = true;
|
||||
int _ledChannel;
|
||||
int _ledChannel;
|
||||
int _resolution;
|
||||
|
||||
public:
|
||||
public:
|
||||
Pwm32(String parameters): IoTItem(parameters) {
|
||||
_interval = _interval / 1000; // корректируем величину интервала int, теперь он в миллисекундах
|
||||
|
||||
@@ -24,10 +24,14 @@ class Pwm32 : public IoTItem {
|
||||
jsonRead(parameters, "freq", _freq);
|
||||
jsonRead(parameters, "ledChannel", _ledChannel);
|
||||
jsonRead(parameters, "PWM_resolution", _resolution);
|
||||
|
||||
|
||||
pinMode(_pin, OUTPUT);
|
||||
#if defined(esp32c6_4mb) || defined(esp32c6_8mb)
|
||||
ledcAttachChannel(_pin, _freq, _resolution, _ledChannel);
|
||||
#else
|
||||
ledcSetup(_ledChannel, _freq, _resolution);
|
||||
ledcAttachPin(_pin, _ledChannel);
|
||||
#endif
|
||||
ledcWrite(_ledChannel, value.valD);
|
||||
|
||||
_resolution = pow(2, _resolution); // переводим биты в значение
|
||||
@@ -53,7 +57,7 @@ class Pwm32 : public IoTItem {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void setValue(const IoTValue& Value, bool genEvent = true) {
|
||||
value = Value;
|
||||
ledcWrite(_ledChannel, value.valD);
|
||||
|
||||
Reference in New Issue
Block a user