hpsaturn / m5coreink-ntp-clock

M5Stick CoreInk NTP clock example
GNU General Public License v3.0
9 stars 5 forks source link

feature request for battery sensor added #2

Open fanlessfan opened 3 years ago

fanlessfan commented 3 years ago

Hi @hpsaturn

I really like your idea of ntp-clock with sleep feature. And like to add sensor information to the screen. I know you have envsensor code, but the drawsensors() is empty. Would you mind to add the build in battery voltage sensor to the screen as an example for showing sensor date on the screen? I tried to fill the rectangle or even clear the buffer, but none works. the clear buffer even ruin the time refresh.

Thanks

`

void drawBattery() {

Serial.println("\ndrawBat");
char str[50];
//TimePageSprite.clear(CLEAR_DRAWBUFF | CLEAR_LASTBUFF);
TimePageSprite.FillRect(10,180,90,16,0);
//TimePageSprite.pushSprite();
TimePageSprite.FillRect(10,180,90,16,1);
//TimePageSprite.pushSprite();
//delay(1000);

sprintf(str, "Bat: %.2f V",batVol);    
TimePageSprite.drawString(10,180,str,&AsciiFont8x16);
//TimePageSprite.pushSprite();

} `

fanlessfan commented 3 years ago

the issue is sometimes the previous number is not erased and the new number is written on top of it and make the number not readable. It's not already happen.

hpsaturn commented 3 years ago

Please, review the next code, there I have a example handling a i2c sensor, maybe it could works for you:

https://github.com/hpsaturn/co2_m5coreink