kopia lustrzana https://github.com/martin-ger/esp_mqtt
-update to sdk 2.0
- cleanup and make Makefile simple - add define to get local_config - remove esptooldevelop
rodzic
a5e5f97cca
commit
f7ccc86709
|
@ -3,4 +3,5 @@
|
|||
build/
|
||||
firmware/
|
||||
.settings/
|
||||
.DS_Store
|
||||
.DS_Store
|
||||
include/user_config.local.h
|
341
Makefile
341
Makefile
|
@ -1,158 +1,123 @@
|
|||
# Changelog
|
||||
# Changed the variables to include the header file directory
|
||||
# Added global var for the XTENSA tool root
|
||||
#
|
||||
# This make file still needs some work.
|
||||
#
|
||||
#
|
||||
# Output directors to store intermediate compiled files
|
||||
# relative to the project directory
|
||||
BUILD_BASE = build
|
||||
FW_BASE = firmware
|
||||
ESPTOOL = tools/esptool/esptool.py
|
||||
# none sdkota espboot rboot
|
||||
OTA ?= none
|
||||
OTA_APP_ADDR = 0x2000
|
||||
OTA_BOOTLOADER_PATH = ../esp-bootloader/firmware/espboot.bin
|
||||
|
||||
THISDIR:=$(dir $(abspath $(lastword $(MAKEFILE_LIST))))
|
||||
# Base directory for the compiler. Needs a / at the end; if not set it'll use the tools that are in
|
||||
# the PATH.
|
||||
XTENSA_TOOLS_ROOT ?=
|
||||
|
||||
# base directory of the ESP8266 SDK package, absolute
|
||||
SDK_BASE ?= /tools/esp8266/sdk/ESP8266_NONOS_SDK
|
||||
|
||||
#Esptool.py path and port
|
||||
ESPTOOL ?= /tools/esp8266/esptool/esptool.py
|
||||
ESPPORT ?= /dev/tty.SLAB_USBtoUART
|
||||
#ESPPORT ?= /dev/tty.wchusbserial1410
|
||||
#ESPDELAY indicates seconds to wait between flashing the two binary images
|
||||
ESPDELAY ?= 3
|
||||
#ESPBAUD ?= 115200
|
||||
ESPBAUD ?= 460800
|
||||
|
||||
# 40m 26m 20m 80m
|
||||
ESP_FREQ = 40m
|
||||
# qio qout dio dout
|
||||
ESP_MODE = dio
|
||||
#4m 2m 8m 16m 32m
|
||||
ESP_SIZE = 32m
|
||||
|
||||
|
||||
VERBOSE = no
|
||||
FLAVOR = release
|
||||
# name for the target project
|
||||
TARGET = app
|
||||
|
||||
# linker script used for the above linkier step
|
||||
LD_SCRIPT = eagle.app.v6.ld
|
||||
|
||||
# we create two different files for uploading into the flash
|
||||
# these are the names and options to generate them
|
||||
FW_1 = 0x00000
|
||||
FW_2 = 0x40000
|
||||
|
||||
FLAVOR ?= release
|
||||
|
||||
|
||||
#############################################################
|
||||
# Select compile
|
||||
#
|
||||
ifeq ($(OS),Windows_NT)
|
||||
# WIN32
|
||||
# We are under windows.
|
||||
ifeq ($(XTENSA_CORE),lx106)
|
||||
# It is xcc
|
||||
AR = xt-ar
|
||||
CC = xt-xcc
|
||||
LD = xt-xcc
|
||||
NM = xt-nm
|
||||
CPP = xt-cpp
|
||||
OBJCOPY = xt-objcopy
|
||||
#MAKE = xt-make
|
||||
CCFLAGS += -Os --rename-section .text=.irom0.text --rename-section .literal=.irom0.literal
|
||||
else
|
||||
# It is gcc, may be cygwin
|
||||
# Can we use -fdata-sections?
|
||||
CCFLAGS += -Os -ffunction-sections -fno-jump-tables
|
||||
AR = xtensa-lx106-elf-ar
|
||||
CC = xtensa-lx106-elf-gcc
|
||||
LD = xtensa-lx106-elf-gcc
|
||||
NM = xtensa-lx106-elf-nm
|
||||
CPP = xtensa-lx106-elf-cpp
|
||||
OBJCOPY = xtensa-lx106-elf-objcopy
|
||||
endif
|
||||
ESPPORT ?= com1
|
||||
SDK_BASE ?= C:\Espressif\esp_iot_sdk_v1.3.0
|
||||
ifeq ($(PROCESSOR_ARCHITECTURE),AMD64)
|
||||
# ->AMD64
|
||||
endif
|
||||
ifeq ($(PROCESSOR_ARCHITECTURE),x86)
|
||||
# ->IA32
|
||||
endif
|
||||
else
|
||||
# We are under other system, may be Linux. Assume using gcc.
|
||||
# Can we use -fdata-sections?
|
||||
ESPPORT ?= /dev/ttyUSB0
|
||||
SDK_BASE ?= /esptools/esp_iot_sdk_v1.3.0
|
||||
|
||||
CCFLAGS += -Os -ffunction-sections -fno-jump-tables
|
||||
AR = xtensa-lx106-elf-ar
|
||||
CC = xtensa-lx106-elf-gcc
|
||||
LD = xtensa-lx106-elf-gcc
|
||||
NM = xtensa-lx106-elf-nm
|
||||
CPP = xtensa-lx106-elf-cpp
|
||||
OBJCOPY = xtensa-lx106-elf-objcopy
|
||||
UNAME_S := $(shell uname -s)
|
||||
|
||||
ifeq ($(UNAME_S),Linux)
|
||||
# LINUX
|
||||
endif
|
||||
ifeq ($(UNAME_S),Darwin)
|
||||
# OSX
|
||||
endif
|
||||
UNAME_P := $(shell uname -p)
|
||||
ifeq ($(UNAME_P),x86_64)
|
||||
# ->AMD64
|
||||
endif
|
||||
ifneq ($(filter %86,$(UNAME_P)),)
|
||||
# ->IA32
|
||||
endif
|
||||
ifneq ($(filter arm%,$(UNAME_P)),)
|
||||
# ->ARM
|
||||
endif
|
||||
endif
|
||||
#############################################################
|
||||
|
||||
TARGET ?= esp_mqtt
|
||||
|
||||
# which modules (subdirectories) of the project to include in compiling
|
||||
MODULES = driver mqtt user modules
|
||||
EXTRA_INCDIR = include $(SDK_BASE)/../include
|
||||
USER_MODULES = user driver mqtt modules
|
||||
USER_INC = include
|
||||
USER_LIB =
|
||||
|
||||
|
||||
SDK_LIBDIR = lib
|
||||
SDK_LIBS = c gcc phy pp net80211 wpa main lwip crypto ssl json driver
|
||||
SDK_INC = include include/json
|
||||
|
||||
|
||||
|
||||
# Output directors to store intermediate compiled files
|
||||
# relative to the project directory
|
||||
BUILD_BASE = build
|
||||
FIRMWARE_BASE = firmware
|
||||
|
||||
# Opensdk patches stdint.h when compiled with an internal SDK. If you run into compile problems pertaining to
|
||||
# redefinition of int types, try setting this to 'yes'.
|
||||
USE_OPENSDK ?= no
|
||||
|
||||
DATETIME := $(shell date "+%Y-%b-%d_%H:%M:%S_%Z")
|
||||
|
||||
# select which tools to use as compiler, librarian and linker
|
||||
CC := $(XTENSA_TOOLS_ROOT)xtensa-lx106-elf-gcc
|
||||
AR := $(XTENSA_TOOLS_ROOT)xtensa-lx106-elf-ar
|
||||
LD := $(XTENSA_TOOLS_ROOT)xtensa-lx106-elf-gcc
|
||||
OBJCOPY := $(XTENSA_TOOLS_ROOT)xtensa-lx106-elf-objcopy
|
||||
|
||||
|
||||
|
||||
####
|
||||
#### no user configurable options below here
|
||||
####
|
||||
SRC_DIR := $(USER_MODULES)
|
||||
BUILD_DIR := $(addprefix $(BUILD_BASE)/,$(USER_MODULES))
|
||||
|
||||
INCDIR := $(addprefix -I,$(SRC_DIR))
|
||||
EXTRA_INCDIR := $(addprefix -I,$(USER_INC))
|
||||
MODULE_INCDIR := $(addsuffix /include,$(INCDIR))
|
||||
|
||||
SDK_LIBDIR := $(addprefix $(SDK_BASE)/,$(SDK_LIBDIR))
|
||||
SDK_LIBS := $(addprefix -l,$(SDK_LIBS))
|
||||
|
||||
SDK_INCDIR := $(addprefix -I$(SDK_BASE)/,$(SDK_INC))
|
||||
|
||||
SRC := $(foreach sdir,$(SRC_DIR),$(wildcard $(sdir)/*.c))
|
||||
ASMSRC = $(foreach sdir,$(SRC_DIR),$(wildcard $(sdir)/*.S))
|
||||
|
||||
OBJ = $(patsubst %.c,$(BUILD_BASE)/%.o,$(SRC))
|
||||
OBJ += $(patsubst %.S,$(BUILD_BASE)/%.o,$(ASMSRC))
|
||||
|
||||
APP_AR := $(addprefix $(BUILD_BASE)/,$(TARGET).a)
|
||||
TARGET_OUT := $(addprefix $(BUILD_BASE)/,$(TARGET).out)
|
||||
|
||||
|
||||
# libraries used in this project, mainly provided by the SDK
|
||||
LIBS = c gcc hal phy pp net80211 lwip wpa main ssl crypto
|
||||
|
||||
# compiler flags using during compilation of source files
|
||||
CFLAGS = -Os -Wpointer-arith -Wundef -Werror -Wl,-EL -fno-inline-functions -nostdlib -mlongcalls -mtext-section-literals -D__ets__ -DICACHE_FLASH
|
||||
CFLAGS = -g \
|
||||
-Wpointer-arith \
|
||||
-Wundef \
|
||||
-Wl,-EL \
|
||||
-fno-inline-functions \
|
||||
-nostdlib \
|
||||
-mlongcalls \
|
||||
-mtext-section-literals \
|
||||
-ffunction-sections \
|
||||
-fdata-sections \
|
||||
-fno-builtin-printf\
|
||||
-DICACHE_FLASH \
|
||||
-DBUID_TIME=\"$(DATETIME)\"
|
||||
|
||||
# linker flags used to generate the main object file
|
||||
LDFLAGS = -nostdlib -Wl,--no-check-sections -u call_user_start -Wl,-static
|
||||
|
||||
ifeq ($(FLAVOR),debug)
|
||||
CFLAGS += -g -O0
|
||||
LDFLAGS += -g -O0
|
||||
endif
|
||||
|
||||
ifeq ($(FLAVOR),release)
|
||||
CFLAGS += -g -O2
|
||||
LDFLAGS += -g -O2
|
||||
endif
|
||||
|
||||
|
||||
|
||||
# various paths from the SDK used in this project
|
||||
SDK_LIBDIR = lib
|
||||
SDK_LDDIR = ld
|
||||
SDK_INCDIR = include include/json
|
||||
|
||||
####
|
||||
#### no user configurable options below here
|
||||
####
|
||||
FW_TOOL ?= $(ESPTOOL)
|
||||
SRC_DIR := $(MODULES)
|
||||
BUILD_DIR := $(addprefix $(BUILD_BASE)/,$(MODULES))
|
||||
|
||||
SDK_LIBDIR := $(addprefix $(SDK_BASE)/,$(SDK_LIBDIR))
|
||||
SDK_INCDIR := $(addprefix -I$(SDK_BASE)/,$(SDK_INCDIR))
|
||||
|
||||
SRC := $(foreach sdir,$(SRC_DIR),$(wildcard $(sdir)/*.c))
|
||||
OBJ := $(patsubst %.c,$(BUILD_BASE)/%.o,$(SRC))
|
||||
LIBS := $(addprefix -l,$(LIBS))
|
||||
APP_AR := $(addprefix $(BUILD_BASE)/,$(TARGET)_app.a)
|
||||
TARGET_OUT := $(addprefix $(BUILD_BASE)/,$(TARGET).out)
|
||||
|
||||
LD_SCRIPT := $(addprefix -T$(SDK_BASE)/$(SDK_LDDIR)/,$(LD_SCRIPT))
|
||||
|
||||
INCDIR := $(addprefix -I,$(SRC_DIR))
|
||||
EXTRA_INCDIR := $(addprefix -I,$(EXTRA_INCDIR))
|
||||
MODULE_INCDIR := $(addsuffix /include,$(INCDIR))
|
||||
|
||||
FW_FILE_1 := $(addprefix $(FW_BASE)/,$(FW_1).bin)
|
||||
FW_FILE_2 := $(addprefix $(FW_BASE)/,$(FW_2).bin)
|
||||
ifeq ($(FLAVOR),release)
|
||||
LDFLAGS += -g -O0
|
||||
endif
|
||||
|
||||
V ?= $(VERBOSE)
|
||||
ifeq ("$(V)","1")
|
||||
ifeq ("$(V)","yes")
|
||||
Q :=
|
||||
vecho := @true
|
||||
else
|
||||
|
@ -160,6 +125,49 @@ Q := @
|
|||
vecho := @echo
|
||||
endif
|
||||
|
||||
ifeq ("$(USE_OPENSDK)","yes")
|
||||
CFLAGS += -DUSE_OPENSDK
|
||||
else
|
||||
CFLAGS += -D_STDINT_H
|
||||
endif
|
||||
|
||||
ifneq ("$(wildcard $(THISDIR)/include/user_config.local.h)","")
|
||||
CFLAGS += -DLOCAL_CONFIG_AVAILABLE
|
||||
endif
|
||||
|
||||
|
||||
ESPTOOL_OPTS=--port $(ESPPORT) --baud $(ESPBAUD)
|
||||
|
||||
#32m
|
||||
ESP_INIT_DATA_DEFAULT_ADDR = 0xfc000
|
||||
|
||||
ifeq ("$(ESP_SIZE)","16m")
|
||||
ESP_INIT_DATA_DEFAULT_ADDR = 0x1fc000
|
||||
else ifeq ("$(ESP_SIZE)","32m")
|
||||
ESP_INIT_DATA_DEFAULT_ADDR = 0x3fc000
|
||||
endif
|
||||
|
||||
ifeq ("$(OTA)","espboot")
|
||||
OUTPUT := $(addprefix $(FIRMWARE_BASE)/,$(TARGET)-0x2000.bin)
|
||||
ESPTOOL_WRITE = write_flash --flash_freq $(ESP_FREQ) --flash_mode $(ESP_MODE) --flash_size $(ESP_SIZE) \
|
||||
0x00000 $(OTA_BOOTLOADER_PATH) \
|
||||
$(OTA_APP_ADDR) $(OUTPUT) \
|
||||
$(ESP_INIT_DATA_DEFAULT_ADDR) $(SDK_BASE)/bin/esp_init_data_default.bin
|
||||
|
||||
ESPTOOL_FLASHDEF=--version=2
|
||||
LD_SCRIPT = -Tld/with-espboot-flash-at-0x2000-size-1M.ld
|
||||
else
|
||||
OUTPUT := $(addprefix $(FIRMWARE_BASE)/,$(TARGET))
|
||||
ESPTOOL_WRITE = write_flash --flash_freq $(ESP_FREQ) --flash_mode $(ESP_MODE) --flash_size $(ESP_SIZE) \
|
||||
0x00000 $(OUTPUT)0x00000.bin \
|
||||
0x10000 $(OUTPUT)0x10000.bin \
|
||||
$(ESP_INIT_DATA_DEFAULT_ADDR) $(SDK_BASE)/bin/esp_init_data_default.bin
|
||||
|
||||
ESPTOOL_FLASHDEF=
|
||||
LD_SCRIPT = -T$(SDK_BASE)/ld/eagle.app.v6.ld
|
||||
endif
|
||||
|
||||
|
||||
vpath %.c $(SRC_DIR)
|
||||
|
||||
define compile-objects
|
||||
|
@ -168,49 +176,52 @@ $1/%.o: %.c
|
|||
$(Q) $(CC) $(INCDIR) $(MODULE_INCDIR) $(EXTRA_INCDIR) $(SDK_INCDIR) $(CFLAGS) -c $$< -o $$@
|
||||
endef
|
||||
|
||||
|
||||
|
||||
.PHONY: all checkdirs clean
|
||||
|
||||
all: checkdirs $(TARGET_OUT) $(FW_FILE_1) $(FW_FILE_2)
|
||||
all: touch checkdirs $(OUTPUT)
|
||||
|
||||
$(FW_FILE_1): $(TARGET_OUT)
|
||||
touch:
|
||||
$(vecho) "-------------------------------------------\n"
|
||||
$(vecho) "BUID TIME $(DATETIME)"
|
||||
$(vecho) "-------------------------------------------\n"
|
||||
$(Q) touch user/user_main.c
|
||||
|
||||
checkdirs: $(BUILD_DIR) $(FIRMWARE_BASE)
|
||||
|
||||
$(OUTPUT): $(TARGET_OUT)
|
||||
$(vecho) "FW $@"
|
||||
$(ESPTOOL) elf2image $< -o $(FW_BASE)/
|
||||
|
||||
$(FW_FILE_2): $(TARGET_OUT)
|
||||
$(vecho) "FW $@"
|
||||
$(ESPTOOL) elf2image $< -o $(FW_BASE)/
|
||||
$(Q) $(ESPTOOL) elf2image $(ESPTOOL_FLASHDEF) $< -o $(OUTPUT)
|
||||
|
||||
$(BUILD_DIR):
|
||||
$(Q) mkdir -p $@
|
||||
|
||||
$(FIRMWARE_BASE):
|
||||
$(Q) mkdir -p $@
|
||||
|
||||
$(TARGET_OUT): $(APP_AR)
|
||||
$(vecho) "LD $@"
|
||||
$(Q) $(LD) -L$(SDK_LIBDIR) $(LD_SCRIPT) $(LDFLAGS) -Wl,--start-group $(LIBS) $(APP_AR) -Wl,--end-group -o $@
|
||||
$(Q) $(LD) -L$(SDK_LIBDIR) $(LD_SCRIPT) $(LDFLAGS) -Wl,--start-group $(SDK_LIBS) $(APP_AR) -Wl,--end-group -o $@
|
||||
|
||||
$(APP_AR): $(OBJ)
|
||||
$(vecho) "AR $@"
|
||||
$(Q) $(AR) cru $@ $^
|
||||
|
||||
checkdirs: $(BUILD_DIR) $(FW_BASE)
|
||||
flash:
|
||||
$(ESPTOOL) $(ESPTOOL_OPTS) $(ESPTOOL_WRITE)
|
||||
|
||||
$(BUILD_DIR):
|
||||
$(Q) mkdir -p $@
|
||||
fast: all flash openport
|
||||
|
||||
openport:
|
||||
$(vecho) "After flash, terminal will enter serial port screen"
|
||||
$(vecho) "Please exit with command:"
|
||||
$(vecho) "\033[0;31m" "Ctrl + A + k" "\033[0m"
|
||||
|
||||
firmware:
|
||||
$(Q) mkdir -p $@
|
||||
|
||||
flash: $(FW_FILE_1) $(FW_FILE_2)
|
||||
$(ESPTOOL) -p $(ESPPORT) write_flash $(FW_1) $(FW_FILE_1) $(FW_2) $(FW_FILE_2)
|
||||
|
||||
test: flash
|
||||
screen $(ESPPORT) 115200
|
||||
|
||||
rebuild: clean all
|
||||
#@read -p "Press any key to continue... " -n1 -s
|
||||
@screen $(ESPPORT) 115200
|
||||
|
||||
clean:
|
||||
$(Q) rm -f $(APP_AR)
|
||||
$(Q) rm -f $(TARGET_OUT)
|
||||
$(Q) rm -rf $(BUILD_DIR)
|
||||
$(Q) rm -rf $(BUILD_BASE)
|
||||
$(Q) rm -f $(FW_FILE_1)
|
||||
$(Q) rm -f $(FW_FILE_2)
|
||||
$(Q) rm -rf $(FW_BASE)
|
||||
|
||||
$(Q) rm -rf $(FIRMWARE_BASE)
|
||||
$(foreach bdir,$(BUILD_DIR),$(eval $(call compile-objects,$(bdir))))
|
||||
|
|
|
@ -3,5 +3,11 @@
|
|||
|
||||
#define USE_OPTIMIZE_PRINTF
|
||||
|
||||
#ifndef LOCAL_CONFIG_AVAILABLE
|
||||
#error Please copy user_config.sample.h to user_config.local.h and modify your configurations
|
||||
#else
|
||||
#include "user_config.local.h"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef __MQTT_CONFIG_H__
|
||||
#define __MQTT_CONFIG_H__
|
||||
|
||||
#define CFG_HOLDER 0x00FF55A4 /* Change this value to load default configurations */
|
||||
#define CFG_HOLDER 0x00FF55A5 /* Change this value to load default configurations */
|
||||
#define CFG_LOCATION 0x3C /* Please don't change or if you know what you doing */
|
||||
#define MQTT_SSL_ENABLE
|
||||
|
||||
|
@ -12,12 +12,12 @@
|
|||
#define MQTT_BUF_SIZE 1024
|
||||
#define MQTT_KEEPALIVE 120 /*second*/
|
||||
|
||||
#define MQTT_CLIENT_ID "DVES_%08X"
|
||||
#define MQTT_USER "DVES_USER"
|
||||
#define MQTT_PASS "DVES_PASS"
|
||||
#define MQTT_CLIENT_ID "CLIENT_%08X"
|
||||
#define MQTT_USER "USER"
|
||||
#define MQTT_PASS "PASS"
|
||||
|
||||
#define STA_SSID "DVES_HOME"
|
||||
#define STA_PASS "yourpassword"
|
||||
#define STA_SSID "SSID"
|
||||
#define STA_PASS "PASSWORD"
|
||||
#define STA_TYPE AUTH_WPA2_PSK
|
||||
|
||||
#define MQTT_RECONNECT_TIMEOUT 5 /*second*/
|
|
@ -29,7 +29,7 @@
|
|||
*/
|
||||
#ifndef USER_AT_MQTT_H_
|
||||
#define USER_AT_MQTT_H_
|
||||
#include "mqtt_config.h"
|
||||
#include "user_config.h"
|
||||
#include "mqtt_msg.h"
|
||||
#include "user_interface.h"
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
#ifndef MQTT_MSG_H
|
||||
#define MQTT_MSG_H
|
||||
#include "mqtt_config.h"
|
||||
#include "user_config.h"
|
||||
#include "c_types.h"
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
# Enforce Unix newlines
|
||||
*.css text eol=lf
|
||||
*.html text eol=lf
|
||||
*.js text eol=lf
|
||||
*.json text eol=lf
|
||||
*.less text eol=lf
|
||||
*.md text eol=lf
|
||||
*.svg text eol=lf
|
||||
*.yml text eol=lf
|
||||
*.py text eol=lf
|
||||
*.sh text eol=lf
|
|
@ -1 +0,0 @@
|
|||
Subproject commit d0d6c5f6b9fbfb9725ced14f9f201b1be8b2e3d5
|
|
@ -32,15 +32,15 @@
|
|||
#include "osapi.h"
|
||||
#include "mqtt.h"
|
||||
#include "wifi.h"
|
||||
#include "config.h"
|
||||
#include "debug.h"
|
||||
#include "gpio.h"
|
||||
#include "user_interface.h"
|
||||
#include "mem.h"
|
||||
#include "config.h"
|
||||
|
||||
MQTT_Client mqttClient;
|
||||
|
||||
void wifiConnectCb(uint8_t status)
|
||||
static void ICACHE_FLASH_ATTR wifiConnectCb(uint8_t status)
|
||||
{
|
||||
if(status == STATION_GOT_IP){
|
||||
MQTT_Connect(&mqttClient);
|
||||
|
@ -48,7 +48,7 @@ void wifiConnectCb(uint8_t status)
|
|||
MQTT_Disconnect(&mqttClient);
|
||||
}
|
||||
}
|
||||
void mqttConnectedCb(uint32_t *args)
|
||||
static void ICACHE_FLASH_ATTR mqttConnectedCb(uint32_t *args)
|
||||
{
|
||||
MQTT_Client* client = (MQTT_Client*)args;
|
||||
INFO("MQTT: Connected\r\n");
|
||||
|
@ -62,19 +62,19 @@ void mqttConnectedCb(uint32_t *args)
|
|||
|
||||
}
|
||||
|
||||
void mqttDisconnectedCb(uint32_t *args)
|
||||
static void ICACHE_FLASH_ATTR mqttDisconnectedCb(uint32_t *args)
|
||||
{
|
||||
MQTT_Client* client = (MQTT_Client*)args;
|
||||
INFO("MQTT: Disconnected\r\n");
|
||||
}
|
||||
|
||||
void mqttPublishedCb(uint32_t *args)
|
||||
static void ICACHE_FLASH_ATTR mqttPublishedCb(uint32_t *args)
|
||||
{
|
||||
MQTT_Client* client = (MQTT_Client*)args;
|
||||
INFO("MQTT: Published\r\n");
|
||||
}
|
||||
|
||||
void mqttDataCb(uint32_t *args, const char* topic, uint32_t topic_len, const char *data, uint32_t data_len)
|
||||
static void ICACHE_FLASH_ATTR mqttDataCb(uint32_t *args, const char* topic, uint32_t topic_len, const char *data, uint32_t data_len)
|
||||
{
|
||||
char *topicBuf = (char*)os_zalloc(topic_len+1),
|
||||
*dataBuf = (char*)os_zalloc(data_len+1);
|
||||
|
@ -93,10 +93,10 @@ void mqttDataCb(uint32_t *args, const char* topic, uint32_t topic_len, const cha
|
|||
}
|
||||
|
||||
|
||||
void user_init(void)
|
||||
static void ICACHE_FLASH_ATTR app_init(void)
|
||||
{
|
||||
uart_init(BIT_RATE_115200, BIT_RATE_115200);
|
||||
os_delay_us(1000000);
|
||||
// os_delay_us(1000000);
|
||||
|
||||
CFG_Load();
|
||||
|
||||
|
@ -116,3 +116,7 @@ void user_init(void)
|
|||
|
||||
INFO("\r\nSystem started ...\r\n");
|
||||
}
|
||||
void user_init(void)
|
||||
{
|
||||
system_init_done_cb(app_init);
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue