diff --git a/src/httpserver/http_fns.c b/src/httpserver/http_fns.c index 0c4eee3ce..103ca0850 100644 --- a/src/httpserver/http_fns.c +++ b/src/httpserver/http_fns.c @@ -1540,41 +1540,6 @@ int http_fn_cfg_quick(http_request_t* request) { return 0; } -/// @brief Computes the Relay and PWM count. -/// @param relayCount Number of relay and LED channels. -/// @param pwmCount Number of PWM channels. -void get_Relay_PWM_Count(int* relayCount, int* pwmCount, int* dInputCount) { - int i; - (*relayCount) = 0; - (*pwmCount) = 0; - (*dInputCount) = 0; - - for (i = 0; i < PLATFORM_GPIO_MAX; i++) { - int role = PIN_GetPinRoleForPinIndex(i); - switch (role) { - case IOR_Relay: - case IOR_Relay_n: - case IOR_LED: - case IOR_LED_n: - (*relayCount)++; - break; - case IOR_PWM: - case IOR_PWM_n: - (*pwmCount)++; - break; - case IOR_DigitalInput: - case IOR_DigitalInput_n: - case IOR_DigitalInput_NoPup: - case IOR_DigitalInput_NoPup_n: - (*dInputCount)++; - break; - default: - break; - } - } -} - - void doHomeAssistantDiscovery(const char *topic, http_request_t *request) { int i; int relayCount; diff --git a/src/new_pins.c b/src/new_pins.c index cbc6129e9..875b0a34a 100644 --- a/src/new_pins.c +++ b/src/new_pins.c @@ -1615,6 +1615,41 @@ static commandResult_t CMD_SetChannelType(const void *context, const char *cmd, return CMD_RES_OK; } +/// @brief Computes the Relay and PWM count. +/// @param relayCount Number of relay and LED channels. +/// @param pwmCount Number of PWM channels. +void get_Relay_PWM_Count(int* relayCount, int* pwmCount, int* dInputCount) { + int i; + (*relayCount) = 0; + (*pwmCount) = 0; + (*dInputCount) = 0; + + for (i = 0; i < PLATFORM_GPIO_MAX; i++) { + int role = PIN_GetPinRoleForPinIndex(i); + switch (role) { + case IOR_Relay: + case IOR_Relay_n: + case IOR_LED: + case IOR_LED_n: + (*relayCount)++; + break; + case IOR_PWM: + case IOR_PWM_n: + (*pwmCount)++; + break; + case IOR_DigitalInput: + case IOR_DigitalInput_n: + case IOR_DigitalInput_NoPup: + case IOR_DigitalInput_NoPup_n: + (*dInputCount)++; + break; + default: + break; + } + } +} + + int h_isChannelPWM(int tg_ch){ int i; int role; diff --git a/src/new_pins.h b/src/new_pins.h index 8c71c77d8..54a5b8c4a 100644 --- a/src/new_pins.h +++ b/src/new_pins.h @@ -376,6 +376,7 @@ int CHANNEL_FindMaxValueForChannel(int ch); // cmd_channels.c const char *CHANNEL_GetLabel(int ch); +void get_Relay_PWM_Count(int* relayCount, int* pwmCount, int* dInputCount); int h_isChannelPWM(int tg_ch); int h_isChannelRelay(int tg_ch); int h_isChannelDigitalInput(int tg_ch);