U6143_ssd1306 icon indicating copy to clipboard operation
U6143_ssd1306 copied to clipboard

Changing Temp Display and Loop Delay

Open BzkrZA opened this issue 3 years ago • 7 comments

How do I change the Temp display from Fahrenheit to Celsius, and is it possible to slow down the rate at which it changes between the different info displays. You barely get time to loot a reading and it switches.

BzkrZA avatar May 12 '21 21:05 BzkrZA

The error in the temp display requires a fix to bmp.h, take a look at Pull Request #16, I fixed that and a lot of other things.

The loop delay is the call to sleep(), in display.h, you can increase that in increments of seconds.

darkgrue avatar May 18 '21 12:05 darkgrue

Temperature is still showing Fahrenheit on Display. Need to display Celsius. This is a new install and followed the README.md

U6143_ssd1306

Preparation

sudo raspi-config

Choose Interface Options Enable i2c

Clone U6143_ssd1306 library

git clone https://github.com/UCTRONICS/U6143_ssd1306.git

Compile

cd U6143_ssd1306/C
sudo make clean && sudo make 

Run

sudo ./display

mountain-pitt avatar Jun 02 '21 23:06 mountain-pitt

i am not sure what this is referring to in your release notes. there is no way to change the unit to Celcius with this C code in this repo. if you see the following function.

unsigned char Obaintemperature(void) { FILE fd; unsigned int temp; char buff[150] = {0}; fd = fopen("/sys/class/thermal/thermal_zone0/temp","r"); fgets(buff,sizeof(buff),fd); sscanf(buff, "%d", &temp); fclose(fd); return temp/10001.8+32;

}

if you run "cat /sys/class/thermal/thermal_zone0/temp" the result is in celcius. but then on this line:

return temp/1000*1.8+32;

it is converted to F, /1000*1.8+32 is the formula to convert C to F. Also there are other If conditions in this file which contain hard coded value of 100.

if(temp>=100)

100 degrees in C is boiling ! :)

I dont understand this comments on these check ins in your link above, either it is referencing different code that in main branch or developers are confused about Celsius.

jasonwitty avatar Aug 07 '21 04:08 jasonwitty

I would also need Celsius instead of Fahrenheit. Anything we can test?

WaaromZoMoeilijk avatar Nov 05 '21 18:11 WaaromZoMoeilijk

I would also need Celsius instead of Fahrenheit. Anything we can test?

I'd recommend looking at the PR that's been sitting there, or my own fork, which fixed all this well before they decided to make things worse.

darkgrue avatar Nov 06 '21 00:11 darkgrue

Dude, you're amazing. I'm gonna dig in. Last night i've spend a couple of hours editing and adding stuff. Still unable to find certain references at to symbols etc. Expect some testing of the PR on this side, thanks.

WaaromZoMoeilijk avatar Nov 06 '21 13:11 WaaromZoMoeilijk

To make the display show the temperature in Celsius and the C symbol after it:

in U6143_ssd1306/C/ssd1306_i2c.h make these changes #define CELSIUS 1 #define FAHRENHEIT 0 #define TEMEPRATURE_TYPE CELSIUS

in U6143_ssd1306/C/ssd1306_i2c.c change return TEMPERATURE_TYPE == FAHRENHEIT ? temp/10001.8+32 : temp/1000; to return TEMPERATURE_TYPE == CELSIUS ? temp/10001.8+32 : temp/1000;

mmcfee avatar Feb 07 '23 17:02 mmcfee