Some weeks ago I decided to become familiar with the Arduino IDE method for updating an emonTx firmware/sketch.
I installed it on my Windows laptop together with the required Libraries.
I was successful in burning the latest 3 phase sketch with Calibration constants which I had determined after a few experiments. It all worked perfectly well.
Today I decided to further adjust the Calibration constants and made the necessary changes to the src.ino file.
I expected the updating process to be as simple and straightforward as previously but it was not âŚ
When running Arduino IDE Verify, I get the following error messages âŚ
~~\src\config.ino: In function âvoid readInput()â:
config:165:25: error âshowStringâ was not declared in this scope
showString(helpText1);
Then a similar error âŚ
In function âbool config(char)â:
config:239:29: error âshowStringâ was not declared in this scope
showString(helpText1);
I am at a loss to understand as Iâm using the same procedure that worked a few weeks ago.
Iâm using SERIALOUT (line 74 of src.ino) and notepad ++ to make changes to & save files.
Searching the Forum for config.ino, I found nothing relevant except for a âMuch improved version by Robert Wall #6â. I tried this but it still threw errors on Verify.
Is the showString(âŚ) function still present in the config.ino file (right at the bottom), or has it been accidentally edited out?
I too use NP++ (in preference to the in-built editor), so that in itself is not the culprit.
The correct config.ino was bundled with the main sketch, along with the documentation, in a zip file - I believe all the contents thereof have since been separated - I know not why, so maybe someone had married the wrong config.ino to the sketch.
Robert âŚ
Thx for yr incredibly fast response.
Your zipped config.ino looks similar to the one I was using.
However I have just tried yr zipped version.
Unfortunately - I get the same showString errors.
Thx again - itâs late - Iâm to bed
As a cross-check, I tried compiling the sketch. No errors.
FWIW, I get the same errors the OP gets (line number references)
if I comment out the showString function. (config tab)
@Bill.Thomson
That figures, as the error message means it canât find the definition of the function. (The Arduino IDE doesnât require a declaration of the function, like most compilers.)
Which begs the question: @johnbanks
You havenât loaded any other IDE, have you? Because thereâs one, heavily promoted, which screwed up badly and moved directories and files around when I tried it out. And that could easily cause untold errors.
In the Arduino IDE, have you got 3 tabs and 3 files:
âemonTx_3Phase_PLLâ, âconfigâ and ârfmâ?
Those 3 files all need to be in the same directory, called âemonTx_3Phase_PLLâ
And have you disabled the internal editor in the Arduino IDE? (File â Preferences â Settings â Use external editor)
I trust you know about the âCompareâ plug-in for NPP?
It works for you guys and it worked for me a couple of weeks ago.
I figured it must be my Arduino IDE installation or the way Iâm using it so âŚ
So Iâve re-installed Arduino IDE (now 1.8.7) and the Libraries - jeelib, emonlib,one wire & Dallas temp.
I used Robertâs zipped files (above) - unzipped them then had to remove â_v1.2â from the folder name to get the 3 tabs and 3 files.
I made no other changes except for Preferences - verbose, line numbers and external editor.
I ran Verify but still got the same showString errors on lines 165 & 239 of config.ino
Do I need helpText1?
If viable - which lines should I delete from config.ino to work around this problem?
Thanks
PS - Iâve also installed the Compare plugin for Notepad ++
There must be something about your installation that isnât quite right.
This is a long shot:
Look through the Arduino installation instructions in Learn Learn | OpenEnergyMonitor and especially Learn | OpenEnergyMonitor just in case thereâs something not in the correct place, though I donât see how that would account for the error youâre seeing.
It comes back to the compiler canât see the function:
static void showString (PGM_P s) {
for (;;) {
char c = pgm_read_byte(s++);
if (c == 0)
break;
if (c == '\n')
Serial.print('\r');
Serial.print(c);
}
}
yet it must be reading and parsing the file to generate the error message.
There has to be something wrong in the file above that function definition thatâs preventing the compiler from finding it.
Iâm using V1.8.1 under Ubuntu Linux, but I canât see anything in the release notes that might be relevant.
You do want showString, because it gives you the help text for configuring & saving to EEPROM. If you canât get it to work, commenting those two lines that throw the error should get you going.
In an attempt to get going, I commented out lines 165 & 239 in config.ino with the following result âŚ
config .ino then threw an error at line 240
I then commented out line 240 and things progressed a bit âŚ
emonTx_3Phase_PLL.ino threw errors at lines 370, 472 & 868
config.ino threw a new error at line 274
and rfm.ino threw an error at line 151
As I am not using Radio, I modified emonTx_3Phase_PLL.ino with my specifics âŚ
Line 74 SERIALOUT
Line 98 node 13
Line 123 // commented out as CT4 not used
Line 125 // commented out for normal LED behaviour
and Line 133 changed to 45 as CT4 not used
Things progressed a bit further and I now got the following errors âŚ
Can you upload a zip of the source files youâve edited? Maybe give it a name of âsketch_failing.zipâ so it doesnât confuse others who may find it in future and think its a working version.
I think youâve possibly taken too much out.
When you edited line 240, you should have left an empty statement after the default: condition, i.e.
default:
showString(helpText1);
} //end switch
should become
default:
;
} //end switch
Yes, that semicolon is an empty statement. (Without it, the compiler got lost, which provoked the other errors.) Then restore everything you did after that, and see where we are. If it still complains that getCalibration is not declared, weâre back to the original problem again, because by removing showString, all weâve done is move the problem a bit further on, but itâs still the case that the config.ino file is not getting read properly and the functions in it arenât being found.
Iâm going to download the same version of the IDE shortly and install that, and see what happens.
⌠In function âvoid readInput()â:
config:165:29: error: âshowStringâ was not declared in this scope
showString(helpText1);
So itâs NOT you and itâs NOT my sketch - itâs the IDE.
Can you revert to V1.8.1 - which is the version I was using?
Next question: Why? and what can be done about it? It wonât be good to consolidate everything into the one file, but thatâs probably the work-around.
The newer IDE appears to compile more efficiently, but importantly the declaration of showString( ) doesnât generate an error in the older IDE V1.8.1.
Hopefully my travails and your efforts will be of benefit to others.
And I do hope a way is found to make the latest versions of sketches more readily accessible in the RESOURCES section of the website - that would benefit others too.