It seems to me that there is a bug in String library (WString.cpp).
Environment:
- ARDUINO IDE 1.8.15
Z-Uno bootloader version:3.0.7
Security:none
Frequency:EU
Device included:no
Device included securely by controller:/no
Controller:Fibaro HC2 in future time
Code: Select all
#include "Arduino.h"
#include "ArduinoTypes.h"
#include "ZUNO_Definitions.h"
#if (ZUNO_CORE_VERSION_MAJOR < 3)
#error "------- This code should be complied for ZUNO 2 target"
#endif
//#define SPDBGSTART(X) Serial.begin(X)
//#define SPDBG(...) Serial.print(__VA_ARGS__)
//#define SPDBGLN(...) Serial.println(__VA_ARGS__)
#define SPDBGSTART(X)
#define SPDBG(...)
#define SPDBGLN(...)
String stgTemp;
String stgTutu;
String stgToto;
//_________________________________________________________________________________
//_________________________________________________________________________________
void setup() {
SPDBGSTART(57600);SPDBGLN(" ");SPDBGLN("SetupStart");
// blink led to see if we are here more than once (reboot)
pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, HIGH); delay(1000);digitalWrite(LED_BUILTIN, LOW);
}
uint32_t u32Count = 0;
//_________________________________________________________________________________
// LOOP LOOP LOOP LOOP LOOP
//_________________________________________________________________________________
void loop() {
stgTutu = "<< 3456 >>" ;
stgTemp = "abcd";
//String stgTemp3 = stgTutu + stgTemp2;
SPDBG (u32Count);
SPDBGLN (" ");
SPDBGLN(stgTutu);
u32Count++;
delay(1000);
}
Code: Select all
void loop() {
stgTutu = "<< 3456 >>" ;
String stgTemp = "abcd";
//String stgTemp3 = stgTutu + stgTemp2;
SPDBG (u32Count);
SPDBGLN (" ");
SPDBGLN(stgTutu);
u32Count++;
delay(1000);
}
Code: Select all
void loop() {
stgTutu = "<< 3456 >>" ;
String stgTemp = "abcd";
String stgTemp3 = stgTutu + stgTemp;
SPDBG (u32Count);
SPDBGLN (" ");
SPDBGLN(stgTutu);
u32Count++;
delay(1000);
}
Even stgTemp = String("<< 3456 >>") + String("abcd"); doesn't work
I have seen some other strange behaviors using WString.cpp but this one is simple.
It makes me think this is a pointer(s) issue, but may be I am doing something wrong?
Thanks
Yves