Skip to content

Commit

Permalink
Allow to disable more drivers and features in order to reduce binary …
Browse files Browse the repository at this point in the history
…size (openshwprojects#1500)

* Update obk_config.h

* Update obk_config.h

* shared

* fx

* he

* fix

* fx

* ffff

* F

* T

* tre

* fcx

* leeed

* ww

* w

* fx

* t

* ENABLE_OLD_YAML_GENERATOR

* w

* startyuip[

* dis all

* remove test post

* ENABLE_HTTP_SEND

* extra guard

* ENABLE_TCP_COMMANDLINE

* better OBK_DISABLE_ALL_DRIVERS

* tr

* ENABLE_PING_WATCHDOG

* ENABLE_HA_DISCOVERY

* TEST WITH EMPTY USER_MAIN

* fx

* no mqtt

* nm

* tr

* ENABLE_MQTT

* Update cmd_newLEDDriver.c

* tr

* header

* fx

* Update user_main.c

* t

* Update hal_main_bk7231.c

* w

* ENABLE_DRIVER_IR

* RESTORE

* fx

* #warning "Platform not defined"

* fx 1

* Update obk_config.h

* ENABLE_DRIVER_TESTPOWER

* DS1820

* fx

* fx

* enable DHT on W800

* Update Makefile

* ntp w800

* ntp

* ssdp

* OWM AND CHARTS

* why utils net has flash pub included

* nmakefile only, no refs

* makefile only

* drv

* Update Makefile

* drcs

* ENABLE_DRIVER_BMP280

* Update Makefile

* d

* ENABLE_I2C

* Update Makefile

* fin
  • Loading branch information
openshwprojects authored Jan 10, 2025
1 parent a45714b commit eb5b1ca
Show file tree
Hide file tree
Showing 64 changed files with 763 additions and 327 deletions.
1 change: 1 addition & 0 deletions platforms/W600/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ CSRCS += $(_SHARED_APP)/driver/drv_dht_internal.c
CSRCS += $(_SHARED_APP)/driver/drv_httpButtons.c
CSRCS += $(_SHARED_APP)/driver/drv_main.c
CSRCS += $(_SHARED_APP)/driver/drv_ntp.c
CSRCS += $(_SHARED_APP)/driver/drv_ds1820_simple.c
CSRCS += $(_SHARED_APP)/driver/drv_tasmotaDeviceGroups.c
CSRCS += $(_SHARED_APP)/driver/drv_test_drivers.c
CSRCS += $(_SHARED_APP)/driver/drv_bridge_driver.c
Expand Down
41 changes: 41 additions & 0 deletions platforms/W800/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,50 @@ CSRCS += $(_SHARED_APP)/new_ping.c
CSRCS += $(_SHARED_APP)/new_pins.c
CSRCS += $(_SHARED_APP)/rgb2hsv.c
CSRCS += $(_SHARED_APP)/tiny_crc8.c
CSRCS += $(_SHARED_APP)/driver/drv_adcButton.c
CSRCS += $(_SHARED_APP)/driver/drv_adcSmoother.c
CSRCS += $(_SHARED_APP)/driver/drv_battery.c
CSRCS += $(_SHARED_APP)/driver/drv_bp1658cj.c
CSRCS += $(_SHARED_APP)/driver/drv_bp5758d.c
CSRCS += $(_SHARED_APP)/driver/drv_bmp280.c
CSRCS += $(_SHARED_APP)/driver/drv_bmpi2c.c
CSRCS += $(_SHARED_APP)/driver/drv_bridge_driver.c
CSRCS += $(_SHARED_APP)/driver/drv_cht8305.c
CSRCS += $(_SHARED_APP)/driver/drv_charts.c
CSRCS += $(_SHARED_APP)/driver/drv_chargingLimit.c
CSRCS += $(_SHARED_APP)/driver/drv_ddp.c
CSRCS += $(_SHARED_APP)/driver/drv_debouncer.c
CSRCS += $(_SHARED_APP)/driver/drv_doorSensorWithDeepSleep.c
CSRCS += $(_SHARED_APP)/driver/drv_drawers.c
CSRCS += $(_SHARED_APP)/driver/drv_freeze.c
CSRCS += $(_SHARED_APP)/driver/drv_httpButtons.c
CSRCS += $(_SHARED_APP)/driver/drv_kp18058.c
CSRCS += $(_SHARED_APP)/driver/drv_kp18068.c
CSRCS += $(_SHARED_APP)/driver/drv_max72xx_clock.c
CSRCS += $(_SHARED_APP)/driver/drv_max72xx_internal.c
CSRCS += $(_SHARED_APP)/driver/drv_max72xx_single.c
CSRCS += $(_SHARED_APP)/driver/drv_max6675.c
CSRCS += $(_SHARED_APP)/driver/drv_mcp9808.c
CSRCS += $(_SHARED_APP)/driver/drv_main.c
CSRCS += $(_SHARED_APP)/driver/drv_ntp.c
CSRCS += $(_SHARED_APP)/driver/drv_ntp_events.c
CSRCS += $(_SHARED_APP)/driver/drv_pt6523.c
CSRCS += $(_SHARED_APP)/driver/drv_pwmToggler.c
CSRCS += $(_SHARED_APP)/driver/drv_sgp.c
CSRCS += $(_SHARED_APP)/driver/drv_soft_i2c.c
CSRCS += $(_SHARED_APP)/driver/drv_shiftRegister.c
CSRCS += $(_SHARED_APP)/driver/drv_tasmotaDeviceGroups.c
CSRCS += $(_SHARED_APP)/driver/drv_ssdp.c
CSRCS += $(_SHARED_APP)/driver/drv_ds1820_simple.c
CSRCS += $(_SHARED_APP)/driver/drv_charts.c
CSRCS += $(_SHARED_APP)/driver/drv_dht.c
CSRCS += $(_SHARED_APP)/i2c/drv_i2c_main.c
CSRCS += $(_SHARED_APP)/i2c/drv_i2c_tc74.c
CSRCS += $(_SHARED_APP)/i2c/drv_i2c_ads1115.c
CSRCS += $(_SHARED_APP)/i2c/drv_i2c_lcd_pcf8574t.c
CSRCS += $(_SHARED_APP)/i2c/drv_i2c_mcp23017.c
CSRCS += $(_SHARED_APP)/driver/drv_dht_internal.c
CSRCS += $(_SHARED_APP)/driver/drv_openWeatherMap.c
CSRCS += $(_SHARED_APP)/user_main.c
CSRCS += main.c

Expand Down
4 changes: 4 additions & 0 deletions src/cmnds/cmd_if.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ float getFlagValue(const char *s) {
return CFG_HasFlag(idx);
}

#if ENABLE_LED_BASIC
float getLedDimmer(const char *s) {
return LED_GetDimmer();
}
Expand Down Expand Up @@ -220,6 +221,7 @@ float getLedSaturation(const char *s) {
float getLedTemperature(const char *s) {
return LED_GetTemperature();
}
#endif

float getActiveRepeatingEvents(const char *s) {
return RepeatingEvents_GetActiveCount();
Expand Down Expand Up @@ -369,6 +371,7 @@ const constant_t g_constants[] = {
//cnstdetail:"descr":"Provides flag access, as above.",
//cnstdetail:"requires":""}
{"$FLAG*", &getFlagValue},
#if ENABLE_LED_BASIC
//cnstdetail:{"name":"$led_dimmer",
//cnstdetail:"title":"$led_dimmer",
//cnstdetail:"descr":"Current value of LED dimmer, 0-100 range",
Expand Down Expand Up @@ -409,6 +412,7 @@ const constant_t g_constants[] = {
//cnstdetail:"descr":"Current LED temperature value",
//cnstdetail:"requires":""}
{"$led_temperature", &getLedTemperature},
#endif
//cnstdetail:{"name":"$activeRepeatingEvents",
//cnstdetail:"title":"$activeRepeatingEvents",
//cnstdetail:"descr":"Current number of active repeating events",
Expand Down
8 changes: 7 additions & 1 deletion src/cmnds/cmd_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ static commandResult_t CMD_DeepSleep(const void* context, const char* cmd, const

return CMD_RES_OK;
}

#if ENABLE_HA_DISCOVERY
static commandResult_t CMD_ScheduleHADiscovery(const void* context, const char* cmd, const char* args, int cmdFlags) {
int delay;

Expand All @@ -230,6 +230,7 @@ static commandResult_t CMD_ScheduleHADiscovery(const void* context, const char*

return CMD_RES_OK;
}
#endif
static commandResult_t CMD_SetFlag(const void* context, const char* cmd, const char* args, int cmdFlags) {
int flag, val;

Expand Down Expand Up @@ -362,6 +363,7 @@ static commandResult_t CMD_StartupCommand(const void* context, const char* cmd,
// so we know arguments count in Tokenizer. 'cmd' argument is
// only for warning display
if (Tokenizer_CheckArgsCountAndPrintWarning(cmd, 1)) {
ADDLOG_INFO(LOG_FEATURE_CMD, "Cmd is %s",g_cfg.initCommandLine);
return CMD_RES_NOT_ENOUGH_ARGUMENTS;
}
cmdToSet = Tokenizer_GetArg(0);
Expand Down Expand Up @@ -799,11 +801,13 @@ void CMD_Init_Early() {
//cmddetail:"fn":"CMD_HTTPOTA","file":"cmnds/cmd_main.c","requires":"",
//cmddetail:"examples":""}
CMD_RegisterCommand("ota_http", CMD_HTTPOTA, NULL);
#if ENABLE_HA_DISCOVERY
//cmddetail:{"name":"scheduleHADiscovery","args":"[Seconds]",
//cmddetail:"descr":"This will schedule HA discovery, the discovery will happen with given number of seconds, but timer only counts when MQTT is connected. It will not work without MQTT online, so you must set MQTT credentials first.",
//cmddetail:"fn":"CMD_ScheduleHADiscovery","file":"cmnds/cmd_main.c","requires":"",
//cmddetail:"examples":""}
CMD_RegisterCommand("scheduleHADiscovery", CMD_ScheduleHADiscovery, NULL);
#endif
//cmddetail:{"name":"flags","args":"[IntegerValue]",
//cmddetail:"descr":"Sets the device flags",
//cmddetail:"fn":"CMD_Flags","file":"cmnds/cmd_main.c","requires":"",
Expand Down Expand Up @@ -887,9 +891,11 @@ void CMD_Init_Early() {


void CMD_Init_Delayed() {
#if ENABLE_TCP_COMMANDLINE
if (CFG_HasFlag(OBK_FLAG_CMD_ENABLETCPRAWPUTTYSERVER)) {
CMD_StartTCPCommandLine();
}
#endif
#if defined(PLATFORM_BEKEN) || defined(WINDOWS) || defined(PLATFORM_BL602) || defined(PLATFORM_ESPIDF) \
|| defined(PLATFORM_RTL87X0C)
UART_AddCommands();
Expand Down
Loading

0 comments on commit eb5b1ca

Please sign in to comment.