Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing Temp Display and Loop Delay #17

Open
BzkrZA opened this issue May 12, 2021 · 7 comments
Open

Changing Temp Display and Loop Delay #17

BzkrZA opened this issue May 12, 2021 · 7 comments

Comments

@BzkrZA
Copy link

BzkrZA commented May 12, 2021

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.

@darkgrue
Copy link

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.

@mountain-pitt
Copy link

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

@jasonwitty
Copy link

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/1000
1.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.

@WaaromZoMoeilijk
Copy link

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

@darkgrue
Copy link

darkgrue commented Nov 6, 2021

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.

@WaaromZoMoeilijk
Copy link

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.

@mmcfee
Copy link

mmcfee commented Feb 7, 2023

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/1000
1.8+32 : temp/1000;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants