diff --git a/.github/workflows/workflow.yaml b/.github/workflows/workflow.yaml index 1216742b1..e1822028e 100644 --- a/.github/workflows/workflow.yaml +++ b/.github/workflows/workflow.yaml @@ -226,6 +226,8 @@ jobs: variant: sensors - platform: OpenBK7231N variant: hlw8112 + - platform: OpenBK7231N + variant: battery - platform: OpenBL602 variant: berry @@ -256,6 +258,9 @@ jobs: - platform: OpenBK7238 variant: irRemoteESP gcc: apt + - platform: OpenBK7238 + variant: battery + gcc: apt steps: - name: Source checkout uses: actions/checkout@v4 diff --git a/Makefile b/Makefile index bf5cabc7a..14b4b7a70 100644 --- a/Makefile +++ b/Makefile @@ -29,6 +29,8 @@ else ifeq ($(VARIANT),sensors) OBK_VARIANT = 5 else ifeq ($(VARIANT),hlw8112) OBK_VARIANT = 6 +else ifeq ($(VARIANT),battery) +OBK_VARIANT = 7 else ifeq ($(VARIANT),2M) OBK_VARIANT = 1 ESP_FSIZE = 2MB diff --git a/src/obk_config.h b/src/obk_config.h index 9f1e6bbf9..abacabb91 100644 --- a/src/obk_config.h +++ b/src/obk_config.h @@ -11,6 +11,7 @@ #define OBK_VARIANT_IRREMOTEESP 4 #define OBK_VARIANT_SENSORS 5 #define OBK_VARIANT_HLW8112 6 +#define OBK_VARIANT_BATTERY 7 #define OBK_VARIANT_ESP2M 1 #define OBK_VARIANT_ESP4M 2 #define OBK_VARIANT_ESP2M_BERRY 3 @@ -331,7 +332,7 @@ #undef ENABLE_DRIVER_ADCSMOOTHER #endif -#if (OBK_VARIANT == OBK_VARIANT_TUYAMCU || OBK_VARIANT == OBK_VARIANT_IRREMOTEESP || OBK_VARIANT == OBK_VARIANT_SENSORS || PLATFORM_BK7252 || PLATFORM_BK7252N) +#if (OBK_VARIANT == OBK_VARIANT_TUYAMCU || OBK_VARIANT == OBK_VARIANT_IRREMOTEESP || OBK_VARIANT == OBK_VARIANT_SENSORS || OBK_VARIANT == OBK_VARIANT_BATTERY || PLATFORM_BK7252 || PLATFORM_BK7252N) #undef ENABLE_DRIVER_BL0937 #undef ENABLE_DRIVER_BL0942 #undef ENABLE_DRIVER_BL0942SPI @@ -349,7 +350,7 @@ #define ENABLE_DRIVER_IRREMOTEESP 1 #endif -#if (OBK_VARIANT == OBK_VARIANT_SENSORS) +#if (OBK_VARIANT == OBK_VARIANT_SENSORS || OBK_VARIANT == OBK_VARIANT_BATTERY) #define ENABLE_DRIVER_BMP280 1 #define ENABLE_DRIVER_BMPI2C 1 #define ENABLE_DRIVER_SHT3X 1 @@ -364,6 +365,18 @@ #undef ENABLE_DRIVER_CSE7766 #endif +#if (OBK_VARIANT == OBK_VARIANT_BATTERY) +#undef ENABLE_DRIVER_BMP280 +#undef ENABLE_DRIVER_LED +#undef ENABLE_DRIVER_SM16703P +#undef ENABLE_DRIVER_PIXELANIM +#undef ENABLE_DRIVER_SM15155E +#undef ENABLE_DRIVER_IR +#undef ENABLE_DRIVER_NEO6M +#undef ENABLE_DRIVER_HTTPBUTTONS +#undef ENABLE_DRIVER_KP18058 +#endif + #elif PLATFORM_LN882H //#define ENABLE_SEND_POSTANDGET 1 diff --git a/src/user_main.c b/src/user_main.c index 1bcbcc091..26a0ad4e8 100644 --- a/src/user_main.c +++ b/src/user_main.c @@ -190,6 +190,15 @@ static int get_tsen_adc( #endif #if PLATFORM_BEKEN +#if (OBK_VARIANT == OBK_VARIANT_BATTERY) + #if PLATFORM_BEKEN_NEW + #define START_MS_DELAY 10; + #else + #define START_MS_DELAY 0; + #endif +#else + #define START_MS_DELAY 250; +#endif // this function waits for the extended app functions to finish starting. extern void extended_app_waiting_for_launch(void); void extended_app_waiting_for_launch2() @@ -204,9 +213,9 @@ void extended_app_waiting_for_launch2() // wait 100ms at the start. // TCP is being setup in a different thread, and there does not seem to be a way to find out if it's complete yet? // so just wait a bit, and then start. - int startDelay = 250; + uint8_t startDelay = START_MS_DELAY; bk_printf("\r\ndelaying start\r\n"); - for(int i = 0; i < startDelay / 10; i++) + for(uint8_t i = 0; i < startDelay / 10; i++) { rtos_delay_milliseconds(10); bk_printf("#Startup delayed %dms#\r\n", i * 10); @@ -722,11 +731,16 @@ void Main_OnEverySecond() #if PLATFORM_BEKEN UINT32 temperature; temp_single_get_current_temperature(&temperature); -#if PLATFORM_BK7231T - g_wifi_temperature = 2.21f * (temperature / 25.0f) - 65.91f; #if PLATFORM_BEKEN_NEW - g_wifi_temperature = temperature * 0.04f; -#endif + #if PLATFORM_BK7231N + g_wifi_temperature = (-0.38f * temperature) + 156.0f; + #elif PLATFORM_BK7238 || PLATFORM_BK7252N + g_wifi_temperature = (-0.4f * temperature) + 131.0f; + #else + g_wifi_temperature = temperature * 0.128f; + #endif +#elif PLATFORM_BK7231T + g_wifi_temperature = 2.21f * (temperature / 25.0f) - 65.91f; #else g_wifi_temperature = (-0.457f * temperature) + 188.474f; #endif