steadramon / ESPGeiger

☢️ ESP8266 / ESP32 Firmware for collecting and reporting statistics from Geiger counters
GNU General Public License v3.0
23 stars 3 forks source link

Problem with the OLED display #8

Open georgi-m-iliev opened 2 weeks ago

georgi-m-iliev commented 2 weeks ago

Hello!

First of all I want to say congrats on the amazing work you've done on this project. It is really complete and has awesome features. That is way I really want to use it to power my geiger counter.

The issue I'm experiencing is the display not clearing. photo_2024-06-16_11-58-56

I am compiling my own version due to different pins used for the I2C interface. I've tested the screen with the Adafruit_SSD1306 and the screen is working as expected.

Would you have any idea what might be the issue and how to resolve it?

steadramon commented 2 weeks ago

Hi there,

Can you confirm the alternate pins you're using? Also the board on which this is set up, so that I might be able to replicate?

It does feel like the clear() function isn't updating the screen properly. This could be related to the clock on the alternate pins - this is something I looked into a while ago, but have since used the assigned I2C pins on the boards.

You could try uncommenting this line and try adjusting clock speed - https://github.com/steadramon/ESPGeiger/blob/main/ESPGeiger/src/OLEDDisplay/OLEDDisplay.h#L62

georgi-m-iliev commented 2 weeks ago

Hi, thank you for responding!

I am using the LOLIN D1 Mini (v4) board and the following pin arrangement: SCL -> 0; SDA -> 2; GEIGER_RXPIN -> 4.

I tried different values for the clock speed, a lot lower and a higher than the default one, but to no avail, the issue persists. It is possible the pins are not suitable for use with I2C, but the weird thing is that the Adafruit library works just fine. As a note, I am using those pins, because for some reason, the only pin that was able to be used for interrupt when pulled HIGH, was pin 4, which is the default SDA pin, on the other hand, for some reason I was never successful in using pin 5 as a digital output - probably some defect on the board itself.

steadramon commented 1 week ago

Hi I've been looking through this - I cannot replicate.. it's mighty weird as it seems that some of the update functions are only partially running.. running some items within the function but not others - this isn't just limited to "clear"

For example, I notice that you seem to have the historic graph drawn, however the axes for the graph aren't drawn - in the function, the axes are drawn just before the historic graph. The min/max values are also not on the graph - these are drawn immediately after the graph is drawn.

I'm very confused with this. I've tried several ways of breaking this in the same way - I've possibly spotted a few bugs but nothing which would cause such weird behaviour. I've tried with the OLED flipped and not flipped, just in case I had overlooked something here, but that is all handled by the underlying library.

Perhaps you could test the examples from there? https://registry.platformio.org/libraries/thingpulse/ESP8266%20and%20ESP32%20OLED%20driver%20for%20SSD1306%20displays

Have you the ability to test with different pins or another board?

Can you share your full env definition (and base if there) just in case there's anything there I'm assuming/missing?

steadramon commented 1 week ago

Sorry about this I think I've realised what the issue is - pin 2 is used for the inbuilt LED on the board, after digging out a v4 and soldering it up the same way, I noticed the problem.

Unless you have disabled/moved the onboard LED, use a different pin than pin 2. Disable ESPGeiger using the onboard LED output by using -D LED_SEND_RECEIVE=-1 in the environment definitions - the LED will still flash when the OLED is updated, though.