I'm new to using Libraries with the Arduino , When I try to compile my this Uni Mote 2p7 code below, I can't get the Arduino 1.6.1 IDE to accept the Flash.h Library found at arduiniana.org/libraries/flash/
#include <RFM69.h>
//#include <RFM69registers.h>
#include <SPI.h>
#include <SPIFlash.h>
#include <OneWire.h>
#include <LowPower.h>
#include <EEPROM.h>
#include <Flash.h>
i get a strange result. I'm new at using multiple libraries and not sure how to verify I have the correct instantiation of the Flash.h Library, any ideas on how to verify I'm using the correct FLASH.H Library the author intended ?
C:\Users\Documents\Arduino\libraries\Flash/Flash.h:36:34: error: no matching function for call to '_FLASH_STRING::_FLASH_STRING(const char [13])'
_FLASH_STRING name(name##_flash);
^
uni_mote_2p7_v1.ino:1474:5: note: in expansion of macro 'FLASH_STRING'
C:\Users\Documents\Arduino\libraries\Flash/Flash.h:36:34: note: candidates are:
_FLASH_STRING name(name##_flash);
^
uni_mote_2p7_v1.ino:1474:5: note: in expansion of macro 'FLASH_STRING'
C:\Users\Documents\Arduino\libraries\Flash/Flash.h:70:3: note: _FLASH_STRING::_FLASH_STRING(const int*)
_FLASH_STRING(const prog_char *arr);
What exactly is a Uni Mote 2p7?
Sorry I should have given more details. :'(
I'm trying to connect a bunch of Moteino Nodes up to a Moteino Gateway, and then onto the web via a raspberry Pi.
I'm trying to use the Software suggested by Colin at CUPID, the Universal Mote called "uni_mote-2p7.ino" was described as the code that can be configured to work as the Gateway or the Node.
https://github.com/iinnovations/iicontrollibs/tree/master/mote/remote/uni_mote_2p7
It looks like the code is using a flash.h library , but my Arduino IDE 1.6.4 does't see it.
Oh I see. For a moment I thought that is some other type of hardware.
Honestly I'm not sure what flash.h is. It's a good idea to document where the libs originate or include them with a library. In this case there is no documentation and a quick search in the repositories doesn't reveal anything. Maybe Colin can shed the light here when he reads this post.
Hi there folks. Been gone a while. It's a library for putting strings in Flash to save memory space.
I have located the library, originally located on the Arduiniana site, and put it into the git repo:
https://github.com/iinnovations/iicontrollibs/tree/master/mote/libraries/Flash
I am also running into the same compilation issue as you, and this appears to have only showed up in newer versions of the IDE. I am first going to verify that this can compile properly in 1.0.5, where it was developed. Stand by.
This compiles fine in 1.0.5. Looking at 1.6.5.
C
This appears to be the issue:
http://forum.arduino.cc/index.php?topic=272313.0
I'll attempt a quick rewrite.
C
And now the version posted at the repo above will compile in 1.6.5. The 'bak' version is the pre-1.5 version.
Cheers,
Colin
I haven't checked out this library, but a quick observation is that 'Flash.h' seems like a pretty generic name for a library that:
Quote from: ColinR on August 17, 2015, 08:45:23 PM
It's a library for putting strings in Flash to save memory space.
This library name is bound to collide with other flash libraries.
Also, how is this different than the F() macro? For example:
Serial.print("this string is stored in data memory.");
Serial.print(F("This string is stored in program (AKA Flash) memory."));
Tom
Tom,
You're definitely right, and I'll rename the library, as I know for a fact there are other libraries with this (nondescript) name.
The F() macro, as far as I can tell, is only to put temporary strings into flash memory, e.g. when using things like
Serial.println(F("My string that stays in flash"))
as even this command without the macro will eat up memory.
A typical usage in my programs is something like:
FLASH_STRING(msgbuffer, "cmd:mp,");
msgbuffer.copy(&replystring[replylength], 7);
replylength+=7;
I can copy character arrays into a buffer string and then append them into another char array when building a message. I can then reuse the message buffer. This saves a huge amount of memory compared to other methods when you're doing a lot of this sort of message creation. Believe me, I tried many, and FLASH_STRING allowed me to cram more message parsing and manipulation by far.
C
Quote from: ColinR on August 18, 2015, 02:58:57 PM
The F() macro, as far as I can tell, is only to put temporary strings into flash memory, e.g. when using things like
Serial.println(F("My string that stays in flash"))
as even this command without the macro will eat up memory.
I think you mean 'static strings', not 'temporary strings', but, yes, now I see what you're doing. If I understand correctly you can (almost) sprintf to program memory. 'almost' meaning that you still need to copy to and from prog mem, but, in the process, have much larger buffers for dynamically constructed data. Yes, this is useful.
This, of course, then begs the question of wear. Do you have any load leveling or similar method to prevent overuse of the specific locations?
Tom
Nope. Good question. Smoke 'em while you got 'em.
C