thingsboard / thingsboard-client-sdk

Client SDK to connect with ThingsBoard IoT Platform from IoT devices (Arduino, Espressif, etc.)
MIT License
151 stars 120 forks source link

[Question] Server-Side RPC: Receiving Attributes doesn't work #107

Closed callmereno closed 1 year ago

callmereno commented 1 year ago

Description Hey guys,

i'm currently working on a server-side rpc application. I basically want to turn on an analog LED via TB. The later works fine (see picture), but when I also want to mirror the analog led on my dashboard, like in this tutorial. Therefore I created a server-side attribute called 'ledStatus' and linked an led indicator to its changes. To send the status i use this TB-function for example:

client.sendAttributeBool("ledStatus", ledStatus);

The problem is that TB doesn't seemt to receive the change of the ledStatus. Am I missing something? Do i maybe have to make a rule chain to process information coming from the device?

I hope my problem is kind of understandable. Suggestions are always appreciated :)

Greetings Reno

grafik

Here is the current code. I use the Arduino IDE for coding:

#include <ESP8266WiFi.h>
#include <PubSubClient.h>
#include <ThingsBoard.h>

// AP-DE
#define home "XXXXX"
#define homepw "XXXXXXXX"

// Auswahl des TB-Access Points:
#define TB_TOKEN "XXXXXX" 
#define TB_SERVER "demo.thingsboard.io"
//#define TB_PORT 1883

// Initialization:
WiFiClient wifiClient;           
ThingsBoard client(wifiClient);  

// Select AP:
const char* ssid = home;      
const char* password = homepw;

// Other Variables:
const int led = D2;
bool ledStatus = false;
bool previousState = false;

int status = WL_IDLE_STATUS;

void setup() {

  pinMode(LED_BUILTIN, OUTPUT);
  pinMode(led, OUTPUT);
  digitalWrite(led, LOW);
  Serial.begin(9600);               
  InitWiFi();                             
  client.connect(TB_SERVER, demo_TOKEN);  // Definition des MQTT-Server
}

///////////////////// RPC-SETTINGS /////////////////////

RPC_Response processSwitchChange(const RPC_Data& data) {
  Serial.println("Received 'processSwitchChange'-method: ");
  char params[10];
  serializeJson(data, params);
  String _params = params;

  if (_params == "true") {
    Serial.println("SWITCH: ON");
    ledStatus = true;
    return RPC_Response("processSwitchChange", "true");

  } else if (_params == "false") {
    Serial.println("SWITCH: OFF");
    ledStatus = false;
    return RPC_Response("processSwitchChange", "false");
  }
}

const size_t callbacks_size = 1;
RPC_Callback callbacks[callbacks_size] = {
  { "processSwitchChange", processSwitchChange }
};

bool subscribed = false;  //RPC-Subscribe Status

///////////////////////////////////////// //Serial.printf(previousState != ledStatus ? "true" : "false");

void loop() {

  // Maintain connection
  if (!client.connected()) {
    reconnect();
  }

  checkRPC_Subscription();

  // Sends 
  if (previousState != ledStatus) {
    Serial.println();
    Serial.println("[SWITCH STATE CHANGED]");

    if (ledStatus == true) {
      digitalWrite(led, HIGH);
      Serial.println("LED: ON");
      client.sendAttributeBool("ledStatus", true);
    } else {
      digitalWrite(led, LOW);
      Serial.println("LED: OFF");
      client.sendAttributeBool("ledStatus", false);
    }

    previousState = ledStatus;
  }

  client.loop();
}

/////////////////////////////// OTHER FUNCTIONS ////////////////////////////////////

void InitWiFi() {
  Serial.print("Connecting to Access Point...");
  WiFi.begin(ssid, password);  // Eingabe der Zugangsdaten

  while (WiFi.status() != WL_CONNECTED) {
    delay(500);  // "." bis Verbindung hergestellt ist
    Serial.print(".");
  }
  Serial.println();
  Serial.print("Connected! IP address: ");
  Serial.println(WiFi.localIP());
}

void reconnect() {
  while (!client.connected()) {

    status = WiFi.status();
    if (status != WL_CONNECTED) {
      InitWiFi();
    }

    // Reconnect
    Serial.print("Connecting to ThingsBoard Device ...");
    if (client.connect("ESP8266 Device", TB_TOKEN, NULL)) {
      Serial.println("[DONE]");
    } else {
      Serial.print("[FAILED] Retrying in 5 seconds]");
      delay(5000);
    }
  }
}

void checkRPC_Subscription() {
  if (!subscribed) {
    Serial.println("Subscribing for RPC...");

    if (!client.RPC_Subscribe(callbacks, callbacks_size)) {
      Serial.println("Failed to subscribe for RPC");
      return;
    }

    Serial.println("Subscribe done");
    subscribed = true;
  }
}

Environment

MathewHDYT commented 1 year ago

See #91 for a longer description on the issue you probably have.

The short version is that to receive RPC messages the PayloadSize you are allowed to receive, has to be increased. If that is not done the PubSubClient simply discards the received message.

Therefore replace ThingsBoard client(wifiClient); with ThingsBoardSized<256> client(wifiClient);

callmereno commented 1 year ago

First of all thanks for the quick response @MathewHDYT !

I tried this out, but it sadly didn't make a difference, since i still dont receive client attributes :( I will try to send the attributes as json using the sendAttributeJSON()-function and see if i get results.

Other question: Does it make sense to include the in the sendAttribute...l()-function in the RPC-Response method? Like this for example (<-- is the indicator for the added lines):

RPC_Response processSwitchChange(const RPC_Data& data) {
  Serial.println("Received 'processSwitchChange'-method: ");
  char params[10];
  serializeJson(data, params);
  String _params = params;

  if (_params == "true") {
    Serial.println("SWITCH: ON");
    ledStatus = true;
    client.sendAttributeBool("ledStatus", true); <--
    return RPC_Response("processSwitchChange", "true");

  } else if (_params == "false") {
    Serial.println("SWITCH: OFF");
    ledStatus = false;
    client.sendAttributeBool("ledStatus", false); <--
    return RPC_Response("processSwitchChange", "false");
  }
}

const size_t callbacks_size = 1;
RPC_Callback callbacks[callbacks_size] = {
  { "processSwitchChange", processSwitchChange }
};

bool subscribed = false;  //RPC-Subscribe Status
MathewHDYT commented 1 year ago

I think I might know a possible issue, in the comment above you mentioned server side attributes, those can not be read or written to be the client, for the shared attributes they are read only.

So what you are sending with the sendAttributeBool method is a client side attribute, you would need to set the widget to use that attribute instead of the server side one.

image

And sending the attribute directly in the RPC callback method should work, at least it worked on my device.

callmereno commented 1 year ago

That i know :) The tab is empthy though:

grafik

MathewHDYT commented 1 year ago

Good to know might It be possible to switch to the newest version 0.8.0 and try it again.

callmereno commented 1 year ago

This could help. Im using version 0.6 becasue i had issues with libraries in 0.7.1. I will keep you postd

callmereno commented 1 year ago

So this is the error i get when i use 0.7.1 :

In file included from c:\users\renaud kenfack\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.4-gcc10.3-1757bed\xtensa-lx106-elf\include\assert.h:10,
                 from c:\users\renaud kenfack\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.4-gcc10.3-1757bed\xtensa-lx106-elf\include\sys\reent.h:503,
                 from c:\users\renaud kenfack\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.4-gcc10.3-1757bed\xtensa-lx106-elf\include\stdlib.h:18,
                 from c:\users\renaud kenfack\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.4-gcc10.3-1757bed\xtensa-lx106-elf\include\c++\10.3.0\cstdlib:75,
                 from c:\users\renaud kenfack\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.4-gcc10.3-1757bed\xtensa-lx106-elf\include\c++\10.3.0\stdlib.h:36,
                 from C:\Users\Renaud Kenfack\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/Arduino.h:27,
                 from C:\Users\Renaud Kenfack\AppData\Local\Temp\arduino-sketch-638D704AB4402ABD609A76C7C8A71D5B\sketch\Code_Sensor+RPC.ino.cpp:1:
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:53:36: error: statement-expressions are not allowed outside functions nor in template-argument lists
   53 | constexpr char ATTRIBUTE_TOPIC[] = PSTR("v1/devices/me/attributes");
      |                                    ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:54:36: error: statement-expressions are not allowed outside functions nor in template-argument lists
   54 | constexpr char TELEMETRY_TOPIC[] = PSTR("v1/devices/me/telemetry");
      |                                    ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:57:40: error: statement-expressions are not allowed outside functions nor in template-argument lists
   57 | constexpr char RPC_SUBSCRIBE_TOPIC[] = PSTR("v1/devices/me/rpc/request/+");
      |                                        ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:58:30: error: statement-expressions are not allowed outside functions nor in template-argument lists
   58 | constexpr char RPC_TOPIC[] = PSTR("v1/devices/me/rpc");
      |                              ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:61:44: error: statement-expressions are not allowed outside functions nor in template-argument lists
   61 | constexpr char FIRMWARE_RESPONSE_TOPIC[] = PSTR("v2/fw/response");
      |                                            ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:64:44: error: statement-expressions are not allowed outside functions nor in template-argument lists
   64 | constexpr char ATTRIBUTE_REQUEST_TOPIC[] = PSTR("v1/devices/me/attributes/request/%u");
      |                                            ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:65:55: error: statement-expressions are not allowed outside functions nor in template-argument lists
   65 | constexpr char ATTRIBUTE_RESPONSE_SUBSCRIBE_TOPIC[] = PSTR("v1/devices/me/attributes/response/+");
      |                                                       ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:66:45: error: statement-expressions are not allowed outside functions nor in template-argument lists
   66 | constexpr char ATTRIBUTE_RESPONSE_TOPIC[] = PSTR("v1/devices/me/attributes/response");
      |                                             ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:69:40: error: statement-expressions are not allowed outside functions nor in template-argument lists
   69 | constexpr char PROV_RESPONSE_TOPIC[] = PSTR("/provision/response");
      |                                        ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:72:38: error: statement-expressions are not allowed outside functions nor in template-argument lists
   72 | constexpr char PROV_ACCESS_TOKEN[] = PSTR("provision");
      |                                      ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:73:38: error: statement-expressions are not allowed outside functions nor in template-argument lists
   73 | constexpr char DEFAULT_CLIENT_ID[] = PSTR("TbDev");
      |                                      ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:76:32: error: statement-expressions are not allowed outside functions nor in template-argument lists
   76 | constexpr char SHARED_KEYS[] = PSTR("sharedKeys");
      |                                ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:77:31: error: statement-expressions are not allowed outside functions nor in template-argument lists
   77 | constexpr char SHARED_KEY[] = PSTR("shared");
      |                               ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:80:35: error: statement-expressions are not allowed outside functions nor in template-argument lists
   80 | constexpr char RPC_METHOD_KEY[] = PSTR("method");
      |                                   ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:81:35: error: statement-expressions are not allowed outside functions nor in template-argument lists
   81 | constexpr char RPC_PARAMS_KEY[] = PSTR("params");
      |                                   ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:82:36: error: statement-expressions are not allowed outside functions nor in template-argument lists
   82 | constexpr char RPC_REQUEST_KEY[] = PSTR("request");
      |                                    ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:83:37: error: statement-expressions are not allowed outside functions nor in template-argument lists
   83 | constexpr char RPC_RESPONSE_KEY[] = PSTR("response");
      |                                     ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:86:40: error: statement-expressions are not allowed outside functions nor in template-argument lists
   86 | constexpr char INVALID_BUFFER_SIZE[] = PSTR("PayloadSize (%u) to small for the given payloads size (%u)");
      |                                        ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:87:37: error: statement-expressions are not allowed outside functions nor in template-argument lists
   87 | constexpr char MAX_RPC_EXCEEDED[] = PSTR("Too many rpc subscriptions, increase MaxFieldsAmt or unsubscribe");
      |                                     ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:88:51: error: statement-expressions are not allowed outside functions nor in template-argument lists
   88 | constexpr char MAX_SHARED_ATT_UPDATE_EXCEEDED[] = PSTR("Too many shared attribute update callback subscriptions, increase MaxFieldsAmt or unsubscribe");
      |                                                   ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:89:52: error: statement-expressions are not allowed outside functions nor in template-argument lists
   89 | constexpr char MAX_SHARED_ATT_REQUEST_EXCEEDED[] = PSTR("Too many shared attribute request callback subscriptions, increase MaxFieldsAmt");
      |                                                    ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:90:34: error: statement-expressions are not allowed outside functions nor in template-argument lists
   90 | constexpr char NUMBER_PRINTF[] = PSTR("%u");
      |                                  ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:91:24: error: statement-expressions are not allowed outside functions nor in template-argument lists
   91 | constexpr char COMMA = PSTR(',');
      |                        ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:92:39: error: statement-expressions are not allowed outside functions nor in template-argument lists
   92 | constexpr char NO_KEYS_TO_REQUEST[] = PSTR("No keys to request were given");
      |                                       ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:93:32: error: statement-expressions are not allowed outside functions nor in template-argument lists
   93 | constexpr char REQUEST_ATT[] = PSTR("Requesting shared attributes transformed from (%s) into json (%s)");
      |                                ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:94:40: error: statement-expressions are not allowed outside functions nor in template-argument lists
   94 | constexpr char UNABLE_TO_SERIALIZE[] = PSTR("Unable to serialize data");
      |                                        ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:95:47: error: statement-expressions are not allowed outside functions nor in template-argument lists
   95 | constexpr char UNABLE_TO_DE_SERIALIZE_RPC[] = PSTR("Unable to de-serialize RPC");
      |                                               ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:96:55: error: statement-expressions are not allowed outside functions nor in template-argument lists
   96 | constexpr char UNABLE_TO_DE_SERIALIZE_ATT_REQUEST[] = PSTR("Unable to de-serialize shared attribute request");
      |                                                       ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:97:54: error: statement-expressions are not allowed outside functions nor in template-argument lists
   97 | constexpr char UNABLE_TO_DE_SERIALIZE_ATT_UPDATE[] = PSTR("Unable to de-serialize shared attribute update");
      |                                                      ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:98:45: error: statement-expressions are not allowed outside functions nor in template-argument lists
   98 | constexpr char RECEIVED_RPC_LOG_MESSAGE[] = PSTR("Received RPC:");
      |                                             ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:99:36: error: statement-expressions are not allowed outside functions nor in template-argument lists
   99 | constexpr char RPC_METHOD_NULL[] = PSTR("RPC method is NULL");
      |                                    ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:100:32: error: statement-expressions are not allowed outside functions nor in template-argument lists
  100 | constexpr char RPC_CB_NULL[] = PSTR("RPC callback or subscribed rpc method name is NULL");
      |                                ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:101:41: error: statement-expressions are not allowed outside functions nor in template-argument lists
  101 | constexpr char NO_RPC_PARAMS_PASSED[] = PSTR("No parameters passed with RPC, passing null JSON");
      |                                         ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:102:32: error: statement-expressions are not allowed outside functions nor in template-argument lists
  102 | constexpr char CALLING_RPC[] = PSTR("Calling RPC:");
      |                                ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:103:40: error: statement-expressions are not allowed outside functions nor in template-argument lists
  103 | constexpr char RECEIVED_ATT_UPDATE[] = PSTR("Received shared attribute update");
      |                                        ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:104:41: error: statement-expressions are not allowed outside functions nor in template-argument lists
  104 | constexpr char NOT_FOUND_ATT_UPDATE[] = PSTR("Shared attribute update key not found");
      |                                         ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:105:30: error: statement-expressions are not allowed outside functions nor in template-argument lists
  105 | constexpr char ATT_CB_ID[] = PSTR("Shared attribute update callback id: (%u)");
      |                              ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:106:35: error: statement-expressions are not allowed outside functions nor in template-argument lists
  106 | constexpr char ATT_CB_IS_NULL[] = PSTR("Shared attribute update callback is NULL");
      |                                   ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:107:35: error: statement-expressions are not allowed outside functions nor in template-argument lists
  107 | constexpr char ATT_CB_NO_KEYS[] = PSTR("No keys subscribed. Calling subscribed callback for any updated attributes (assumed to be subscribed to every possible key)");
      |                                   ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:108:32: error: statement-expressions are not allowed outside functions nor in template-argument lists
  108 | constexpr char ATT_IS_NULL[] = PSTR("Subscribed shared attribute update key is NULL");
      |                                ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:109:33: error: statement-expressions are not allowed outside functions nor in template-argument lists
  109 | constexpr char ATT_IN_ARRAY[] = PSTR("Shared attribute update key: (%s) is subscribed");
      |                                 ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:110:34: error: statement-expressions are not allowed outside functions nor in template-argument lists
  110 | constexpr char ATT_NO_CHANGE[] = PSTR("No keys that we subscribed too were changed, skipping callback");
      |                                  ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:111:35: error: statement-expressions are not allowed outside functions nor in template-argument lists
  111 | constexpr char CALLING_ATT_CB[] = PSTR("Calling subscribed callback for updated shared attribute (%s)");
      |                                   ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:112:33: error: statement-expressions are not allowed outside functions nor in template-argument lists
  112 | constexpr char RECEIVED_ATT[] = PSTR("Received shared attribute request");
      |                                 ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:113:38: error: statement-expressions are not allowed outside functions nor in template-argument lists
  113 | constexpr char ATT_KEY_NOT_FOUND[] = PSTR("Shared attribute key not found");
      |                                      ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:114:43: error: statement-expressions are not allowed outside functions nor in template-argument lists
  114 | constexpr char ATT_REQUEST_CB_IS_NULL[] = PSTR("Shared attribute request callback is NULL");
      |                                           ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:115:43: error: statement-expressions are not allowed outside functions nor in template-argument lists
  115 | constexpr char CALLING_REQUEST_ATT_CB[] = PSTR("Calling subscribed callback for response id (%u)");
      |                                           ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:116:41: error: statement-expressions are not allowed outside functions nor in template-argument lists
  116 | constexpr char TOO_MANY_JSON_FIELDS[] = PSTR("Too many JSON fields passed (%u), increase MaxFieldsAmt (%u) accordingly");
      |                                         ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:117:34: error: statement-expressions are not allowed outside functions nor in template-argument lists
  117 | constexpr char CB_ON_MESSAGE[] = PSTR("Callback on_message from topic: (%s)");
      |                                  ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:118:35: error: statement-expressions are not allowed outside functions nor in template-argument lists
  118 | constexpr char CONNECT_FAILED[] = PSTR("Connecting to server failed");
      |                                   ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:122:32: error: statement-expressions are not allowed outside functions nor in template-argument lists
  122 | constexpr char CLAIM_TOPIC[] = PSTR("v1/devices/me/claim");
      |                                ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:125:39: error: statement-expressions are not allowed outside functions nor in template-argument lists
  125 | constexpr char PROV_REQUEST_TOPIC[] = PSTR("/provision/request");
      |                                       ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:128:31: error: statement-expressions are not allowed outside functions nor in template-argument lists
  128 | constexpr char SECRET_KEY[] = PSTR("secretKey");
      |                               ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:129:33: error: statement-expressions are not allowed outside functions nor in template-argument lists
  129 | constexpr char DURATION_KEY[] = PSTR("durationMs");
      |                                 ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:130:36: error: statement-expressions are not allowed outside functions nor in template-argument lists
  130 | constexpr char DEVICE_NAME_KEY[] = PSTR("deviceName");
      |                                    ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:131:36: error: statement-expressions are not allowed outside functions nor in template-argument lists
  131 | constexpr char PROV_DEVICE_KEY[] = PSTR("provisionDeviceKey");
      |                                    ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:132:43: error: statement-expressions are not allowed outside functions nor in template-argument lists
  132 | constexpr char PROV_DEVICE_SECRET_KEY[] = PSTR("provisionDeviceSecret");
      |                                           ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:135:36: error: statement-expressions are not allowed outside functions nor in template-argument lists
  135 | constexpr char PROV_STATUS_KEY[] = PSTR("status");
      |                                    ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:136:39: error: statement-expressions are not allowed outside functions nor in template-argument lists
  136 | constexpr char PROV_CRED_TYPE_KEY[] = PSTR("credentialsType");
      |                                       ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:137:35: error: statement-expressions are not allowed outside functions nor in template-argument lists
  137 | constexpr char STATUS_SUCCESS[] = PSTR("SUCCESS");
      |                                   ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:138:41: error: statement-expressions are not allowed outside functions nor in template-argument lists
  138 | constexpr char PROV_CRED_TYPE_VALUE[] = PSTR("X509_CERTIFICATE");
      |                                         ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:141:33: error: statement-expressions are not allowed outside functions nor in template-argument lists
  141 | constexpr char PROV_REQUEST[] = PSTR("Provision request:");
      |                                 ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:142:57: error: statement-expressions are not allowed outside functions nor in template-argument lists
  142 | constexpr char UNABLE_TO_DE_SERIALIZE_PROV_RESPONSE[] = PSTR("Unable to de-serialize provision response");
      |                                                         ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:143:34: error: statement-expressions are not allowed outside functions nor in template-argument lists
  143 | constexpr char PROV_RESPONSE[] = PSTR("Process provisioning response");
      |                                  ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:144:43: error: statement-expressions are not allowed outside functions nor in template-argument lists
  144 | constexpr char RECEIVED_PROV_RESPONSE[] = PSTR("Received provision response");
      |                                           ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:145:39: error: statement-expressions are not allowed outside functions nor in template-argument lists
  145 | constexpr char X509_NOT_SUPPORTED[] = PSTR("Provision response contains X509_CERTIFICATE credentials, this is not supported yet");
      |                                       ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:149:54: error: statement-expressions are not allowed outside functions nor in template-argument lists
  149 | constexpr char FIRMWARE_RESPONSE_SUBSCRIBE_TOPIC[] = PSTR("v2/fw/response/#");
      |                                                      ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:150:43: error: statement-expressions are not allowed outside functions nor in template-argument lists
  150 | constexpr char FIRMWARE_REQUEST_TOPIC[] = PSTR("v2/fw/request/0/chunk/%u");
      |                                           ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:153:38: error: statement-expressions are not allowed outside functions nor in template-argument lists
  153 | constexpr char CURR_FW_TITLE_KEY[] = PSTR("current_fw_title");
      |                                      ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:154:36: error: statement-expressions are not allowed outside functions nor in template-argument lists
  154 | constexpr char CURR_FW_VER_KEY[] = PSTR("current_fw_version");
      |                                    ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:155:38: error: statement-expressions are not allowed outside functions nor in template-argument lists
  155 | constexpr char CURR_FW_STATE_KEY[] = PSTR("current_fw_state");
      |                                      ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:156:31: error: statement-expressions are not allowed outside functions nor in template-argument lists
  156 | constexpr char FW_VER_KEY[] = PSTR("fw_version");
      |                               ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:157:33: error: statement-expressions are not allowed outside functions nor in template-argument lists
  157 | constexpr char FW_TITLE_KEY[] = PSTR("fw_title");
      |                                 ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:158:32: error: statement-expressions are not allowed outside functions nor in template-argument lists
  158 | constexpr char FW_CHKS_KEY[] = PSTR("fw_checksum");
      |                                ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:159:37: error: statement-expressions are not allowed outside functions nor in template-argument lists
  159 | constexpr char FW_CHKS_ALGO_KEY[] = PSTR("fw_checksum_algorithm");
      |                                     ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:160:32: error: statement-expressions are not allowed outside functions nor in template-argument lists
  160 | constexpr char FW_SIZE_KEY[] = PSTR("fw_size");
      |                                ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:161:38: error: statement-expressions are not allowed outside functions nor in template-argument lists
  161 | constexpr char FW_CHECKSUM_VALUE[] = PSTR("MD5");
      |                                      ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:162:38: error: statement-expressions are not allowed outside functions nor in template-argument lists
  162 | constexpr char FW_STATE_CHECKING[] = PSTR("CHECKING FIRMWARE");
      |                                      ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:163:35: error: statement-expressions are not allowed outside functions nor in template-argument lists
  163 | constexpr char FW_STATE_NO_FW[] = PSTR("NO FIRMWARE FOUND");
      |                                   ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:164:40: error: statement-expressions are not allowed outside functions nor in template-argument lists
  164 | constexpr char FW_STATE_UP_TO_DATE[] = PSTR("UP TO DATE");
      |                                        ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:165:42: error: statement-expressions are not allowed outside functions nor in template-argument lists
  165 | constexpr char FW_STATE_INVALID_CHKS[] = PSTR("CHKS IS NOT MD5");
      |                                          ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:166:41: error: statement-expressions are not allowed outside functions nor in template-argument lists
  166 | constexpr char FW_STATE_DOWNLOADING[] = PSTR("DOWNLOADING");
      |                                         ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:167:36: error: statement-expressions are not allowed outside functions nor in template-argument lists
  167 | constexpr char FW_STATE_FAILED[] = PSTR("FAILED");
      |                                    ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:168:42: error: statement-expressions are not allowed outside functions nor in template-argument lists
  168 | constexpr char FW_STATE_UPDATE_ERROR[] = PSTR("UPDATE ERROR");
      |                                          ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:169:40: error: statement-expressions are not allowed outside functions nor in template-argument lists
  169 | constexpr char FW_STATE_CHKS_ERROR[] = PSTR("CHECKSUM ERROR");
      |                                        ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:172:26: error: statement-expressions are not allowed outside functions nor in template-argument lists
  172 | constexpr char NO_FW[] = PSTR("No new firmware assigned on the given device");
      |                          ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:173:29: error: statement-expressions are not allowed outside functions nor in template-argument lists
  173 | constexpr char EMPTY_FW[] = PSTR("Given firmware was NULL");
      |                             ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:174:34: error: statement-expressions are not allowed outside functions nor in template-argument lists
  174 | constexpr char FW_UP_TO_DATE[] = PSTR("Firmware is already up to date");
      |                                  ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:175:34: error: statement-expressions are not allowed outside functions nor in template-argument lists
  175 | constexpr char FW_NOT_FOR_US[] = PSTR("Firmware is not for us (title is different)");
      |                                  ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:176:47: error: statement-expressions are not allowed outside functions nor in template-argument lists
  176 | constexpr char FW_CHKS_ALGO_NOT_SUPPORTED[] = PSTR("Checksum algorithm is not supported, please use MD5 only");
      |                                               ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:177:31: error: statement-expressions are not allowed outside functions nor in template-argument lists
  177 | constexpr char PAGE_BREAK[] = PSTR("=================================");
      |                               ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:178:27: error: statement-expressions are not allowed outside functions nor in template-argument lists
  178 | constexpr char NEW_FW[] = PSTR("A new Firmware is available:");
      |                           ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:179:29: error: statement-expressions are not allowed outside functions nor in template-argument lists
  179 | constexpr char FROM_TOO[] = PSTR("(%s) => (%s)");
      |                             ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:180:35: error: statement-expressions are not allowed outside functions nor in template-argument lists
  180 | constexpr char DOWNLOADING_FW[] = PSTR("Attempting to download over MQTT...");
      |                                   ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:181:35: error: statement-expressions are not allowed outside functions nor in template-argument lists
  181 | constexpr char NOT_ENOUGH_RAM[] = PSTR("Not enough RAM");
      |                                   ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:182:24: error: statement-expressions are not allowed outside functions nor in template-argument lists
  182 | constexpr char SLASH = PSTR('/');
      |                        ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:183:36: error: statement-expressions are not allowed outside functions nor in template-argument lists
  183 | constexpr char UNABLE_TO_WRITE[] = PSTR("Unable to write firmware");
      |                                    ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:184:39: error: statement-expressions are not allowed outside functions nor in template-argument lists
  184 | constexpr char UNABLE_TO_DOWNLOAD[] = PSTR("Unable to download firmware");
      |                                       ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:185:29: error: statement-expressions are not allowed outside functions nor in template-argument lists
  185 | constexpr char FW_CHUNK[] = PSTR("Receive chunk (%i), with size (%u) bytes");
      |                             ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:186:39: error: statement-expressions are not allowed outside functions nor in template-argument lists
  186 | constexpr char ERROR_UPDATE_BEGIN[] = PSTR("Error during Update.begin");
      |                                       ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:187:31: error: statement-expressions are not allowed outside functions nor in template-argument lists
  187 | constexpr char MD5_ACTUAL[] = PSTR("MD5 actual checksum: (%s)");
      |                               ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:188:33: error: statement-expressions are not allowed outside functions nor in template-argument lists
  188 | constexpr char MD5_EXPECTED[] = PSTR("MD5 expected checksum: (%s)");
      |                                 ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:189:36: error: statement-expressions are not allowed outside functions nor in template-argument lists
  189 | constexpr char CHKS_VER_FAILED[] = PSTR("Checksum verification failed");
      |                                    ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:190:37: error: statement-expressions are not allowed outside functions nor in template-argument lists
  190 | constexpr char CHKS_VER_SUCCESS[] = PSTR("Checksum is the same as expected");
      |                                     ^~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:191:38: error: statement-expressions are not allowed outside functions nor in template-argument lists
  191 | constexpr char FW_UPDATE_SUCCESS[] = PSTR("Update success");
      |                                      ^~~~
In file included from C:\Users\Renaud Kenfack\Documents\Arduino\Code_Sensor+RPC\Code_Sensor+RPC.ino:3:
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h: In member function 'void ThingsBoardSized<PayloadSize, MaxFieldsAmt, Logger>::process_provisioning_response(char*, uint8_t*, uint32_t)':
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:1377:82: error: call of overloaded 'strncmp_P(const char [1], ArduinoJson6193_F1::enable_if<true, ArduinoJson6193_F1::MemberProxy<ArduinoJson6193_F1::ObjectRef, const char*> >::type, size_t)' is ambiguous
 1377 |       if (strncmp_P(STATUS_SUCCESS, data[PROV_STATUS_KEY], strlen(STATUS_SUCCESS)) == 0 && strncmp_P(PROV_CRED_TYPE_VALUE, data[PROV_CRED_TYPE_KEY], strlen(PROV_CRED_TYPE_VALUE)) == 0) {
      |                                                                                  ^
In file included from c:\users\renaud kenfack\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.4-gcc10.3-1757bed\xtensa-lx106-elf\include\string.h:175,
                 from C:\Users\Renaud Kenfack\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/Arduino.h:33,
                 from C:\Users\Renaud Kenfack\AppData\Local\Temp\arduino-sketch-638D704AB4402ABD609A76C7C8A71D5B\sketch\Code_Sensor+RPC.ino.cpp:1:
c:\users\renaud kenfack\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.4-gcc10.3-1757bed\xtensa-lx106-elf\include\sys\string.h:38:6: note: candidate: 'int strncmp_P(const char*, const char*, size_t)'
   38 | int  strncmp_P(const char *, const char *, size_t);
      |      ^~~~~~~~~
In file included from c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Strings/Adapters/FlashString.hpp:9,
                 from c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Strings/StringAdapters.hpp:24,
                 from c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Memory/MemoryPool.hpp:10,
                 from c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Variant/VariantData.hpp:7,
                 from c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Variant/SlotFunctions.hpp:8,
                 from c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Array/ArrayIterator.hpp:7,
                 from c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Array/ArrayRef.hpp:8,
                 from c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson.hpp:24,
                 from c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson.h:9,
                 from c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:16,
                 from C:\Users\Renaud Kenfack\Documents\Arduino\Code_Sensor+RPC\Code_Sensor+RPC.ino:3:
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Polyfills/pgmspace.hpp:32:12: note: candidate: 'int strncmp_P(const char*, ArduinoJson6193_F1::pgm_p, size_t)'
   32 | inline int strncmp_P(const char* a, ARDUINOJSON_NAMESPACE::pgm_p b, size_t n) {
      |            ^~~~~~~~~
In file included from C:\Users\Renaud Kenfack\Documents\Arduino\Code_Sensor+RPC\Code_Sensor+RPC.ino:3:
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:1377:178: error: call of overloaded 'strncmp_P(const char [1], ArduinoJson6193_F1::enable_if<true, ArduinoJson6193_F1::MemberProxy<ArduinoJson6193_F1::ObjectRef, const char*> >::type, size_t)' is ambiguous
 1377 |       if (strncmp_P(STATUS_SUCCESS, data[PROV_STATUS_KEY], strlen(STATUS_SUCCESS)) == 0 && strncmp_P(PROV_CRED_TYPE_VALUE, data[PROV_CRED_TYPE_KEY], strlen(PROV_CRED_TYPE_VALUE)) == 0) {
      |                                                                                                                                                                                  ^
In file included from c:\users\renaud kenfack\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.4-gcc10.3-1757bed\xtensa-lx106-elf\include\string.h:175,
                 from C:\Users\Renaud Kenfack\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/Arduino.h:33,
                 from C:\Users\Renaud Kenfack\AppData\Local\Temp\arduino-sketch-638D704AB4402ABD609A76C7C8A71D5B\sketch\Code_Sensor+RPC.ino.cpp:1:
c:\users\renaud kenfack\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.4-gcc10.3-1757bed\xtensa-lx106-elf\include\sys\string.h:38:6: note: candidate: 'int strncmp_P(const char*, const char*, size_t)'
   38 | int  strncmp_P(const char *, const char *, size_t);
      |      ^~~~~~~~~
In file included from c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Strings/Adapters/FlashString.hpp:9,
                 from c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Strings/StringAdapters.hpp:24,
                 from c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Memory/MemoryPool.hpp:10,
                 from c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Variant/VariantData.hpp:7,
                 from c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Variant/SlotFunctions.hpp:8,
                 from c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Array/ArrayIterator.hpp:7,
                 from c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Array/ArrayRef.hpp:8,
                 from c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson.hpp:24,
                 from c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson.h:9,
                 from c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:16,
                 from C:\Users\Renaud Kenfack\Documents\Arduino\Code_Sensor+RPC\Code_Sensor+RPC.ino:3:
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Polyfills/pgmspace.hpp:32:12: note: candidate: 'int strncmp_P(const char*, ArduinoJson6193_F1::pgm_p, size_t)'
   32 | inline int strncmp_P(const char* a, ARDUINOJSON_NAMESPACE::pgm_p b, size_t n) {
      |            ^~~~~~~~~
C:\Users\Renaud Kenfack\Documents\Arduino\Code_Sensor+RPC\Code_Sensor+RPC.ino: In function 'void connectRPC()':
C:\Users\Renaud Kenfack\Documents\Arduino\Code_Sensor+RPC\Code_Sensor+RPC.ino:256:56: error: no matching function for call to 'ThingsBoardSized<256>::RPC_Subscribe(RPC_Callback [1], const size_t&)'
  256 |     if (!client.RPC_Subscribe(callbacks, callbacks_size)) {
      |                                                        ^
In file included from C:\Users\Renaud Kenfack\Documents\Arduino\Code_Sensor+RPC\Code_Sensor+RPC.ino:3:
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:673:23: note: candidate: 'template<class InputIterator> const bool ThingsBoardSized<PayloadSize, MaxFieldsAmt, Logger>::RPC_Subscribe(const InputIterator&, const InputIterator&) [with InputIterator = InputIterator; unsigned int PayloadSize = 256; unsigned int MaxFieldsAmt = 8; Logger = ThingsBoardDefaultLogger]'
  673 |     inline const bool RPC_Subscribe(const InputIterator& first_itr, const InputIterator& last_itr) {
      |                       ^~~~~~~~~~~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:673:23: note:   template argument deduction/substitution failed:
C:\Users\Renaud Kenfack\Documents\Arduino\Code_Sensor+RPC\Code_Sensor+RPC.ino:256:56: note:   deduced conflicting types for parameter 'const InputIterator' ('RPC_Callback [1]' and 'size_t' {aka 'unsigned int'})
  256 |     if (!client.RPC_Subscribe(callbacks, callbacks_size)) {
      |                                                        ^
In file included from C:\Users\Renaud Kenfack\Documents\Arduino\Code_Sensor+RPC\Code_Sensor+RPC.ino:3:
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:689:23: note: candidate: 'const bool ThingsBoardSized<PayloadSize, MaxFieldsAmt, Logger>::RPC_Subscribe(const RPC_Callback&) [with unsigned int PayloadSize = 256; unsigned int MaxFieldsAmt = 8; Logger = ThingsBoardDefaultLogger]'
  689 |     inline const bool RPC_Subscribe(const RPC_Callback& callback) {
      |                       ^~~~~~~~~~~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:689:23: note:   candidate expects 1 argument, 2 provided

exit status 1

Compilation error: no matching function for call to 'ThingsBoardSized<256>::RPC_Subscribe(RPC_Callback [1], const size_t&)'

And this is the error i get using 0.8 :

In file included from c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:12,
                 from C:\Users\Renaud Kenfack\Documents\Arduino\Code_RPC\Code_RPC.ino:4:
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/HashGenerator.h:11:10: fatal error: mbedtls/md.h: No such file or directory
   11 | #include <mbedtls/md.h>
      |          ^~~~~~~~~~~~~~
compilation terminated.

exit status 1

Compilation error: exit status 1
MathewHDYT commented 1 year ago

I knew 0.7.1 had thoose issues that's why I attempted to fix them, it's interesting tough that it has problems finding the mbedtls/md.h library inv ersion 0.8.0

Might I know what device you are using is it an Arduino Uno perhaps so neither an ESP32 or ESP8266?

callmereno commented 1 year ago

Im using a NodeMCU with a ESP8266(MOD)-Chip

MathewHDYT commented 1 year ago

Could you try to include this library https://github.com/Seeed-Studio/Seeed_Arduino_mbedtls. It should make it possible to use the functionality of mbedtls/md.h on the ESP8266, that is natively supported on ESP32. Sorry for the inconvenience.

callmereno commented 1 year ago

I doesnt find the header file, when i include this line: #include <md.h> I downloaded the asset and added it in the same libraries folder in which the Thingsboard library:

Do i have to specify the path of the header`?

MathewHDYT commented 1 year ago

I think it should be fine to simply just download the library the same way PubSubClient has been downloaded and the include should stay #include <mbedtls/md.h> as far as I know.

callmereno commented 1 year ago

grafik

grafik

Same error for some reason..

MathewHDYT commented 1 year ago

What happens if you don't include the library in your main file and then recompile?

callmereno commented 1 year ago

You mean like this #include <library> ?

MathewHDYT commented 1 year ago

Yeah just remove that line and recompile.

callmereno commented 1 year ago

Ah i misread your sentence. This is what happens when i delete the include:

grafik

MathewHDYT commented 1 year ago

Sorry for asking but did you add the library the same way you add the PubSubClient and ArduinoJson library.

callmereno commented 1 year ago

grafik

All good :) Yes i did

MathewHDYT commented 1 year ago

What happens if you download the library over Sketch > Include Library > Manage Libraries and then search for Seeed_Arduino_mbedtls

callmereno commented 1 year ago

grafik

The newest version isnt available in the Arduino IDE. Same goes for ThingsBoard:

grafik

MathewHDYT commented 1 year ago

Can you replace the include statement with this one instead. In the HashGenerator.h file #include <Seeed_mbedtls.h>.

That's the include they had in their example file.

callmereno commented 1 year ago

grafik

grafik

It sadly didnt change the outcome.

MathewHDYT commented 1 year ago

Can you remove the old include #include <mbedtls/md.h> because it seems that's the one that is causing problems.

callmereno commented 1 year ago

Finally a new error haha:

C:\Users\Renaud Kenfack\Documents\Arduino\Code_Sensor+RPC\Code_Sensor+RPC.ino: In function 'void connectRPC()':
C:\Users\Renaud Kenfack\Documents\Arduino\Code_Sensor+RPC\Code_Sensor+RPC.ino:254:56: error: no matching function for call to 'ThingsBoardSized<256>::RPC_Subscribe(RPC_Callback [1], const size_t&)'
  254 |     if (!client.RPC_Subscribe(callbacks, callbacks_size)) {
      |                                                        ^
In file included from C:\Users\Renaud Kenfack\Documents\Arduino\Code_Sensor+RPC\Code_Sensor+RPC.ino:3:
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:637:23: note: candidate: 'template<class InputIterator> const bool ThingsBoardSized<PayloadSize, MaxFieldsAmt, Logger>::RPC_Subscribe(const InputIterator&, const InputIterator&) [with InputIterator = InputIterator; unsigned int PayloadSize = 256; unsigned int MaxFieldsAmt = 8; Logger = ThingsBoardDefaultLogger]'
  637 |     inline const bool RPC_Subscribe(const InputIterator& first_itr, const InputIterator& last_itr) {
      |                       ^~~~~~~~~~~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:637:23: note:   template argument deduction/substitution failed:
C:\Users\Renaud Kenfack\Documents\Arduino\Code_Sensor+RPC\Code_Sensor+RPC.ino:254:56: note:   deduced conflicting types for parameter 'const InputIterator' ('RPC_Callback [1]' and 'size_t' {aka 'unsigned int'})
  254 |     if (!client.RPC_Subscribe(callbacks, callbacks_size)) {
      |                                                        ^
In file included from C:\Users\Renaud Kenfack\Documents\Arduino\Code_Sensor+RPC\Code_Sensor+RPC.ino:3:
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:653:23: note: candidate: 'const bool ThingsBoardSized<PayloadSize, MaxFieldsAmt, Logger>::RPC_Subscribe(const RPC_Callback&) [with unsigned int PayloadSize = 256; unsigned int MaxFieldsAmt = 8; Logger = ThingsBoardDefaultLogger]'
  653 |     inline const bool RPC_Subscribe(const RPC_Callback& callback) {
      |                       ^~~~~~~~~~~~~
c:\Users\Renaud Kenfack\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:653:23: note:   candidate expects 1 argument, 2 provided

exit status 1

Compilation error: no matching function for call to 'ThingsBoardSized<256>::RPC_Subscribe(RPC_Callback [1], const size_t&)'

Here the connectRPC() function

void connectRPC() {
  if (!subscribed) {
    Serial.println("Subscribing for RPC...");

    if (!client.RPC_Subscribe(callbacks, callbacks_size)) {
      Serial.println("Failed to subscribe for RPC");
      return;
    }

    Serial.println("Subscribe done");
    subscribed = true;
  }
}
MathewHDYT commented 1 year ago

Okay perfect those errors are just because the API changed a bit. Just have a look in the examples folder in the ThingsBoard Library more exactly the RPC example and adjust it to be similar to that one.

callmereno commented 1 year ago

Okay i changed the code to this:

void connectRPC() {
  if (!subscribed) {
    Serial.println("Subscribing for RPC...");

    if (!client.RPC_Subscribe(callbacks.cbegin(), callbacks.cend())) {
      Serial.println("Failed to subscribe for RPC");
      return;
    }

    Serial.println("Subscribe done");
    subscribed = true;
  }
}

This is the error i get now:

C:\Users\Renaud Kenfack\Documents\Arduino\Code_Sensor+RPC\Code_Sensor+RPC.ino: In function 'void connectRPC()':
C:\Users\Renaud Kenfack\Documents\Arduino\Code_Sensor+RPC\Code_Sensor+RPC.ino:254:41: error: request for member 'cbegin' in 'callbacks', which is of non-class type 'RPC_Callback [1]'
  254 |     if (!client.RPC_Subscribe(callbacks, callbacks_size)) {
      |                                         ^~~~~~
C:\Users\Renaud Kenfack\Documents\Arduino\Code_Sensor+RPC\Code_Sensor+RPC.ino:254:61: error: request for member 'cend' in 'callbacks', which is of non-class type 'RPC_Callback [1]'
  254 |     if (!client.RPC_Subscribe(callbacks, callbacks_size)) {
      |                                                             ^   

exit status 1

Compilation error: request for member 'cbegin' in 'callbacks', which is of non-class type 'RPC_Callback [1]'
MathewHDYT commented 1 year ago

Could you also send the code for the callback array itself, because that seems to be the error. I'm assuming it is still a normal c-style array RPC_Callback[], could you make it an std::array or std::vector instead.

callmereno commented 1 year ago

Do you mean in my code or the ThingsBoard.h ? In case you mean the later:

grafik

Should i change it to array?

MathewHDYT commented 1 year ago

No I meant your code sorry for the misunderstanding.

callmereno commented 1 year ago

I mean i never defined an RPC_Callback[]-array if I recall properly. Do you mean this the section where i define the RPC methods?:

RPC_Response processSwitchChange(const RPC_Data& data) {
  Serial.println("Received 'processSwitchChange'-method: ");
  char params[10];
  serializeJson(data, params);
  String _params = params;

  if (_params == "true") {
    Serial.println("SWITCH: ON");
    ledStatus = true;
    return RPC_Response("processSwitchChange", "true");

  } else if (_params == "false") {
    Serial.println("SWITCH: OFF");
    ledStatus = false;    
    //client.sendAttributeBool("ledStatus", false);
    return RPC_Response("processSwitchChange", "false");
  }
}

const size_t callbacks_size = 1;
RPC_Callback callbacks[callbacks_size] = {
  { "processSwitchChange", processSwitchChange }
};

bool subscribed = false;  //RPC-Subscribe Status
MathewHDYT commented 1 year ago

Yeah exactly that's the portion I meant

const size_t callbacks_size = 1;
RPC_Callback callbacks[callbacks_size] = {
  { "processSwitchChange", processSwitchChange }
};

Could you replace it with this

const std::array<RPC_Callback, 2U> callbacks = {
  RPC_Callback{ "example_set_temperature",    processTemperatureChange },
  RPC_Callback{ "example_set_switch",         processSwitchChange }
};
callmereno commented 1 year ago

It compiled!

MathewHDYT commented 1 year ago

Would be nice to know if sending in the RPC callback works now as well like expected.

callmereno commented 1 year ago

Yes, it does:

[TB] Callback on_message from topic: v1/devices/me/rpc/request/30
[TB] received RPC:
[TB] processSwitchChange
[TB] calling RPC:
[TB] processSwitchChange
[TB] params:
[TB] false
Received 'processSwitchChange'-method: 
SWITCH: OFF
[TB] response:
[TB] {"processSwitchChange":"false"}
MathewHDYT commented 1 year ago

Perfect I'll see that the issue we found get's merged into the base library sometime soon, but besides that it seems to work nice :D.

callmereno commented 1 year ago

Great work man!

I still have the issue that the attributes dont arrive :/

MathewHDYT commented 1 year ago

Oh I assumed you mean it works completely XD. Do you get some kind of error message when trying to send the attribute / does the method return true or false?

callmereno commented 1 year ago

No, sorry haha

The thing is dont get any errors.

MathewHDYT commented 1 year ago

Could you add that instead of only the client.sendAttributeBool("ledStatus", false) call.

if (!client.sendAttributeBool("ledStatus", false)) {
    Serial.println("Sending attribute failed :(");
}
callmereno commented 1 year ago

Yes, will try that out:

grafik

callmereno commented 1 year ago

Here is the current code:

#include <Pinout.h>             // Pinbelegung des NodeMCUs
#include <ESP8266WiFi.h>        // "File" > "Preferences..." > "Additional board manager URls:" > http://arduino.esp8266.com/stable/package_esp8266com_index.json
#include <ThingsBoard.h>        // Version v0.6

#include <INA219_WE.h>          
#include <Wire.h>

// Intenet-Zugangsdaten:
#define WIFI_AP "XXXX"
#define WIFI_PASSWORD "XXXX"

// ThingsBoard (TB) Zugangsdaten:
#define TB_TOKEN "XXXX" // Für TB-Gerät/Device "Sensor"
#define TB_SERVER "demo.thingsboard.io" // Alternativ IPv4 des Servers über den die TB gehostet wird (Bsp.: Docker)
//#define TB_PORT 1883

#define I2C_ADDRESS 0x40  // I2C-Adresse für den INA219-Sensor

// Initialisierung
WiFiClient wifiClient;                      // Erstellung einer ESP8266WiFi-Instanz des Typs
ThingsBoardSized<256> client(wifiClient);             // Instanz wird zu einem TB-Client (?) 
INA219_WE ina219 = INA219_WE(I2C_ADDRESS);  // Erstellung einer INA219-Instanz

// Weitere Parameter:
int status = WL_IDLE_STATUS;
unsigned long lastSend;  // Updatetimer
const int led = D5;
bool ledStatus = false;
bool previousState = false;

void setup() {

  pinMode(LED_BUILTIN, OUTPUT);           // Anzeige des Betriebszustand (Auf NodeMCU integrierte LED wird a)
  Serial.begin(9600);                     // Initiierung des seriellen Monitors (SM) für das Debuggen (Übertragungsgeschwindigkeit/Baudrate)
  InitWiFi();                             // Aufbau der Internetverbindung
  client.connect(TB_SERVER, TB_TOKEN);    // Definition des MQTT-Server
  lastSend = 0;                           // Initialisierung des Updatetimers
}

void loop() {

  // Wiederherstellung der Verbindung zu TB (+ Prüfung der Internetverbindung Interver)
  if (!client.connected()) {
    reconnect();
  }

  // Aufbau und Aufrechterhaltung der RPC-Kommunikation mit TB
  connectRPC();

  //INA219-Einstellungen:
  Wire.begin();
  if (!ina219.init()) {
    Serial.println("INA219  not connected!");
  }

  ina219.setADCMode(SAMPLE_MODE_4);  // choose mode and uncomment for change of default
  ina219.setPGain(PG_80);  // choose gain and uncomment for change of default
  ina219.setBusRange(BRNG_16);  // choose range (16V oder 32V) and uncomment for change of default
  ina219.setShuntVoltOffset_mV(-0.03);  // insert the shunt voltage (millivolts) you detect at zero current

  // Messdatenerfassung und -übermittlung
  if (millis() - lastSend > 2000) {  // Uploadintervall (Hier: 2s)
    getAndSendTelemetry();
    getAndSendAttributes();
    lastSend = millis();
  }

  client.loop();
}

///////////////////// RPC-Kommunikation /////////////////////

RPC_Response processSwitchChange(const RPC_Data& data) {
  Serial.println("Received 'processSwitchChange'-method: ");
  char params[10];
  serializeJson(data, params);
  String _params = params;

  if (_params == "true") {
    Serial.println("SWITCH: ON");
    ledStatus = true;
    return RPC_Response("processSwitchChange", "true");

  } else if (_params == "false") {
    Serial.println("SWITCH: OFF");
    ledStatus = false;    
    //client.sendAttributeBool("ledStatus", false);
    return RPC_Response("processSwitchChange", "false");
  }
}

const std::array<RPC_Callback, 1U> callbacks = {
  RPC_Callback{ "processSwitchChange",    processSwitchChange }
};
bool subscribed = false;  //RPC-Subscribe Status

//////////////////// Weitere Funktionen /////////////////////

// Funktion - Übertragung der Telemetrie
void getAndSendTelemetry() {
  Serial.println("Collecting sensor data.");

  float SV = ina219.getShuntVoltage_mV();  // Shunt Voltage [mV]
  float BV = ina219.getBusVoltage_V();     // Bus Voltage [V]
  float C = ina219.getCurrent_mA();        // Current [mA]
  float BP = ina219.getBusPower();         // Bus Power [mW]
  float LV = BV + (SV / 1000);
  bool ina219_overflow = ina219.getOverflow();

  // Prüfung der Messdaten (Abbruch bei NaN-Werten)
  if (isnan(SV) || isnan(BV) || isnan(C) || isnan(BP) || isnan(LV)) {
    Serial.println("Failed to read from INA219-Sensor!");
    return;
  }

  // Prüfung auf Daten-Overflow
  if (!ina219_overflow) {
    Serial.println("Values OK - no overflow");
  } else {
    Serial.println("Overflow! Choose higher PGAIN");
  }
  Serial.println();

  // Ausgabe im Seriellen Monitor [DEBUG]
  Serial.print("Load Voltage [V]: ");
  Serial.println(LV);
  Serial.print("Current [mA]: ");
  Serial.println(C);
  Serial.print("Bus Power [mW]: ");
  Serial.println(BP);
  Serial.println();

  // Konvertierung der Messdaten in Strings
  String LoadVoltage = String(LV);
  String Current = String(C);
  String BusPower = String(BP);

  // Vorbereitung des Telemetrie-JSONs
  String tel = "{";

  tel += "\"Spannung\": ";
  tel += LoadVoltage;
  tel += ",";

  tel += "\"Stromstaerke\": ";
  tel += Current;
  tel += ",";

  tel += "\"Leistung\": ";
  tel += BusPower;
  tel += "}";

  // Ausgabe des Telemetriedaten [DEBUG]
  char telemetry[500];
  tel.toCharArray(telemetry, 500);
  Serial.print("Sending telemetry as JSON: ");
  Serial.println(telemetry);  

  const char* telemetry_json = tel.c_str(); // Konvertiert die den 'payload'-String zu JSON-Objekt(?)
  client.sendTelemetryJson(telemetry_json);

}

void getAndSendAttributes() {

/*   //  Vorbereitung des JSON für Client-Attribute
  String att = "{";

  att += "\"ledStatus\": ";
  att += ledStatus;
  att += "}";

  // Ausgabe des Attribute im SM [DEBUG]
  char attributes[100];
  att.toCharArray(attributes, 100);
  Serial.print("Sending attributes as JSON: ");
  Serial.println(attributes); */

  // LED-Status:
  if (previousState != ledStatus) {

    Serial.println();
    Serial.println("[SWITCH STATE CHANGED]");

    if (ledStatus == true) {
      digitalWrite(led, HIGH);
      Serial.println("LED: ON");

      if (!client.sendAttributeBool("ledStatus", true)) {
      Serial.println("Sending attribute failed :(");
      }

    } else {
      digitalWrite(led, LOW);
      Serial.println("LED: OFF");

      if (!client.sendAttributeBool("ledStatus", false)) {
      Serial.println("Sending attribute failed :(");
      }

    }

    previousState = ledStatus;
  }

  // Übertragung der Telemetriedaten:
  // const char* attributes_json = att.c_str(); // Konvertiert die den 'payload'-String zu JSON-Objekt(?)
  //client.sendAttributeJSON(attributes_json);

    //  if (!client.sendAttributeBool("ledStatus", false)) {
    //  Serial.println("Sending attribute failed :(");
    //  }

}

// Funktion - Aufbau der Internetverbindung
void InitWiFi() {
  Serial.print("Connecting to Access Point...");
  WiFi.begin(WIFI_AP, WIFI_PASSWORD);  // Eingabe der Zugangsdaten

  while (WiFi.status() != WL_CONNECTED) {
    delay(500);  // "." bis Verbindung hergestellt ist
    Serial.print(".");
  }
  Serial.println();
  Serial.print("Connected! IP address: ");
  Serial.println(WiFi.localIP());
}

// Funktion - Wiederherstellung der Verbindung zu TB
void reconnect() {
  while (!client.connected()) {
    status = WiFi.status();

    if (status != WL_CONNECTED) { // Prüft zunächst die Internetverbindung
      InitWiFi();
    }

    // Wiederherstellung der Verbindung mit dem festgelegten TB-Device
    Serial.print("Connecting to ThingsBoard Device ...");
    if (client.connect("ESP8266 Device", TB_TOKEN, NULL)) {
      Serial.println("[DONE]");
    } else {
      Serial.print("[FAILED] [ rc = ");
      //Serial.print(client.state());
      Serial.println(" : retrying in 5 seconds]");
      delay(5000);
    }
  }
}

// Funktion - Aufbau und Aufrechterhaltung der RPC-Kommunikation
void connectRPC() {
  if (!subscribed) {
    Serial.println("Subscribing for RPC...");

    if (!client.RPC_Subscribe(callbacks.cbegin(),callbacks.cend())) {
      Serial.println("Failed to subscribe for RPC");
      return;
    }

    Serial.println("Subscribe done");
    subscribed = true;
  }
}
MathewHDYT commented 1 year ago

Seems good what exactly is the console output when you run the script now, does it print "Sending attribute failed :("?

callmereno commented 1 year ago

Check my previous message :)

MathewHDYT commented 1 year ago

You mean the image you posted above, so the script has en exception now?

I'm not sure which message you mean exactly, because the previous comment was your code. Sorry for the confusion.

callmereno commented 1 year ago

Yes I mean the this image:

Yes, will try that out:

grafik

MathewHDYT commented 1 year ago

What, but it does work if you don't replace the calls with an if statement? That's really weird...

callmereno commented 1 year ago

Yes, i know... im reverting code back up until this point.

Perfect I'll see that the issue we found get's merged into the base library sometime soon, but besides that it seems to work nice :D.

The code changes arent the reason because I get same error after reverting :/

callmereno commented 1 year ago

What, but it does work if you don't replace the calls with an if statement? That's really weird...

What is an exeception or what could be the acsue of it?

MathewHDYT commented 1 year ago

An exception would be an abnormal behaviour of a program and I'm talking about so abnormal (stackoverflow, memory leak, reading a null pointer, etc.) that your program couldn't fix itself and would crash.

I'm not really sure this is happening tough because it makes no sense, that the few lines you changed would cause a crash.

Are you sure those are the only log messages your received, because normally if the program actually crashes it does show an additional log message why it crashed at least and of course a stack trace that you can see above as well that's the big block of numbers, it simply shows the hexadecimal pointer values of the methods that were called before the crash occured.

You can use a StackDecoder combined with your .elf file to decode them into the actual method names.