Go Down

Topic: 3 Functions on a ATtiny85 - Libraries too Big! Suggestions? (Read 962 times) previous topic - next topic

Sunkmail

Why putting so much effort in insignificant digits?
That probe is no more accurate than 0.1°,  probably less, 0.5° or do. Any further digits are pure noise.  Things like this:
Code: [Select]
  if (tempdecimal%10 >= 5)                              // if the dropped digit 5 or more
      mDegreeC++;     

are a total waste.
Honestly, that rounding was just to confirm I had the rounding concept correct.  Will probably take it out of final code.

My final result will be to only 1 decimal place, but with the DS18B20 at full resolution, I can have single digit changes on the 0.1 Degree level.  I didn't want the temp to jump in 0.5 increments, and I have plenty of time to do the longer conversion.  Probably put the rounding code back in here, just for fun.

The SI metric in me also likes the idea of mili-Degrees more than deci-degrees.  Its just easier for my brain to work in.

dave-in-nj

Quote
U8G2 Library - Way too big!  Didn't spend much time here.
At least U8x8 API should work. Also: I2C OLED will will use lesser ROM than SPI OLEDs (due to a problem in the Arduino Softare).

Oliver

As I understand, the U8G2 is a graphics version and writes to a buffer.
the U8x8 does not, it send data right directly to the display.
as for chips, take a look at the tiny ESP8285  w/1 mbyte flash.

lastchancename

#17
Nov 11, 2018, 06:42 am Last Edit: Nov 11, 2018, 06:42 am by lastchancename
As you get closer to making it all fit in FLASH, don't forget to leave some RAM free for runtime operations by the core.
I generally start to get my ears up when RAM usage gets above 80% in complex projects, or 90% on smaller gadgets.
Experienced responders have a nose for laziness, (they were beginners once)... expecting the poster to contribute to the learning experience.

Sunkmail

 With the Sensor part complete, the Display doing (mostly) what I want, and about 1/2 of what I'm expecting to do the RF, I'm currently sitting at:


   Sketch uses 3812 bytes (46%) of program storage space. Maximum is 8192 bytes.
   Global variables use 63 bytes (12%) of dynamic memory, leaving 449 bytes for local variables. Maximum is 512 bytes.


Doing the temperature data handling myself using the oneWire library, rather than using the DallasTemperature library, lowered my Flash from ~75% and the RAM from ~40%.  I'm guessing it was mostly due to the float variable and related.


Before I do too much more on this unit, I need to get the Rx side of the system ready.  It will be similar in most aspects but will receive from 3 or 4 remote nodes plus control a relay.  I'll be using a Nano, or similar, for this part.


My to-do list for this Tx unit is mostly to lower power consumption (add some sleep or something) and perhaps increase the font size.  (The TinyOzOled Library does have a larger font option for numbers, but it doesn't want to compile for some reason)

lastchancename

#19
Nov 11, 2018, 08:26 am Last Edit: Nov 11, 2018, 08:27 am by lastchancename
As you get closer - you may like to experiment with structs and arrays of structs* to manage your like-sensors
The main benefit will be maintainability, but there might be some optimisation in code size going either way.

* my topic of the day!  Seems like a few posters could use them!
Experienced responders have a nose for laziness, (they were beginners once)... expecting the poster to contribute to the learning experience.

Go Up