gereic / GXAirCom

Multifunctional, compatible DIY aviation proximity awareness, variometer and messaging system with FANET+, FLARM and OGN support.
122 stars 39 forks source link

Build from source documentation ? to play around with AXP2101 vs AXP192 #130

Closed jccricket closed 1 year ago

jccricket commented 1 year ago

Hello,

I have AXP2101 and I would like to adapt code (in the board detection part - and other places where it code should be changed). I was wondering if there are some existing documentation about "build from source" so I can play around.

Thank you.

(the issue I'm facing is mainly related to power management (battery icon being empty, apparently not charging battery when plugged in. I'm using a T-Beam v1.1 that has sx1276 but detected as 1262 by the GXAirCcom code - as per logs - and this sx1276 has AXP2101 v1.2 where apparently most of sx1276 has AXP192. Mine looks recent: 20230508 is written on the board next to the antenna)

bzed commented 1 year ago

sx1276 is a lora transciever, AXP192 and others are power management related. sx1276 is basically an sx1262 chip with some additional functions.

So I can't see an issue there...

The project is using platformio, I would suggest visual studio code as editor, but everything else should just work well, too.

jccricket commented 1 year ago

AXP192 and AXP2101 do not share the same SLAVE_ADDRESS https://github.com/gereic/GXAirCom/blob/master/lib/AXP202X_Library/src/axp20x.h#L64 and line 65

Therefore, I suspect in main.cpp if (!axp.begin(i2cOLED, AXP192_SLAVE_ADDRESS)){ to fail... see https://github.com/gereic/GXAirCom/blob/master/src/main.cpp#L1375

I will look at visual studio and platformio. I don't know what platformio is honnestly. I used to code when I was a kid at school. I am no more into it, and this project just reactivated some willingness to code again :)

bzed commented 1 year ago

https://platformio.org/install/ide?install=vscode There is also the documentation for platformio on that page.

Which board are you using?

jccricket commented 1 year ago

I am using a T-Beam v1.1 from date 20230508 which comes with AXP2101 v1.2 (and not AXP192)

I will play around and come back here with my findings. Most probably, I'll rework the setupAXP192() function which I'll name differently, and also do some cleanup around checkLoraChip() which is included inside checkBoardType() All of this has probably been introduced after each other, but looking at it from fresh eyes, it is a bit strange in terms of logic (and a bit hard to follow at first look)

Plus, I don't really get why all settings are coming from https://github.com/gereic/GXAirCom/blob/master/src/fileOps.cpp when AXP192 is coming from "status" variable. AXP is there or not there. It cannot change in the middle of the execution, can it ? see https://github.com/gereic/GXAirCom/blob/master/src/main.cpp#L1607

And don't take me wrong, I'm super happy all of this exist and I already managed to send FLARM messages over LoRa. I just want to understand more and potentially give some help/support to improve with this AXP2101 (if I manage to ! Which is not guaranteed, ahah)

bzed commented 1 year ago

I am using a T-Beam v1.1 from date 20230508 which comes with AXP2101 v1.2 (and not AXP192)

They have the same slave address and share a lot of the same code, not sure if thats actually the issue you are seeing :)

jccricket commented 1 year ago

I am super new into this, but when ready this (https://github.com/gereic/GXAirCom/blob/master/lib/AXP202X_Library/src/axp20x.h):

define AXP202_SLAVE_ADDRESS (0x35)

define AXP192_SLAVE_ADDRESS (0x34)

I have the feeling they do not share the same...

jccricket commented 1 year ago

[I][main.cpp:598] checkBoardType(): AXP192 found [I][main.cpp:552] checkLoraChip(): Lora-Chip SX1262 found --> Board is a T-Beam with SX1262 [I][main.cpp:605] checkBoardType(): OLED found [I][main.cpp:607] checkBoardType(): Board is T-Beam V1.0 or V1.1 [I][fileOps.cpp:162] write_configFile(): WRITE CONFIG FILE ets Jul 29 2019 12:21:46 rst:0xc (SW_CPU_RESET),boot:0x12 (SPI_FAST_FLASH_BOOT) configsip: 0, SPIWP:0xee clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00 mode:DIO, clock div:2 load:0x3fff0018,len:4 load:0x3fff001c,len:1044 load:0x40078000,len:8896 load:0x40080400,len:5828 entry 0x400806ac [I][FanetLora.cpp:84] setGPS(): disable GPS PPS [I][main.cpp:1823] setup(): SDK-Version=v3.3.5-1-g85c43024c [I][main.cpp:1824] setup(): CPU-Speed=240MHz [I][main.cpp:1825] setup(): XTAL-Freq=40MHz [I][main.cpp:1826] setup(): APB-Freq=80000000Hz [I][main.cpp:1827] setup(): Total heap: 226788 [I][main.cpp:1828] setup(): Free heap: 199700 [I][main.cpp:1838] setup(): Total PSRAM: 4194252 [I][main.cpp:1839] setup(): Free PSRAM: 4194252 [I][main.cpp:743] printChipInfo(): This is ESP32 chip with 2 CPU cores, WiFi/BT/BLE, [I][main.cpp:744] printChipInfo(): silicon revision 3, [I][main.cpp:746] printChipInfo(): 4MB external flash [I][main.cpp:1846] setup(): compiled at Jun 25 2023 20:38:45 [I][main.cpp:1847] setup(): current free heap: 4387560, minimum ever free heap: 4382528 [I][main.cpp:1715] print_wakeup_reason(): wakeup undefined --> possible by reset [I][main.cpp:1857] setup(): SPIFFS total=173441 used=32128 free=141313 [I][fileOps.cpp:6] load_configFile(): LOAD CONFIG FILE [E][Preferences.cpp:492] getBytesLength(): nvs_get_blob len fail: WDANEOADSVDIVR1 NOT_FOUND [E][Preferences.cpp:492] getBytesLength(): nvs_get_blob len fail: WDANEOADSVDIVR2 NOT_FOUND [I][main.cpp:1867] setup(): set CPU-Speed to 240MHz [I][main.cpp:1602] printSettings(): SETTINGS v5.3.5 build:Jun 25 2023 20:38:45 ** [I][main.cpp:1603] printSettings(): Access-point password=12345678 [I][main.cpp:1604] printSettings(): Board-Type=5 [I][main.cpp:1605] printSettings(): Display-Type=1 [I][main.cpp:1606] printSettings(): Display-Rotation=0 [I][main.cpp:1607] printSettings(): AXP192=0

AXP found at the beginning, but finally AXP192=0 again !

Maybe this is not my issue. But nevertheless there is something that I would dig into since I do not like seeing this in my console...

jccricket commented 1 year ago

Just to come back to the initial question about how to build from source documentation:

I have managed to achieve my goal: copy_file([".pio/build/psRam/firmware.bin"], [".pio/build/psRam/firmware.elf"]) Copying file output to project directory... firmware.bin psRam build v5.3.5 **** copy file .pio/build/psRam/firmware.bin to bin/firmware_v5.3.5_psRam.bin *** Done. =============================================================================== [SUCCESS] Took 30.20 seconds ===============================================================================

Environment Status Duration


psRam SUCCESS 00:00:30.203

Here are the steps I have followed for those who are interested:

  1. install visual studio code ($sudo snap install code --classic)
  2. install platformio plugin (https://docs.platformio.org/en/latest/integration/ide/vscode.html#ide-vscode)
  3. fork this github project into my github space
  4. create a branch
  5. open a git project from visual studio code (in platformio plugin in visual studio code, there is a quick access drop down, in which I've found Miscellaneous/Clone Git PRoject)
  6. move to the branch I created
  7. went to project task, and run the build for psRam profile 8 done, compiled with many (29) warning, but compiled
jccricket commented 1 year ago

Just adding this here for reference for those who will come and see: https://github.com/lewisxhe/XPowersLib

mooiweertje commented 7 months ago

Hi, Is there a downloadable firmware for the 1.2 board? The ones in the repository all don't work on my board.