add support for PWM_n pin role, which is a PWM with inversed channel value (100% changes to 0%, 0% to 100%, etc)

This commit is contained in:
openshwprojects
2022-08-17 16:24:29 +02:00
parent a3bfaa0c8f
commit 4766c03832
7 changed files with 68 additions and 17 deletions

View File

@ -337,7 +337,7 @@ int http_fn_index(http_request_t *request) {
lm = LED_GetMode();
c_pwms = PIN_CountPinsWithRole(IOR_PWM);
c_pwms = PIN_CountPinsWithRoleOrRole(IOR_PWM, IOR_PWM_n);
if(forceShowRGBCW) {
c_pwms = 5;
}
@ -1282,7 +1282,7 @@ int http_fn_cfg_ha(http_request_t *request) {
if(role == IOR_Relay || role == IOR_Relay_n || role == IOR_LED || role == IOR_LED_n) {
relayCount++;
}
if(role == IOR_PWM) {
if(role == IOR_PWM || role == IOR_PWM_n) {
pwmCount++;
}
}
@ -1374,7 +1374,7 @@ int http_tasmota_json_power(http_request_t *request) {
int lastRelayState;
// try to return status
numPWMs = PIN_CountPinsWithRole(IOR_PWM);
numPWMs = PIN_CountPinsWithRoleOrRole(IOR_PWM, IOR_PWM_n);
numRelays = 0;
// LED driver (if has PWMs)
@ -1630,7 +1630,7 @@ int http_fn_cfg_pins(http_request_t *request) {
hprintf128(request, "<select class=\"hele\" name=\"%i\">",i);
for(j = 0; j < IOR_Total_Options; j++) {
// do not show hardware PWM on non-PWM pin
if(j == IOR_PWM) {
if(j == IOR_PWM || j == IOR_PWM_n) {
if(bCanThisPINbePWM == 0) {
continue;
}

View File

@ -250,7 +250,7 @@ const char *htmlPinRoleNames[] = {
"SM2135CLK",
"BP5758D_DAT",
"BP5758D_CLK",
"error",
"PWM_n",
"error",
"error",
"error",