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

Boot issue fix of Cardkb on ESP32 #3933

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

HarukiToreda
Copy link
Contributor

@HarukiToreda HarukiToreda commented May 19, 2024

I was able to fix the issue and tested it on Heltec V3, Wireless Stick Lite and Tdeck, no boot issues and keyboard works with no problems. This is regarding the issue #3749

@todd-herbert
Copy link
Contributor

I see that the KbI2CBase class is set-up to run in the background. I wonder if it would be a good idea (or even possible at all?) to perform this delayed I2C scan from its runOnce() method? That way, the main boot sequence won't delay while waiting for the CardKB.

@HarukiToreda
Copy link
Contributor Author

I see that the KbI2CBase class is set-up to run in the background. I wonder if it would be a good idea (or even possible at all?) to perform this delayed I2C scan from its runOnce() method? That way, the main boot sequence won't delay while waiting for the CardKB.

I did try but it the re-scan happens so fast that same problem, and I can't use delays cause it affects the serial boot. I was only able to make it work this way.

@thebentern
Copy link
Contributor

thebentern commented May 19, 2024

I did try but it the re-scan happens so fast that same problem, and I can't use delays cause it affects the serial boot. I was only able to make it work this way.

You could potentially run setIntervalFromNow() to delay the thread. Some modules like NodeInfoModule do this to delay initialization

@caveman99
Copy link
Sponsor Member

@HarukiToreda @thebentern can someone please test that ? i am currently out of cardkb. but copilot said this should absolutely work, no questions there! :-)

@@ -163,6 +163,10 @@ void ScanI2CTwoWire::scanPort(I2CPort port)
#endif

for (addr.address = 1; addr.address < 127; addr.address++) {
// Skip the address if it is not requested oon a partial scan
if (sizeof(address) > 0 && addr.address != *address) {
Copy link
Sponsor Member

@caveman99 caveman99 May 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i susupect this is wrong though. need an 'in_array' type of comparison

@HarukiToreda
Copy link
Contributor Author

HarukiToreda commented May 19, 2024

@HarukiToreda @thebentern can someone please test that ? i am currently out of cardkb. but copilot said this should absolutely work, no questions there! :-)

It works but I think something may have broken on the BME680 Sensor. It's disabling after detected. [EnvironmentTelemetryModule]

DEBUG | ??:??:?? 11 [Screen] Finished building frames. numframes: 7
INFO | ??:??:?? 15 [EnvironmentTelemetryModule] Environment Telemetry: Initializing
ERROR | ??:??:?? 15 [EnvironmentTelemetryModule] setConfig BSEC2 code: -34
INFO | ??:??:?? 15 [EnvironmentTelemetryModule] BME680 state read from /prefs/bsec.dat.
WARN | ??:??:?? 15 [EnvironmentTelemetryModule] updateSubscription BSEC2 code: 14
INFO | ??:??:?? 15 [EnvironmentTelemetryModule] Init sensor: BME680 with the BSEC Library version 2.5.0.2
DEBUG | ??:??:?? 15 [EnvironmentTelemetryModule] BME680Sensor::runOnce: bme680.status 14
WARN | ??:??:?? 15 [EnvironmentTelemetryModule] Could not connect to detected BME680 sensor.
Removing from nodeTelemetrySensorsMap.
DEBUG | ??:??:?? 25 [Power] Battery: usbPower=1, isCharging=1, batMv=4231, batPct=100
INFO | ??:??:?? 35 [NodeInfoModule] Sending our nodeinfo to mesh (wantReplies=1)`

@HarukiToreda
Copy link
Contributor Author

@HarukiToreda @thebentern can someone please test that ? i am currently out of cardkb. but copilot said this should absolutely work, no questions there! :-)

It works but I think something may have broken on the BME680 Sensor. It's disabling after detected. [EnvironmentTelemetryModule]

DEBUG | ??:??:?? 11 [Screen] Finished building frames. numframes: 7 INFO | ??:??:?? 15 [EnvironmentTelemetryModule] Environment Telemetry: Initializing ERROR | ??:??:?? 15 [EnvironmentTelemetryModule] setConfig BSEC2 code: -34 INFO | ??:??:?? 15 [EnvironmentTelemetryModule] BME680 state read from /prefs/bsec.dat. WARN | ??:??:?? 15 [EnvironmentTelemetryModule] updateSubscription BSEC2 code: 14 INFO | ??:??:?? 15 [EnvironmentTelemetryModule] Init sensor: BME680 with the BSEC Library version 2.5.0.2 DEBUG | ??:??:?? 15 [EnvironmentTelemetryModule] BME680Sensor::runOnce: bme680.status 14 WARN | ??:??:?? 15 [EnvironmentTelemetryModule] Could not connect to detected BME680 sensor. Removing from nodeTelemetrySensorsMap. DEBUG | ??:??:?? 25 [Power] Battery: usbPower=1, isCharging=1, batMv=4231, batPct=100 INFO | ??:??:?? 35 [NodeInfoModule] Sending our nodeinfo to mesh (wantReplies=1)`

nevermind, this is an unrelated issue. mentioned on in 3938. The keyboard works fine

@HarukiToreda
Copy link
Contributor Author

could someone else please test. It works for me for both Wireless Stick Lite and Heltec V3

Copy link
Sponsor Member

@caveman99 caveman99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I rewrote parts of the scanner to just scan for ID's specified. Somehow you reverted my deletes of your code, and now it's doing both approaches at the same time.

My idea was to scan during cardKB init again if the cardkb was net detected before, not do it 10 times at the end of main.cpp ...

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

Successfully merging this pull request may close these issues.

None yet

4 participants