diff --git a/src/driver/drv_bmp280.c b/src/driver/drv_bmp280.c index 9ee611892..72e89de4d 100644 --- a/src/driver/drv_bmp280.c +++ b/src/driver/drv_bmp280.c @@ -10,7 +10,7 @@ #include "../httpserver/new_http.h" #include "../hal/hal_pins.h" -static int g_temperature; +static int32_t g_temperature; static uint32_t g_pressure; static char g_targetChannelTemperature = -1, g_targetChannelPressure = -1; static softI2C_t g_softI2C; @@ -44,8 +44,6 @@ void BMP280_Stop(void) { //manufacturer ID // startDriver BMP280 [CLK] [DATA] [ChannelForTemp] [ChannelForPressure] [Adr8bit] void BMP280_Init() { - uint8_t buff[4]; - g_softI2C.pin_clk = Tokenizer_GetArgIntegerDefault(1, 8); g_softI2C.pin_data = Tokenizer_GetArgIntegerDefault(2, 14); g_targetChannelTemperature = Tokenizer_GetArgIntegerDefault(3, -1); diff --git a/src/driver/drv_doorSensorWithDeepSleep.c b/src/driver/drv_doorSensorWithDeepSleep.c index e5a5d89b8..d8190c21f 100644 --- a/src/driver/drv_doorSensorWithDeepSleep.c +++ b/src/driver/drv_doorSensorWithDeepSleep.c @@ -16,6 +16,7 @@ #include "../httpserver/new_http.h" #include "../hal/hal_pins.h" #include "../hal/hal_adc.h" +#include "../ota/ota.h" static int setting_timeRequiredUntilDeepSleep = 60; static int g_noChangeTimePassed = 0; diff --git a/src/driver/drv_ntp.c b/src/driver/drv_ntp.c index 635370e43..dcc531042 100644 --- a/src/driver/drv_ntp.c +++ b/src/driver/drv_ntp.c @@ -17,6 +17,11 @@ extern void NTP_Init_Events(void); extern void NTP_RunEvents(unsigned int newTime, bool bTimeValid); +#if ENABLE_NTP_SUNRISE_SUNSET +extern void NTP_CalculateSunrise(byte *outHour, byte *outMinute); +extern void NTP_CalculateSunset(byte *outHour, byte *outMinute); +#endif + #define LOG_FEATURE LOG_FEATURE_NTP typedef struct diff --git a/src/driver/drv_pwm_groups.c b/src/driver/drv_pwm_groups.c index 63131eb64..320f705e2 100644 --- a/src/driver/drv_pwm_groups.c +++ b/src/driver/drv_pwm_groups.c @@ -32,6 +32,7 @@ static commandResult_t CMD_PWMG_Set(const void* context, const char* cmd, const return CMD_RES_NOT_ENOUGH_ARGUMENTS; } +#if PLATFORM_BK7231N int err; // OSStatus bk_pwm_group_initialize(bk_pwm_t pwm1, bk_pwm_t pwm2, // uint32_t frequency, uint32_t duty_cycle1, uint32_t duty_cycle2, uint32_t dead_band); @@ -48,7 +49,6 @@ static commandResult_t CMD_PWMG_Set(const void* context, const char* cmd, const uint32_t duty1_s = (duty1 / 100.0 * period); //No need to use upscaled variable uint32_t duty2_s = (duty2 / 100.0 * period); //No need to use upscaled variable uint32_t dead_s = (dead / 100.0 * period); //No need to use upscaled variable -#if PLATFORM_BK7231N err = bk_pwm_group_mode_disable(pwm1); addLogAdv(LOG_INFO, LOG_FEATURE_GENERAL, "bk_pwm_group_mode_disable %i", err); err = bk_pwm_group_initialize(pwm1, pwm2, period, duty1_s, duty2_s, dead_s); @@ -68,6 +68,7 @@ static commandResult_t CMD_PWMG_Raw(const void* context, const char* cmd, const return CMD_RES_NOT_ENOUGH_ARGUMENTS; } +#if PLATFORM_BK7231N int err; // OSStatus bk_pwm_group_initialize(bk_pwm_t pwm1, bk_pwm_t pwm2, // uint32_t frequency, uint32_t duty_cycle1, uint32_t duty_cycle2, uint32_t dead_band); @@ -80,7 +81,6 @@ static commandResult_t CMD_PWMG_Raw(const void* context, const char* cmd, const int pwm1 = PIN_GetPWMIndexForPinIndex(p1); int pwm2 = PIN_GetPWMIndexForPinIndex(p2); -#if PLATFORM_BK7231N err = bk_pwm_group_mode_disable(pwm1); addLogAdv(LOG_INFO, LOG_FEATURE_GENERAL, "bk_pwm_group_mode_disable %i", err); err = bk_pwm_group_initialize(pwm1, pwm2, freq, duty1, duty2, dead); diff --git a/src/driver/drv_tuyaMCU.c b/src/driver/drv_tuyaMCU.c index cf826d794..2e4982bfe 100644 --- a/src/driver/drv_tuyaMCU.c +++ b/src/driver/drv_tuyaMCU.c @@ -470,7 +470,7 @@ void TuyaMCU_SendStateInternal(uint8_t id, uint8_t type, void* value, int dataLe { uint16_t payload_len = 0; - payload_len = TuyaMCU_AppendStateInternal(g_tuyaMCUpayloadBuffer, g_tuyaMCUpayloadBuffer, + payload_len = TuyaMCU_AppendStateInternal(g_tuyaMCUpayloadBuffer, (int)g_tuyaMCUpayloadBuffer, payload_len, id, type, value, dataLen); TuyaMCU_SendCommandWithData(TUYA_CMD_SET_DP, g_tuyaMCUpayloadBuffer, payload_len); @@ -484,13 +484,13 @@ void TuyaMCU_SendTwoVals(byte idA, int valA, byte idB, int valB) swap[1] = ((byte*)&valA)[2]; swap[2] = ((byte*)&valA)[1]; swap[3] = ((byte*)&valA)[0]; - payload_len = TuyaMCU_AppendStateInternal(g_tuyaMCUpayloadBuffer, g_tuyaMCUpayloadBuffer, + payload_len = TuyaMCU_AppendStateInternal(g_tuyaMCUpayloadBuffer, (int)g_tuyaMCUpayloadBuffer, payload_len, idA, DP_TYPE_VALUE, swap, 4); swap[0] = ((byte*)&valB)[3]; swap[1] = ((byte*)&valB)[2]; swap[2] = ((byte*)&valB)[1]; swap[3] = ((byte*)&valB)[0]; - payload_len = TuyaMCU_AppendStateInternal(g_tuyaMCUpayloadBuffer, g_tuyaMCUpayloadBuffer, + payload_len = TuyaMCU_AppendStateInternal(g_tuyaMCUpayloadBuffer, (int)g_tuyaMCUpayloadBuffer, payload_len, idB, DP_TYPE_VALUE, swap, 4); TuyaMCU_SendCommandWithData(TUYA_CMD_SET_DP, g_tuyaMCUpayloadBuffer, payload_len); @@ -976,7 +976,7 @@ void TuyaMCU_SendStateRawFromString(int dpId, const char *args) { } const char *STR_FindArg(const char *s, int arg) { while (1) { - while (isspace(*s)) { + while (isspace((int)*s)) { if (*s == 0) return ""; s++; @@ -985,7 +985,7 @@ const char *STR_FindArg(const char *s, int arg) { if (arg < 0) { return s; } - while (isspace(*s) == false) { + while (isspace((int)*s) == false) { if (*s == 0) return ""; s++; diff --git a/src/httpclient/http_client.c b/src/httpclient/http_client.c index 7ed888dd6..3fe28a3a8 100644 --- a/src/httpclient/http_client.c +++ b/src/httpclient/http_client.c @@ -1188,7 +1188,7 @@ int HTTPClient_CB_Data(struct httprequest_t_tag *request) { } else { LFS_WriteFile(request->targetFile, - request->client_data.response_buf, request->client_data.response_buf_filled, + (const byte *)request->client_data.response_buf, request->client_data.response_buf_filled, request->client_data.userCounter!= 0); request->client_data.userCounter++; diff --git a/src/httpserver/json_interface.c b/src/httpserver/json_interface.c index 637ec8355..8814b62e0 100644 --- a/src/httpserver/json_interface.c +++ b/src/httpserver/json_interface.c @@ -754,6 +754,7 @@ int http_obk_json_dps(int id, void* request, jsonCb_t printer); int JSON_ProcessCommandReply(const char* cmd, const char* arg, void* request, jsonCb_t printer, int flags) { int i; + long int* pAllGenericFlags = (long int*)&g_cfg.genericFlags; if (!wal_strnicmp(cmd, "POWER", 5)) { @@ -1029,7 +1030,7 @@ int JSON_ProcessCommandReply(const char* cmd, const char* arg, void* request, js } else if (!wal_strnicmp(cmd, "Flags", 5)) { printer(request, "{"); - printer(request, "\"Flags\":\"%ld\"", *((long int*)&g_cfg.genericFlags)); + printer(request, "\"Flags\":\"%ld\"", *pAllGenericFlags); printer(request, "}"); } else if (!wal_strnicmp(cmd, "Ch", 2)) { diff --git a/src/httpserver/rest_interface.c b/src/httpserver/rest_interface.c index 8456a166d..8404315dd 100644 --- a/src/httpserver/rest_interface.c +++ b/src/httpserver/rest_interface.c @@ -862,12 +862,14 @@ static int http_rest_post_logconfig(http_request_t* request) { static int http_rest_get_info(http_request_t* request) { char macstr[3 * 6 + 1]; + long int* pAllGenericFlags = (long int*)&g_cfg.genericFlags; + http_setup(request, httpMimeTypeJson); hprintf255(request, "{\"uptime_s\":%d,", g_secondsElapsed); hprintf255(request, "\"build\":\"%s\",", g_build_str); hprintf255(request, "\"ip\":\"%s\",", HAL_GetMyIPString()); hprintf255(request, "\"mac\":\"%s\",", HAL_GetMACStr(macstr)); - hprintf255(request, "\"flags\":\"%ld\",", *((long int*)&g_cfg.genericFlags)); + hprintf255(request, "\"flags\":\"%ld\",", *pAllGenericFlags); hprintf255(request, "\"mqtthost\":\"%s:%d\",", CFG_GetMQTTHost(), CFG_GetMQTTPort()); hprintf255(request, "\"mqtttopic\":\"%s\",", CFG_GetMQTTClientId()); hprintf255(request, "\"chipset\":\"%s\",", PLATFORM_MCU_NAME);