Skip to content

Board/heltec wifi lora 32 v3 #74

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

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

Conversation

fabys77
Copy link

@fabys77 fabys77 commented Mar 31, 2025

This pull request add support for heltec wifi lora 32 v3 borad who doesn't have classic bluetooth but BLE only module.

check_tool = cppcheck
check_flags =
cppcheck: --suppress=*:*.pio\* --inline-suppr -DCPPCHECK
check_skip_packages = yes

[env:esp32dev_sx126x_modem]
lib_ignore =
NimBLE-Arduino
Copy link
Owner

@sh123 sh123 Mar 31, 2025

Choose a reason for hiding this comment

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

Maybe it makes sense to switch all project to NimBLEDevice library instead of having lots of ifdefs?

Copy link
Author

Choose a reason for hiding this comment

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

That's yor choice. If you won't support old mobile devices who does't support BLE, it has sense. Take in account that codec2_talkie app work on android 11 until v1.71, it means that old phone with no BLE (and probably with android < 11) can't run app.
I think that support of Android 11 (last version with kenel 3.10 than is possible to find custom rom) is important to re-use old phones for HAM-radio purpose (sorry for OT).

Copy link
Owner

@sh123 sh123 Apr 1, 2025

Choose a reason for hiding this comment

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

Codec2 talkie should run since Android 7.0 (API 24 or higher), target SDK is not the same as minimum supported version, if you are getting "App is not installed" error you need to uninstall previous version before installing new one.

Copy link
Author

Choose a reason for hiding this comment

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

Ok, I've uninstalled previous, installed new -> App is not installed, I've tried again -> App installed. It's a strange behavior.

Copy link
Owner

@sh123 sh123 Apr 20, 2025

Choose a reason for hiding this comment

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

I started publishing release binaries built from Android git workflow, they are signed with different set of keys from some point and built on github machines, also previously there was debug version, it also might cause this issue. In this case installation over previous version is not possible and need to uninstall previous version first. Installing next versions after uninstall-install should work without uninstall.

#define CFG_LORA_PIN_B 14 // (sx127x - dio1, sx126x/sx128x - busy)
#define CFG_LORA_PIN_RXEN 32 // (sx127x - unused, sx126x - RXEN pin number)
#define CFG_LORA_PIN_TXEN 33 // (sx127x - unused, sx126x - TXEN pin number)
#ifdef WIFI_LoRa_32_V3
Copy link
Owner

@sh123 sh123 Mar 31, 2025

Choose a reason for hiding this comment

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

I would refactor to pass all device specific configuration parameters from platformio.ini to avoid ifdefs, it could easily become a mess in the future when will need to add more boards.

Copy link
Author

Choose a reason for hiding this comment

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

Good Idea! I won't to break your project with my PR.

Copy link
Owner

@sh123 sh123 Apr 20, 2025

Choose a reason for hiding this comment

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

Yes, so no need to add #ifdef WIFI_LoRa_32_V3, instead just pass required board specific defines through platformio.ini and for default values add #ifndef check, so they will be set to default values if not passed from outside, for example

#ifndef CFG_LORA_PIN_B
#define CFG_LORA_PIN_B    14 
#endif

This way if new board will be added there won't be any need to add additonal if blocks, but rather define different set of pinouts in platformio.ini.

Copy link
Author

Choose a reason for hiding this comment

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

Ok, I will fix on next commit, I want to see your "small refactoring" commit before. During these bank holidays I've spent time to performed tests with 2 devices (heltec wireless stick lite v3) and 2 phones (android 11 and android 15) and with my last commit on my branch it works!
Do you have seen this project: https://github.com/nakhonthai/ESP32APRS_LoRa
This firmware is similar to yours ant it has a lot of features (save setup on flash, web interface, modem/gate runtime setup) and supports many board .. adding KISS command Extensions and BLE (I've to check..seems support only classic BT) it should be used with codec2talkie. What you think about?

Copy link
Owner

Choose a reason for hiding this comment

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

If there will be other compatible true KISS AX.25 APRS lora devices usable with codec2talkie or aprsdroid or perhaps linux ax25 tools it will be really nice. In this project I'm focusing on headless modem without controls, which is usable with the phone. Having separate device with controls is nice, too, but GUI and controls are limited.

Copy link
Owner

@sh123 sh123 Apr 24, 2025

Choose a reason for hiding this comment

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

And about "small refactoring", there is no much to do, you can just augment variables, which are passed from platform io with #ifndef, block, so that they will not be set to default values if passed from outside for your board and that's it, this way it will be possible to add new boards without code modification, but purely from platformio.ini file. When it is there, I'll just click "merge" and that's it.

ESP32 BLE Arduino
BluetoothSerial
board = heltec_wifi_lora_32_V3
board_build.f_cpu = 240000000L
Copy link
Owner

@sh123 sh123 Apr 20, 2025

Choose a reason for hiding this comment

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

This could be set to 80MHz for lower power consumption 240 MHz is not needed here for the modem mode or just do not set it so it will use default one which is already set to 80MHz.

-D CFG_IS_CLIENT_MODE=true
-D USE_SX126X
-D CFG_BT_USE_BLE=true
-D USE_NIMBLE
Copy link
Owner

@sh123 sh123 Apr 20, 2025

Choose a reason for hiding this comment

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

You can pass pinouts here so it will be possible to avoid #ifdef in config.h, but in this case need to add #ifndef block for pinout definition, so default ones will be defined only if not already defined.

@@ -90,7 +112,7 @@

// Bluetooth
#define CFG_BT_NAME "loraprs" // set to empty to disable Bluetooth
#define CFG_BT_USE_BLE false // set to true to use bluetooth low energy (for ios devices)
#define CFG_BT_USE_BLE true // set to true to use bluetooth low energy (for ios devices)
Copy link
Owner

@sh123 sh123 Apr 20, 2025

Choose a reason for hiding this comment

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

This could also be passed from platfromio.ini, but here it needs to be defined as

#ifndef CFG_BT_USE_BLE
#define CFG_BT_USE_BLE false
#endif

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.

2 participants