Community
OpenEnergyMonitor

OpenEnergyMonitor Community

Firmware compiling problems

Having difficulty loading firmware fro the TX2. Get the following IDE error message:
Arduino: 1.8.1 (Windows 10), Board: “Arduino/Genuino Uno”

In file included from C:\TEMP\arduino_modified_sketch_826053\sketch_jun06a.ino:6:0:

C:\Program Files (x86)\Arduino\libraries\jeelib-master/RF69_compat.h:9:2: error: #error This file must be included BEFORE the “RF12.h” header file!

#error This file must be included BEFORE the “RF12.h” header file!

^

exit status 1
Error compiling for board Arduino/Genuino Uno.

This report would have more information with
“Show verbose output during compilation”
option enabled in File → Preferences.

The error is telling you the line that specifies the RF69_compat.h file
needs to be before the line that specifies the RF12.h file.

Did you rename your JeeLib folder as instructed? - it looks as if you haven’t.

Dont think so…where is the instruction??

I’m not sure if the instructions to install libraries survived the recent documentation “improvements”, since PlatformIO is preferred by some, the Arduino section seems to have been reduced to

Using Arduino IDE

Either PlatformIO or Arduino IDE can be used to compile and upload the firmware. This example will use PlatformIO since we consider it the easiest method. If you wish to use Arduino IDE see Offical Arduino Getting Started Guide.

(See Firmware Modification - Guide | OpenEnergyMonitor)

Basically when you download from github the resulting folder is usually automatically named “jeelib-master.zip”, that then needs to be renamed to just “jeelib” after it is unzipped.

The instructions for installing the libraries used to be there. I admit I didn’t look and check.

Here are the instructions for Win 8.1 - Win 10 is recognisably similar.
Installing Libraries W8.1.pdf (279.4 KB)

I downloaded Platformio as it seems to be promoted as the best thing since sliced bread, and without asking permission or even reporting what it had done, it moved and renamed great chunks of my workspace, and broke all my shortcuts and scripts. After removing it, it took me an hour or two to recover. So I cannot recommend or advise the use of Platformio.

I’ve been very frustrated by Platformio also. And its all related to libraries and trying to determine what needs to be loaded and how. For the short term I am headed back to the Arduino IDE just to get something done.
 

@sapphire - The arduino IDE doesn’t like dashes in its path names.

3) Renaming the Libraries
The Arduino IDE does not allow hyphens ‘-’ in the library folder names.

And having said that, the Arduino’s handling of libraries doesn’t exactly follow the norms that every other compiler and IDE I’ve come across does. But at least it doesn’t move stuff about without asking.

I’ll dig as much as I can out of Wayback Machine and my archive, and update the PDF (link above) for Win10 and Linux. A shame that the proven working instructions have gone to the bit bucket.

Many thanks and appreciated.

Getting all the correct Arduino library together can be tricky. This is why I much prefer using platformIO. All the libraries (at exactly the correct versions) are automatically installed. See the PlatformIO instructions at: Firmware Modification - Guide | OpenEnergyMonitor

However, in @sapphire’s case all he wants is to upload the standard firmware version. Compiling should not be needed (assuming 433Mhz, RFM69CW, node ID 10 and group 210), you can just flash the ready compiled .hex

I’ve just added pre-compiled .hex to all the main versions of emontx V2 FW repo

There are various ways to upload .hex. On linux, I use avrdude. On windows, you have a choice of the following. Sorry I don’t have a windows machine to test. Maybe some else can confirm:

http://www.hobbytronics.co.uk/arduino-xloader
http://arduinodev.com/arduino-uploader/

Just connect the USB to UART cable to your emonTx then upload the pre-compiled .hex file.