First version that compiles with new file layout.

Had to make many changes to get it to compile across many files,
including removing the LOCAL specifier from almost all functions.
Edited the Makefile to compile all three files and link them.
Haven't tested on hardware yet, that's the next step.

Lots of small changes to avoid warnings, now that I have turned
-Wall on. This makes the code a bit "better".

Signed-off-by: A.M. Rowsell <amrowsell@frozenelectronics.ca>
This commit is contained in:
A.M. Rowsell 2019-01-20 21:13:04 -05:00
commit 48702bf328
Signed by: amr
GPG key ID: 0B6E2D8375CF79A9
7 changed files with 124 additions and 72 deletions

15
main.c
View file

@ -1,8 +1,16 @@
#include <stdint.h>
#include "user_interface.h"
#include "ets_sys.h"
#include "os_type.h"
#include "osapi.h"
#include "mem.h"
#include "espconn.h"
#include "main.h"
#include "mqtt.h"
#include "onewire.h"
#include "main.h"
static os_timer_t oneTimer;
static os_timer_t testTimer;
LOCAL void ICACHE_FLASH_ATTR con(void *arg) {
os_printf("Entered con!\n");
@ -18,7 +26,7 @@ LOCAL void ICACHE_FLASH_ATTR pub(void *arg) {
os_printf("Entered pub!\n");
mqtt_session_t *pSession = (mqtt_session_t *)arg;
uint8_t data[] = "2.718281828459045";
uint32_t dataLen = os_strlen(data);
int32_t dataLen = os_strlen(data);
mqtt_send(pSession, &data[0], dataLen, MQTT_MSG_TYPE_PUBLISH);
os_timer_disarm(&oneTimer);
os_timer_setfn(&oneTimer, (os_timer_func_t *)ping, arg);
@ -49,7 +57,7 @@ LOCAL void ICACHE_FLASH_ATTR discon(void *arg) {
}
void ICACHE_FLASH_ATTR user_init() {
uint8_t wifiStatus;
//uint8_t wifiStatus;
LOCAL mqtt_session_t globalSession;
LOCAL mqtt_session_t *pGlobalSession = &globalSession;
char ssid[32] = "yourwifissid";
@ -94,4 +102,3 @@ void ICACHE_FLASH_ATTR user_init() {
os_timer_setfn(&testTimer, (os_timer_func_t *)con, pGlobalSession);
os_timer_arm(&testTimer, 16000, 0);
}
#endif