diff --git a/src/httpserver/new_http.c b/src/httpserver/new_http.c index 6255e1d65..6db15e7eb 100644 --- a/src/httpserver/new_http.c +++ b/src/httpserver/new_http.c @@ -539,7 +539,7 @@ const char* htmlPinRoleNames[] = { "KP18058_CLK", "KP18058_DAT", "DS1820_IO", - "error", + "PWM_ScriptOnly", "error", "error", }; diff --git a/src/new_pins.c b/src/new_pins.c index cddf003ff..ab8709252 100644 --- a/src/new_pins.c +++ b/src/new_pins.c @@ -717,6 +717,7 @@ void CHANNEL_SetAll(int iVal, int iFlags) { CHANNEL_Set(g_cfg.pins.channels[i], iVal, iFlags); break; case IOR_PWM: + case IOR_PWM_ScriptOnly: case IOR_PWM_n: CHANNEL_Set(g_cfg.pins.channels[i], iVal, iFlags); break; @@ -832,6 +833,7 @@ void PIN_SetPinRoleForPinIndex(int index, int role) { break; // Disable PWM for previous pin role case IOR_PWM_n: + case IOR_PWM_ScriptOnly: case IOR_PWM: { HAL_PIN_PWM_Stop(index); @@ -1028,6 +1030,7 @@ void PIN_SetPinRoleForPinIndex(int index, int role) { HAL_ADC_Init(index); break; case IOR_PWM_n: + case IOR_PWM_ScriptOnly: case IOR_PWM: { int channelIndex; @@ -1111,7 +1114,7 @@ static void Channel_OnChanged(int ch, int prevValue, int iFlags) { else if (g_cfg.pins.roles[i] == IOR_Relay_n || g_cfg.pins.roles[i] == IOR_LED_n || g_cfg.pins.roles[i] == IOR_BAT_Relay_n) { RAW_SetPinValue(i, !bOn); } - else if (g_cfg.pins.roles[i] == IOR_PWM) { + else if (g_cfg.pins.roles[i] == IOR_PWM || g_cfg.pins.roles[i] == IOR_PWM_ScriptOnly) { HAL_PIN_PWM_Update(i, iVal); } else if (g_cfg.pins.roles[i] == IOR_PWM_n) { @@ -1362,7 +1365,7 @@ void CHANNEL_Set_FloatPWM(int ch, float fVal, int iFlags) { for (i = 0; i < PLATFORM_GPIO_MAX; i++) { if (g_cfg.pins.channels[i] == ch) { - if (g_cfg.pins.roles[i] == IOR_PWM) { + if (g_cfg.pins.roles[i] == IOR_PWM || g_cfg.pins.roles[i] == IOR_PWM_ScriptOnly) { HAL_PIN_PWM_Update(i, fVal); } else if (g_cfg.pins.roles[i] == IOR_PWM_n) { @@ -1507,7 +1510,7 @@ int CHANNEL_FindMaxValueForChannel(int ch) { // is pin tied to this channel? if (g_cfg.pins.channels[i] == ch) { // is it PWM? - if (g_cfg.pins.roles[i] == IOR_PWM) { + if (g_cfg.pins.roles[i] == IOR_PWM || g_cfg.pins.roles[i] == IOR_PWM_ScriptOnly) { return 100; } if (g_cfg.pins.roles[i] == IOR_PWM_n) { @@ -1689,6 +1692,7 @@ int CHANNEL_GetRoleForOutputChannel(int ch) { case IOR_LED_n: case IOR_PWM_n: case IOR_PWM: + case IOR_PWM_ScriptOnly: return g_cfg.pins.roles[i]; case IOR_BridgeForward: case IOR_BridgeReverse: @@ -1951,7 +1955,7 @@ void PIN_ticks(void* param) } #if 1 - if (g_cfg.pins.roles[i] == IOR_PWM) { + if (g_cfg.pins.roles[i] == IOR_PWM || g_cfg.pins.roles[i] == IOR_PWM_ScriptOnly) { HAL_PIN_PWM_Update(i, g_channelValuesFloats[g_cfg.pins.channels[i]]); } else if (g_cfg.pins.roles[i] == IOR_PWM_n) { @@ -2338,6 +2342,11 @@ void PIN_get_Relay_PWM_Count(int* relayCount, int* pwmCount, int* dInputCount) { BIT_SET(pwmBits, g_cfg.pins.channels[i]); //(*pwmCount)++; break; + case IOR_PWM_ScriptOnly: + // DO NOT COUNT SCRIPTONLY PWM HERE! + // As in title - it's only for scripts. + // It should not generate lights! + break; case IOR_DigitalInput: case IOR_DigitalInput_n: case IOR_DigitalInput_NoPup: @@ -2377,6 +2386,12 @@ int h_isChannelPWM(int tg_ch) { if (role == IOR_PWM || role == IOR_PWM_n) { return true; } + // DO NOT COUNT SCRIPTONLY PWM HERE! + // As in title - it's only for scripts. + // It should not generate lights! + //if (role == IOR_PWM_ScriptOnly) { + // return true; + //} } return false; } diff --git a/src/new_pins.h b/src/new_pins.h index 3b4ce1460..1e8c0f021 100644 --- a/src/new_pins.h +++ b/src/new_pins.h @@ -560,6 +560,13 @@ typedef enum ioRole_e { //iodetail:"file":"new_pins.h", //iodetail:"driver":""} IOR_DS1820_IO, + //iodetail:{"name":"PWM_ScriptOnly", + //iodetail:"title":"TODO", + //iodetail:"descr":"", + //iodetail:"enum":"PWM_ScriptOnly", + //iodetail:"file":"new_pins.h", + //iodetail:"driver":""} + IOR_PWM_ScriptOnly, //iodetail:{"name":"Total_Options", //iodetail:"title":"TODO", //iodetail:"descr":"Current total number of available IOR roles",