Files
IoTManager/src/items/PwmOutClass.cpp

25 lines
957 B
C++
Raw Normal View History

2020-09-02 23:37:11 +03:00
#include "items/itemsGlobal.h"
2020-09-03 01:12:43 +03:00
#include "items/PwmOutClass.h"
2020-09-02 23:37:11 +03:00
//==========================================Модуль управления ШИМ===================================================
//pwm-out volume range Кнопки Свет 1 pin[12] st[500]
//==================================================================================================================
2020-09-03 01:12:43 +03:00
PwmOutClass* myPwmOut;
2020-09-02 23:37:11 +03:00
void pwmOut() {
2020-09-03 01:12:43 +03:00
myPwmOut = new PwmOutClass();
myPwmOut->update();
String key = myPwmOut->gkey();
String pin = myPwmOut->gpin();
String inv = myPwmOut->ginv();
2020-09-02 23:37:11 +03:00
sCmd.addCommand(key.c_str(), pwmOutSet);
jsonWriteStr(configOptionJson, key + "_pin", pin);
2020-09-03 01:12:43 +03:00
myPwmOut->pwmModeSet();
myPwmOut->pwmStateSetDefault();
myPwmOut->clear();
2020-09-02 23:37:11 +03:00
}
void pwmOutSet() {
String key = sCmd.order();
String state = sCmd.next();
String pin = jsonReadStr(configOptionJson, key + "_pin");
2020-09-03 01:12:43 +03:00
myPwmOut->pwmChange(key, pin, state);
2020-09-02 23:37:11 +03:00
}