Skip to content

Commit

Permalink
per user request - a flag - [NETIF] Use short device name as a hostna…
Browse files Browse the repository at this point in the history
…me instead of a long name
  • Loading branch information
openshwprojects committed Jan 8, 2023
1 parent 9ec415a commit edf16af
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/cmnds/cmd_newLEDDriver.c
Original file line number Diff line number Diff line change
Expand Up @@ -1078,7 +1078,7 @@ commandResult_t LED_SetBaseColor(const void *context, const char *cmd, const cha
c++;


if (CFG_HasFlag(OBK_LED_SETTING_WHITE_RGB_ENABLES_CW_MODE)) {
if (CFG_HasFlag(OBK_FLAG_LED_SETTING_WHITE_RGB_ENABLES_CW)) {
if (!stricmp(c, "FFFFFF")) {
SET_LightMode(Light_Temperature);
sendTemperatureChange();
Expand Down
12 changes: 12 additions & 0 deletions src/httpserver/http_fns.c
Original file line number Diff line number Diff line change
Expand Up @@ -2739,6 +2739,18 @@ const char* g_obk_flagNames[] = {
#endif
"[HASS] Invoke HomeAssistant discovery on change to ip address, configuration",
"[LED] Setting RGB white (FFFFFF) enables temperature mode",
"[NETIF] Use short device name as a hostname instead of a long name",
"error",
"error",
"error",
"error",
"error",
"error",
"error",
"error",
"error",
"error",
"error",
"error",
"error",
};
Expand Down
7 changes: 7 additions & 0 deletions src/new_cfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,13 @@ const char *CFG_GetShortDeviceName(){
return "";
return g_cfg.shortDeviceName;
}
// called from SDK
const char *CFG_GetOpenBekenHostName() {
if (CFG_HasFlag(OBK_FLAG_USE_SHORT_DEVICE_NAME_AS_HOSTNAME)) {
return CFG_GetShortDeviceName();
}
return CFG_GetDeviceName();
}

int CFG_GetMQTTPort() {
return g_cfg.mqtt_port;
Expand Down
5 changes: 3 additions & 2 deletions src/new_pins.h
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,10 @@ typedef struct pinsState_s {
#define OBK_FLAG_POWER_ALLOW_NEGATIVE 25
#define OBK_FLAG_USE_SECONDARY_UART 26
#define OBK_FLAG_AUTOMAIC_HASS_DISCOVERY 27
#define OBK_LED_SETTING_WHITE_RGB_ENABLES_CW_MODE 28
#define OBK_FLAG_LED_SETTING_WHITE_RGB_ENABLES_CW 28
#define OBK_FLAG_USE_SHORT_DEVICE_NAME_AS_HOSTNAME 29

#define OBK_TOTAL_FLAGS 29
#define OBK_TOTAL_FLAGS 30


#define CGF_MQTT_CLIENT_ID_SIZE 64
Expand Down

0 comments on commit edf16af

Please sign in to comment.