arduino-libraries / Bridge

Bridge Library for Arduino
http://arduino.cc/
13 stars 28 forks source link

bridge.cpp should not use String #11

Open agdl opened 8 years ago

agdl commented 8 years ago

From @jantje on January 28, 2014 16:27

Currently the bridge library relies on the String class for put command. I think that including String only for put is a bit expensive. The author probably agrees with this as the code has following comment

// TODO: do it in a more efficient way

I think extending transfer to another data set and this (untested) code would be far better

void BridgeClass::put(const char key, const char value) { transfer("D",1,key,strlen(key),"\xFE",1,value,strlen(value)); } Best regards Jantje

Copied from original issue: arduino/Arduino#1831

agdl commented 8 years ago

From @bigjosh on March 31, 2014 22:2

I agree. These strings use up precious RAM and fail silently when dynamic RAM runs out. I'd prefer if all the Bridge functions used statically allocated buffers becuase they would be much more efficient in time and memory and at least you would know when you ran out of RAM at compile time rather than crashing at run time.

jantje commented 8 years ago

This is a more than 2 year old issue. I'm surprised there is still some action :-)