Community
OpenEnergyMonitor

Community

EmonTxV3CM Too Big with SHOW_CAL

Hi,

When I uncomment #define SHOW_CAL, it’s then too big for an Uno:

text section exceeds available space in boardSketch uses 33072 bytes (102%) of program storage space. Maximum is 32256 bytes.

Global variables use 1316 bytes (64%) of dynamic memory, leaving 732 bytes for local variables. Maximum is 2048 bytes.
Sketch too big; see http://www.arduino.cc/en/Guide/Troubleshooting#size for tips on reducing it.
Error compiling for board Arduino Uno.

Ian

Managed to work around it by cutting the temperature stuff out of the sketch:

  EmonLibCM_setTemperatureDataPin(5);                      // OneWire data pin (emonTx V3.4)
  EmonLibCM_setTemperaturePowerPin(19);                    // Temperature sensor Power Pin - 19 for emonTx V3.4  (-1 = Not used. No sensors, or sensor are permanently powered.)
  EmonLibCM_setTemperatureResolution(11);                  // Resolution in bits, allowed values 9 - 12. 11-bit resolution, reads to 0.125 degC
  EmonLibCM_setTemperatureAddresses(allAddresses);         // Name of array of temperature sensors
  EmonLibCM_setTemperatureArray(allTemps);                 // Name of array to receive temperature measurements
  EmonLibCM_setTemperatureMaxCount(3);                     // Max number of sensors, limited by wiring and array size.
  
  EmonLibCM_TemperatureEnable(temp_enable);  

It seems to work for an emonTx. Have you added anything else to the sketch? Are you using a big bootloader?

Nope, it’s the emonTxV3CM sketch straight from GitHub, all I did was uncomment the SHOW_CAL line.

If I comment it out again, it works fine.

It’s an emonTx v3.2 with an RFu module. AFAIK it’ll have a normal Uno bootloader on.

Ian

That sketch is particularly for the emonTx, I not aware that anyone has tested it with the (long-obsolete) RFµ.

I’ve just tried and it has loaded quite happily on my V3.2 without SHOW_CAL

Sketch uses 27632 bytes (85%) of program storage space. Maximum is 32256 bytes.
Global variables use 1248 bytes (60%) of dynamic memory, leaving 800 bytes for local variables. Maximum is 2048 bytes.

and with it

Sketch uses 28574 bytes (88%) of program storage space. Maximum is 32256 bytes.
Global variables use 1288 bytes (62%) of dynamic memory, leaving 760 bytes for local variables. Maximum is 2048 bytes.

but that’s far from what I’d call a test.

Just to clarify - it works fine without SHOW_CAL.

With it I get the output in the first post.

Read what I wrote - carefully.
I’m using the proper Arduino IDE, V 1.8.12. I can’t vouch for any other version or IDE.

I’m using V 1.8.13 on Linux.

In that case, I suggest you drop back a version. I hadn’t spotted that a newer version had been released (Ubuntu generally takes quite a while to check and make the updates available).

Is this the same emonTx V3.2 that you’re using in the other thread? I don’t know how good the compiler is at leaving out unused code (the Arduino people seem to have rather heavily customised it), you could try taking the RFM code out completely, as you’re not going to use it (and you can’t use it - the processor is too busy to be able to send the data 1 character at a time as the RFM12B requires).

I’ve now downloaded and installed arduino-1.8.13-linux64.tar.xz, then downloaded again and compiled the sketch.

Without #define SHOW_CAL:
Sketch uses 28852 bytes (89%) of program storage space. Maximum is 32256 bytes.
Global variables use 1293 bytes (63%) of dynamic memory, leaving 755 bytes for local variables. Maximum is 2048 bytes.

With #define SHOW_CAL:
Sketch uses 29376 bytes (91%) of program storage space. Maximum is 32256 bytes.
Global variables use 1313 bytes (64%) of dynamic memory, leaving 735 bytes for local variables. Maximum is 2048 bytes.

So, I don’t know what you were doing to get 33072 bytes.