Editing ino file

Hi all,

I am trying to edit emonPi_RFM69CW_RF12Demo_DiscreteSampling.ino located in /home/pi/emonpi/Atmega328/emonPi_RFM69CW_RF12Demo_DiscreteSampling but it seems to have no effect.

For instance i replaced:   

emonPi.power1_plus_2=emonPi.power1 + emonPi.power2;                            //Create power 1 plus power 2 variable for US and solar PV installs

By

emonPi.power1_plus_2=0;
//emonPi.power1_plus_2=emonPi.power1 + emonPi.power2;                            //Create power 1 plus power 2 variable for US and solar PV installs

 

So i expect to see power1_plus_2 always equal to zero in Emoncms but it is not the case.

Do i have to edit another file ?

Thanks by advance for your help

 

pb66's picture

Re: Editing ino file

The file you are editing (.ino) needs compiling to produce a binary hex file, then that hex file is the file installed to the AVR by avrdude. Normally the Arduino IDE would take care of all this but since the IDE is not installed/used on the emon images you will need to compile your modified ino on another machine and transfer the hex file that is produced, to the Pi. Unless of course, you install and use the IDE, either with a keyboard and monitor or a remote desktop/vnc (or maybe use a command line compiler like "inotool" or "arduino-mk")

Paul

Robert Wall's picture

Re: Editing ino file

Thorgard's picture

Re: Editing ino file

Hi all,

Thanks for your help.  I downloaded Arduino 1.6.5 and tried to compile the ino file.  I got some errors for library missing (Jeelib, Emonpi,...)  I downloaded and installed all missing library but i get other compilation errors:

 

emonPi_RFM69CW_RF12Demo_DiscreteSampling.ino: In function 'void setup()':
emonPi_RFM69CW_RF12Demo_DiscreteSampling:176: error: 'emonPi_startup' was not declared in this scope
emonPi_RFM69CW_RF12Demo_DiscreteSampling:177: error: 'RF_Setup' was not declared in this scope
emonPi_RFM69CW_RF12Demo_DiscreteSampling:178: error: 'check_for_DS18B20' was not declared in this scope
emonPi_RFM69CW_RF12Demo_DiscreteSampling:179: error: 'emonPi_LCD_Startup' was not declared in this scope
emonPi_RFM69CW_RF12Demo_DiscreteSampling:181: error: 'CT_Detect' was not declared in this scope
emonPi_RFM69CW_RF12Demo_DiscreteSampling:182: error: 'serial_print_startup' was not declared in this scope
emonPi_RFM69CW_RF12Demo_DiscreteSampling:184: error: 'onPulse' was not declared in this scope
emonPi_RFM69CW_RF12Demo_DiscreteSampling.ino: In function 'void loop()':
emonPi_RFM69CW_RF12Demo_DiscreteSampling:229: error: 'handleInput' was not declared in this scope
emonPi_RFM69CW_RF12Demo_DiscreteSampling:235: error: 'RF_Rx_Handle' was not declared in this scope
emonPi_RFM69CW_RF12Demo_DiscreteSampling:239: error: 'send_RF' was not declared in this scope
emonPi_RFM69CW_RF12Demo_DiscreteSampling:281: error: 'get_temperature' was not declared in this scope
emonPi_RFM69CW_RF12Demo_DiscreteSampling:297: error: 'send_emonpi_serial' was not declared in this scope
'emonPi_startup' was not declared in this scope

 

Do you know what i did wrong ?

Thanks by advance

 

Robert Wall's picture

Re: Editing ino file

Did you download the complete directory that the file emonPi_RFM69CW_RF12Demo_DiscreteSampling.ino is in? Because you must as it contains the remaining source files that are needed.

Thorgard's picture

Re: Editing ino file

Thanks for your help again !  I could successfully compile the original emonPi_RFM69CW_RF12Demo_DiscreteSampling.ino.  I got a hex file which i rename emonpi_raw.hex.

 

However i have a problem with the next step.  When i am using:

sudo service emonhub stop

avrdude -v -c arduino -p ATMEGA328P -P /dev/ttyAMA0 -b 115200 -U flash:w:/home/pi/emonpi/Atmega328/emonPi_RFM69CW_RF12Demo_DiscreteSampling/compiled/emonPi_latest.hex

sudo service emonhub start

Everything works

 

But when i am doing the same with my compiled file:

sudo service emonhub stop

avrdude -v -c arduino -p ATMEGA328P -P /dev/ttyAMA0 -b 115200 -U flash:w:/home/pi/emonpi/Atmega328/emonPi_RFM69CW_RF12Demo_DiscreteSampling/compiled/emonPi_raw.hex

sudo service emonhub start

My emonPi node is marked "Inactive"

 

When looking at the emonhub log, the only difference is that with emonPi_raw.hex i have a warning

2015-11-13 13:14:17,550 WARNING MainThread Device communication error - check settings
 

I don't understand why it doesn't work since i am just recompiling the original emonPi_RFM69CW_RF12Demo_DiscreteSampling.ino without making any change.

 

Thorgard's picture

Re: Editing ino file

Hum ... sorry it works.  I uploaded the wrong file on the pi ...  Thanks for all your help !

Robert Wall's picture

Re: Editing ino file

"I uploaded the wrong file..."

Now if I could have one [insert your unit of currency here] for every time I've done that, or edited one file and uploaded another, I'd be rich indeed!

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.