fixing compile warnings etc

This commit is contained in:
openshwprojects
2022-07-31 20:20:13 +02:00
parent b4c975d888
commit 7fbcd110f9
5 changed files with 40 additions and 29 deletions

View File

@@ -33,9 +33,9 @@ void HAL_ConnectToWiFi(const char *ssid, const char *psk)
int HAL_SetupWiFiOpenAccessPoint(const char *ssid) {
uint8_t hidden_ssid = 0;
int channel;
//int channel;
wifi_interface_t wifi_interface;
struct netif *net;
//struct netif *net;
wifi_interface = wifi_mgmr_ap_enable();
/*no password when only one param*/

View File

@@ -92,32 +92,6 @@ int http_fn_empty_url(http_request_t *request) {
poststr(request, NULL);
return 0;
}
int h_isChannelPWM(int tg_ch){
int i;
for(i = 0; i < PLATFORM_GPIO_MAX; i++) {
int ch = PIN_GetPinChannelForPinIndex(i);
if(tg_ch != ch)
continue;
int role = PIN_GetPinRoleForPinIndex(i);
if(role == IOR_PWM) {
return true;
}
}
return false;
}
int h_isChannelRelay(int tg_ch) {
int i;
for(i = 0; i < PLATFORM_GPIO_MAX; i++) {
int ch = PIN_GetPinChannelForPinIndex(i);
if(tg_ch != ch)
continue;
int role = PIN_GetPinRoleForPinIndex(i);
if(role == IOR_Relay || role == IOR_Relay_n || role == IOR_LED || role == IOR_LED_n) {
return true;
}
}
return false;
}
int http_fn_index(http_request_t *request) {
@@ -1396,10 +1370,17 @@ int http_tasmota_json_power(http_request_t *request) {
int http_tasmota_json_status_SNS(http_request_t *request) {
float power, factor, voltage, current;
#ifndef OBK_DISABLE_ALL_DRIVERS
factor = 0; // TODO
voltage = DRV_GetReading(OBK_VOLTAGE);
current = DRV_GetReading(OBK_CURRENT);
power = DRV_GetReading(OBK_POWER);
#else
factor = 0;
voltage = 0;
current = 0;
power = 0;
#endif
hprintf128(request,"{\"StatusSNS\":{\"ENERGY\":{");
hprintf128(request,"\"Power\": %f,", power);

View File

@@ -22,7 +22,7 @@ int sendfn(int fd, char * data, int len){
static void tcp_client_thread( int fd, char *buf, char *reply )
{
OSStatus err = kNoErr;
//OSStatus err = kNoErr;
http_request_t request;
os_memset(&request, 0, sizeof(request));

View File

@@ -1021,6 +1021,32 @@ static int CMD_SetChannelType(const void *context, const char *cmd, const char *
return 0;
}
int h_isChannelPWM(int tg_ch){
int i;
for(i = 0; i < PLATFORM_GPIO_MAX; i++) {
int ch = PIN_GetPinChannelForPinIndex(i);
if(tg_ch != ch)
continue;
int role = PIN_GetPinRoleForPinIndex(i);
if(role == IOR_PWM) {
return true;
}
}
return false;
}
int h_isChannelRelay(int tg_ch) {
int i;
for(i = 0; i < PLATFORM_GPIO_MAX; i++) {
int ch = PIN_GetPinChannelForPinIndex(i);
if(tg_ch != ch)
continue;
int role = PIN_GetPinRoleForPinIndex(i);
if(role == IOR_Relay || role == IOR_Relay_n || role == IOR_LED || role == IOR_LED_n) {
return true;
}
}
return false;
}
static int showgpi(const void *context, const char *cmd, const char *args, int cmdFlags){
int i;
unsigned int value = 0;

View File

@@ -193,6 +193,10 @@ bool CHANNEL_IsInUse(int ch);
void Channel_SaveInFlashIfNeeded(int ch);
bool CHANNEL_HasChannelSomeOutputPin(int ch);
int h_isChannelPWM(int tg_ch);
int h_isChannelRelay(int tg_ch);
int PIN_GetPWMIndexForPinIndex(int pin);
int PIN_ParsePinRoleName(const char *name);