String constants

Any bugs you encounter with Flowcode should be discussed here.
Post Reply
mnfisher
Valued Contributor
Posts: 955
http://meble-kuchenne.info.pl
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 104 times
Been thanked: 508 times

Flowcode v10 String constants

Post by mnfisher »

I hit upon an issue trying to get an esp32 to connect to wifi using v5.1.1

I had string constants (local to main) .ssid and.pswd (say "SSID" and "PASSWORD" for example)

Then I call ConnectToSSID(.ssid, .pswd, 60)

This fails to connect - and the error messages output to UART have 'Failed to connect to SSID SSIDPASSWORD Password WORD")

Passing the values in the function (So ConnectToSSID("SSID", "PASSWORD", 60) connects correctly)

The string constants aren't terminated or treated correctly? I didn't test but I suspect adding a terminator ("SSID\0") would fix this?

Martin

mnfisher
Valued Contributor
Posts: 955
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 104 times
Been thanked: 508 times

Re: String constants

Post by mnfisher »

Just taken a look at the source created and no room is allowed for a termination character.

For example:

Code: Select all

  
  #define FCLsz_SSID 9
  const MX_CHAR FCL_SSID[FCLsz_SSID] = "BT-ZMA6WK";
The string needs to be defined as FCL_SSID[FCLsz_SSID + 1] = "...
or
FCL_SSID[ ]= "BT-

This also affects global string constants.

Just checked in v8 - here we get

#define FCL_SSID "BT- ...

Which works correctly.

Martin

Post Reply