Skip to content
This repository has been archived by the owner on Jan 14, 2022. It is now read-only.

Commit

Permalink
feat(light): add macro ENABLE_LIGHT to control light
Browse files Browse the repository at this point in the history
  • Loading branch information
ustccw committed Apr 17, 2018
1 parent 1961f05 commit e6fb5bd
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 3 deletions.
14 changes: 11 additions & 3 deletions Makefile
Expand Up @@ -6,12 +6,16 @@
export PROJECT_PATH := $(PWD)
export IDF_PATH ?= $(PWD)/esp-idf

ifeq ($(CLIENT), 1)
PROJECT_NAME := iotivity_client
endif

ifeq ($(SERVER), 1)
PROJECT_NAME := iotivity_server
else
PROJECT_NAME := iotivity_client
endif

PROJECT_NAME ?= esp32_iotivity

include $(IDF_PATH)/make/project.mk

# sdkconfig is included project.mk recursively
Expand All @@ -21,7 +25,7 @@ ifdef CONFIG_IOTIVITY_CLIENT
endif

ifdef CONFIG_IOTIVITY_SERVER
CFLAGS += -DOC_SERVER
CFLAGS += -DOC_SERVER
endif

ifdef CONFIG_OC_DEBUG
Expand All @@ -32,6 +36,10 @@ ifdef CONFIG_APP_DEBUG
CFLAGS += -DAPP_DEBUG
endif

ifdef CONFIG_ENABLE_LIGHT
CFLAGS += -DENABLE_LIGHT
endif

ifdef CONFIG_DYNAMIC
CFLAGS += -DOC_DYNAMIC_ALLOCATION
endif
Expand Down
6 changes: 6 additions & 0 deletions components/iotivity/adapter/src/debug_print.c
Expand Up @@ -44,6 +44,12 @@ void print_macro_info()
printf("OC_IPV4 not defined!\n");
#endif

#ifdef ENABLE_LIGHT
printf("ENABLE_LIGHT defined!\n");
#else
printf("ENABLE_LIGHT not defined!\n");
#endif

#ifdef OC_SECURITY
printf("OC_SECURITY defined!\n");
#else
Expand Down
5 changes: 5 additions & 0 deletions main/Kconfig.projbuild
Expand Up @@ -37,6 +37,11 @@ config APP_DEBUG
help
enable or disable application debug

config ENABLE_LIGHT
bool "ENABLE_LIGHT"
help
enable or disable light

config DYNAMIC
bool "DYNAMIC"
help
Expand Down
2 changes: 2 additions & 0 deletions main/esp32_client/client_freertos.c
Expand Up @@ -108,10 +108,12 @@ observe_light(oc_client_response_t *data)
oc_rep_start_root_object();

oc_rep_set_boolean(root, state, !light_state);
#ifdef ENABLE_LIGHT
oc_rep_set_int(root, r_value, r_value);
oc_rep_set_int(root, g_value, g_value);
oc_rep_set_int(root, b_value, b_value);
oc_rep_set_int(root, w_value, w_value);
#endif
// set more param to struct linklist
oc_rep_end_root_object();

Expand Down

0 comments on commit e6fb5bd

Please sign in to comment.