Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various warnings fixes. #1489

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

notzed
Copy link

@notzed notzed commented Jan 2, 2025

Mostly minor warnings found using -Wall.

Also some others for OpenLN882H, some of them a bit more serious. Not sure where to put them tho.

ln882h.txt

@openshwprojects
Copy link
Owner

Thx but are you sure about this?
image
You seem to change unresolved external (assumed) to another func?

@notzed
Copy link
Author

notzed commented Jan 2, 2025

It's to fix this warning. delay_ms() is defined for all other platforms in new_common.h, although like a few other things there is a bit of duplication and redundancy and inconsistencies.

In file included from /home/notzed/src/OpenBK7231T_App/sdk/OpenLN882H/project/OpenBeken/app/src/driver/drv_bmp280.c:39:
/home/notzed/src/OpenBK7231T_App/sdk/OpenLN882H/project/OpenBeken/app/src/driver/BMP280.h: In function 'BMP280_begin':
/home/notzed/src/OpenBK7231T_App/sdk/OpenLN882H/project/OpenBeken/app/src/driver/BMP280.h:222:3: warning: implicit declaration of function 'delay_ms' [-Wimplicit-function-declaration]
  222 |   delay_ms(100);
      |   ^~~~~~~~

It's not terribly important here but implicit declarations are a good way to introduce subtle bugs and what most of the patch addresses.

@openshwprojects
Copy link
Owner

If it says:
warning: implicit declaration of function 'delay_ms' [-Wimplicit-function-declaration]
doesn't it mean that you should just add a function decleration or header for delay_ms, instead of redefining it as OS_MsDelay?

@notzed
Copy link
Author

notzed commented Jan 2, 2025

I didn't see where it was defined, and every other platform #defines delay_ms to something appropriate. Should they also be changed? Where does it reside?

$ find src -name '*.[ch]' | xargs grep delay_ms
src/cmnds/cmd_script.c: delay_ms 250
src/cmnds/cmd_script.c: delay_ms $CH11
src/cmnds/cmd_script.c: delay_ms $CH11
src/cmnds/cmd_script.c:delay_ms $CH11
src/cmnds/cmd_script.c: //cmddetail:{"name":"delay_ms","args":"[ValueMS]",
src/cmnds/cmd_script.c:    CMD_RegisterCommand("delay_ms", CMD_Delay_ms, NULL);
src/driver/BMP280.h:  delay_ms(100);
src/driver/BMP280.h:    delay_ms(100);
src/driver/BMP280.h:    delay_ms(1);
src/driver/drv_bmpi2c.c:                delay_ms(125);
src/driver/drv_bmpi2c.h:        delay_ms(5);
src/driver/drv_bmpi2c.h:                delay_ms(100);
src/driver/drv_bmpi2c.h:                        delay_ms(100);
src/driver/drv_bmpi2c.h:                //      delay_ms(5);
src/driver/drv_bmpi2c.h:                delay_ms(5);
src/driver/drv_bmpi2c.h:        delay_ms(5);
src/driver/drv_bmpi2c.h:        delay_ms(delay);
src/driver/drv_bmpi2c.h:        delay_ms(tph_dur);
src/driver/drv_max6675.c:               delay_ms(10);
src/driver/drv_max6675.c:               delay_ms(10);
src/driver/drv_max6675.c:       delay_ms(10);
src/hal/bk7231/hal_main_bk7231.c:OSStatus OBK_rtos_callback_in_timer_thread( PendedFunction_t xFunctionToPend, void *pvParameter1, uint32_t ulParameter2, uint32_t delay_ms)
src/hal/bk7231/hal_main_bk7231.c:    result = xTimerPendFunctionCall( xFunctionToPend, pvParameter1, ulParameter2, ( delay_ms / ms_to_tick_ratio ));
src/hal/espidf/hal_wifi_espidf.c:               delay_ms(10);
src/hal/tr6260/hal_wifi_tr6260.c:               delay_ms(10);
src/httpclient/utils_net.c:                     delay_ms(500);
src/i2c/drv_i2c_ads1115.c:      delay_ms(8);
src/i2c/drv_i2c_lcd_pcf8574t.c:    delay_ms(5);                // (per HD44780U initialization spec)
src/i2c/drv_i2c_lcd_pcf8574t.c:    delay_ms(5);                // (per HD44780U initialization spec)
src/i2c/drv_i2c_lcd_pcf8574t.c:    delay_ms(5);                // (per HD44780U initialization spec)
src/i2c/drv_i2c_lcd_pcf8574t.c:    delay_ms(5);
src/i2c/drv_i2c_lcd_pcf8574t.c:    delay_ms(5);                // (per HD44780U initialization spec)
src/i2c/drv_i2c_lcd_pcf8574t.c:    delay_ms(5);                // (per HD44780U initialization spec)
src/i2c/drv_i2c_lcd_pcf8574t.c:    delay_ms(5);                // (per HD44780U initialization spec)
src/i2c/drv_i2c_lcd_pcf8574t.c:    delay_ms(5);                // (per HD44780U initialization spec)
src/i2c/drv_i2c_lcd_pcf8574t.c:    delay_ms(5);                // (per HD44780U initialization spec)
src/i2c/drv_i2c_lcd_pcf8574t.c:    delay_ms(5);
src/i2c/drv_i2c_lcd_pcf8574t.c:          delay_ms(115);
src/i2c/drv_i2c_lcd_pcf8574t.c:         delay_ms(115);
src/i2c/drv_i2c_lcd_pcf8574t.c:         delay_ms(115);
src/i2c/drv_i2c_lcd_pcf8574t.c:         delay_ms(115);
src/logging/logging.c:  OSStatus OBK_rtos_callback_in_timer_thread( PendedFunction_t xFunctionToPend, void *pvParameter1, uint32_t ulParameter2, uint32_t delay_ms);
src/new_common.h:int delay_ms(int sec);
src/new_common.h:#define delay_ms vTaskDelay
src/new_common.h:#define delay_ms OS_ThreadSleep
src/new_common.h:#define delay_ms sys_msleep
src/new_common.h://#define delay_ms(x) OS_MsDelay(x)
src/new_common.h:#define rtos_delay_milliseconds sys_delay_ms
src/new_common.h:#define delay_ms sys_delay_ms
src/new_common.h:#define rtos_delay_milliseconds sys_delay_ms
src/new_common.h:#define delay_ms sys_delay_ms
src/new_common.h:#define delay_ms(x) vTaskDelay(x / portTICK_PERIOD_MS)
src/new_common.h:void delay_ms(UINT32 ms_count);
src/new_pins.c://       delay_ms(10);
src/win32/stubs/win_rtos_stub.c:int delay_ms(int sec) {

Seems it's only defined for microsoft windows? There is no delay_ms() in sdk/OpenLN882H either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants