I'm trying to read temperature and pressure from BMP180 sensor with my ESP8266. I want to display those numbers on 128x64 screen. BMP180 works perfectly, and I have also managed to write display driver. However, when I put those two pieces together I get "Run out of memory" exception.
According to my research, I should be able to release heap used by BMP180 library with following commands:
bmp180 = nil
package.loaded["bmp180"]=nil
So I tried the following code:
print("start "..node.heap())
bmp180 = require("bmp180")
bmp180.init(I2C_SDA, I2C_SCL)
bmp180.read(OSS)
t = bmp180.getTemperature()
p = bmp180.getPressure()
print("finished "..node.heap())
bmp180 = nil
package.loaded["bmp180"]=nil
print("unloaded "..node.heap())
But the result is:
start 26752
finished 20424
unloaded 20376
The collectgarbage() method doesn't help either. So why am I still missing 6000 bytes? Am I doing anything wrong? Is there another way to clear my heap?
Thanks for help