It looks like this has been fixed in 0.4.2
To get this version of firmware do I just need to re-flash my Photon with my code and it will upgrade the firmware ?
It looks like this has been fixed in 0.4.2
To get this version of firmware do I just need to re-flash my Photon with my code and it will upgrade the firmware ?
Itâs not working for my photon. Been flashing all day trying to figure out why %f wasnât working and stumbled on this thread.
To update your system firmware you need to (for now) do so manually. Visit this page for the latest files and instructions. At the 0.4.3 release, there are instructions on how to upgrade your firmware. Change the version numbers, and you should be good to go.
Why dont we get these updates automatically ?
Keeping track of manually updating every photon seems a bit like wasted time.
Which is exactly why I said âfor nowâ. An automated updating system is being worked on very hard. There are a lot of things that need to come together perfectly to ensure everything runs smoothly. Tests are currently being done to check for any possible issues it might present. Hopefully, weâll see the system within the next 2-3 weeks, maybe sooner (@dave?)
Sounds good
Heya!
Yes, weâre working hard to get the automatic-update system out. Most of the supporting pieces are in place, but it requires coordination across all the teams and cloud services. Right now weâve paused the auto-update release so we have time to fix what appear to be firmware issues.
Thanks!
David
I updated my Photon to 0.4.4 rc2 using the command line but it doesnât look like the sprintf functionality is fixed. I still just get empty strings.
I think youâll need to recompile your application in this case, since it will then use the sprintf from the system modules, rather than sprintf compiled from libc. If youâre not building locally then the fix wonât be available until the compiler service is updated, which should happen very soon, hopefully this week.
Doh!
Yes I am building locally. I re-flashed my firmware. I checked the firmware version is 0.4.4 using Serial and examined the json output.
Empty strings the same as the older firmware.
This is the basic example I used - works fine on the core, blank mystr only on the photon.
char mystr[20];
int myint;
void setup()
{
Spark.variable("mystr", &mystr, STRING);
Spark.variable("myint", &myint, INT);
}
void loop()
{
myint=42;
sprintf(mystr,"%.2f",3.56f);
delay(50);
}
Hi @Rockvole
You don't need (or want) the ampersand "&" on char array. The name of the array is already what you need for the Spark.variable.
There are still problems with sprintf and floats on Photon web builds, but the fix is coming very soon.
Ok thanks. Iâm feeling like the command line is the âbleeding edgeâ now and the web is where the standard releases are. I just prefer command line because I can use the editor I like and can check my code into github so I donât lose it.
Youâll also need to build your application locally to get the sprintf fix. If the app is built in the cloud then it wonât have the fix at present since the cloud compiler is at version 0.4.1.
Oh yes, good point - I forgot the command line build is sent to the cloud to build.
It does work when you write the code like this
void updateDATA() {
String HTTPreq;
if (client.connect(server, 80))
{
HTTPreq = "GET /data2.php";
String S(DHT.getCelsius(), 2);
HTTPreq = HTTPreq + "?temp=" + S;
String H(DHT.getHumidity(), 2);
HTTPreq = HTTPreq + "&hum=" + H;
String R(abs(WiFi.RSSI()));
HTTPreq = HTTPreq + "&rssi=" + R;
If you write the code this way
void updateDATA() {
String HTTPreq;
String S, H, R;
if (client.connect(server, 80))
{
HTTPreq = "GET /data2.php";
S(DHT.getCelsius(), 2);
HTTPreq = HTTPreq + "?temp=" + S;
H(DHT.getHumidity(), 2);
HTTPreq = HTTPreq + "&hum=" + H;
R(abs(WiFi.RSSI()));
HTTPreq = HTTPreq + "&rssi=" + R;
The compiler shows some errors
keller_klima.cpp: In function 'void updateDATA()':
keller_klima.cpp:35:30: error: no match for call to '(String) (float, int)'
^
keller_klima.cpp:37:31: error: no match for call to '(String) (float, int)'
^
keller_klima.cpp:39:27: error: no match for call to '(String) (int)'
{
^
The first solution works
Any advice?
In the first case, you are declaring String and calling its constructor, which creates new string object. In the second case, you are trying to call ariables as functions, which doesnât work. The second example is analog to:
int i;
i(42);
What are you probably trying to achieve is:
String HTTPreq;
String S, H, R;
if (client.connect(server, 80))
{
HTTPreq = "GET /data2.php";
S = String(DHT.getCelsius(), 2);
HTTPreq = HTTPreq + "?temp=" + S;
H = String(DHT.getHumidity(), 2);
HTTPreq = HTTPreq + "&hum=" + H;
R = String(abs(WiFi.RSSI()));
HTTPreq = HTTPreq + "&rssi=" + R;
You may find Wiring reference handy:
http://wiring.org.co/reference/String.html
Yes! That works
Thank you
Still an issue with the cloud compiler, which according to the Particle email today is now at v0.4.4?