Skip to content

Commit

Permalink
Fix compilation errors
Browse files Browse the repository at this point in the history
  • Loading branch information
MaJerle committed Mar 24, 2022
1 parent 74cc51a commit 9971aac
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
4 changes: 2 additions & 2 deletions dev/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ main_thread(void* arg) {
//http_server_start();

/* Netconn client in separate thread */
//lwesp_sys_thread_create(NULL, "netconn_client", (lwesp_sys_thread_fn)netconn_client_thread, NULL, 0, LWESP_SYS_THREAD_PRIO);
lwesp_sys_thread_create(NULL, "netconn_client", (lwesp_sys_thread_fn)netconn_client_thread, NULL, 0, LWESP_SYS_THREAD_PRIO);

/* Netconn server with multiple threads */
//lwesp_sys_thread_create(NULL, "netconn_server", (lwesp_sys_thread_fn)netconn_server_thread, NULL, 0, LWESP_SYS_THREAD_PRIO);
Expand All @@ -423,7 +423,7 @@ main_thread(void* arg) {
//lwesp_sys_thread_create(NULL, "mqtt_client_api_cayenne", (lwesp_sys_thread_fn)mqtt_client_api_cayenne_thread, NULL, 0, LWESP_SYS_THREAD_PRIO);

/* LwESP built-in Cayenne protocol implementation thread demo */
lwesp_sys_thread_create(NULL, "cayenne", (lwesp_sys_thread_fn)cayenne_thread, NULL, 0, LWESP_SYS_THREAD_PRIO);
//lwesp_sys_thread_create(NULL, "cayenne", (lwesp_sys_thread_fn)cayenne_thread, NULL, 0, LWESP_SYS_THREAD_PRIO);

#if 0
/* Asynchronous push-only cayenne demo with buffer used to fill the data */
Expand Down
2 changes: 0 additions & 2 deletions lwesp/src/apps/cayenne/lwesp_cayenne.c
Original file line number Diff line number Diff line change
Expand Up @@ -313,8 +313,6 @@ lwesp_cayenne_build_topic(lwesp_cayenne_t* c, char* topic_str, size_t topic_str_
return lwespOK;
}

#include "debug.h"

/**
* \brief Try to send TX data to Cayenne cloud.
* Take the data from internal TX message buffer, build topic and go to cloud
Expand Down
8 changes: 4 additions & 4 deletions snippets/cayenne.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,17 @@ prv_cayenne_evt(lwesp_cayenne_t* c, lwesp_cayenne_evt_t* evt) {

/* Send device description */
tx_msg.topic = LWESP_CAYENNE_TOPIC_SYS_MODEL;
tx_msg.data_type = LWESP_CAYENNE_DATA_FORMAT_STRING;
tx_msg.data_format = LWESP_CAYENNE_DATA_FORMAT_STRING;
tx_msg.data.str = "My custom model";
lwesp_cayenne_publish_ex(&cayenne, &tx_msg);
tx_msg.topic = LWESP_CAYENNE_TOPIC_SYS_CPU_SPEED;
tx_msg.data_type = LWESP_CAYENNE_DATA_FORMAT_STRING;
tx_msg.data_format = LWESP_CAYENNE_DATA_FORMAT_STRING;
tx_msg.data.str = "550000000";
lwesp_cayenne_publish_ex(&cayenne, &tx_msg);

/* Sensors.. */
tx_msg.topic = LWESP_CAYENNE_TOPIC_DATA;
tx_msg.data_type = LWESP_CAYENNE_DATA_FORMAT_FLOAT;
tx_msg.data_format = LWESP_CAYENNE_DATA_FORMAT_FLOAT;
tx_msg.data_type_unit = LWESP_CAYENNE_DATA_TYPE_TEMPERATURE_UNIT_CELSIUS;
tx_msg.channel = 1;
tx_msg.data.flt = 20.7;
Expand Down Expand Up @@ -122,7 +122,7 @@ cayenne_thread(void const* arg) {
while (1) {
for (size_t i = 0; i < 3; ++i) {
tx_msg.channel = 100 + type_unit;
tx_msg.data_type = LWESP_CAYENNE_DATA_FORMAT_FLOAT;
tx_msg.data_format = LWESP_CAYENNE_DATA_FORMAT_FLOAT;
tx_msg.data_type_unit = type_unit;
tx_msg.data.flt = temp;
tx_msg.topic = LWESP_CAYENNE_TOPIC_DATA;
Expand Down
8 changes: 7 additions & 1 deletion snippets/netconn_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,12 @@ netconn_client_thread(void const* arg) {
lwespr_t res;
lwesp_pbuf_p pbuf;
lwesp_netconn_p client;
lwesp_sys_sem_t* sem = (void*)arg;
lwesp_sys_sem_t* sem = (void*)arg;

/* Make sure we are connected to access point first */
while (!lwesp_sta_has_ip()) {
lwesp_delay(1000);
}

/*
* First create a new instance of netconn
Expand All @@ -44,6 +49,7 @@ netconn_client_thread(void const* arg) {
*/
client = lwesp_netconn_new(LWESP_NETCONN_TYPE_TCP);
if (client != NULL) {

/*
* Connect to external server as client
* with custom NETCONN_CONN_HOST and CONN_PORT values
Expand Down

0 comments on commit 9971aac

Please sign in to comment.