#ESP32 based G5 PFD and HSI
1 messages · Page 2 of 1
Done. Took another pass through it. Created an issue (#25) and a PR.
Today I am not at home, will have a look tomorrow
you really went all the way with this. All the shadings and all, I am just speechless 😻
Thanks for noticing that! Really happy with how it turned out
I was honestly wondering if you are trolling with the actual unit screenshot
I did some comments on the PR.
I think I will finish my review tomorrow.
And thanks for your effort 👍
responded in GH comments. thank you for the review!
I flashed my guition with this and oh boy is it gorgeous
I need to finish the write up and testing, especially the HSI. I’ve added a couple new device settings so you can control the bearing pointers without buttons on the device.
But my dev laptop needs to go into the shop again. Every six months like clockwork it starts to overheat. I’m sure it’s poor thermal compound used by dell, but it’s still under warranty so I’m torn between just fixing it myself and letting them take one more crack at it. I’ve ordered that ptc thermal pad from LTT, and if it gets here soon I’ll try that first.
The one thing I think I’m going to finally give up on is determining the CDI Scaling mode the unit is in (E.g. the “TERM” “DEP” “ENR” etc annunciated at the 2:00 position inside the HSI compass). I cannot find reliable simvars to tell me which phase of flight I’m in. I’ll just use “TERM” or “ENR” if not on an approach.
I even wrote an entire Simvar monitoring program that lists all the A, L, B, simvars and their current values to the screen real-time to hunt down anything I could use. I’ll publish that soon.
which mfproj / mcc should one use for dual config?
also looks like I have to bump maxclients in simconnect xml to have it all work, hmm
Not sure what this means...
I get zeros for some configs
And, just so you know, i have not finished testing the new modules yet!
I will try again, it could also be that I am just using a wrong config
Could be that it just doesn't work yet either 😉
yeah 🙂
I've tested modules on my dev machine so they're not completely broken
But not on my "production" machine yet
I am still trying to ponder the encoder stuff
Oh yeah, i haven't tested buttons/encoders at all
3 gpio is just enough for the encoder if one uses the back connector but then the power button is not there
My dev machine just has a bare Guition
the confg also makes MF UI super sluggy
maybe something @noble galleon to look into (trying the G5 AIO mfproj)
oh
Error 03/08/2026 16:59:52 ConfigItemExecutor.Execute(): Error during execution (Bank): ConfigErrorException_SetCustomDevice
Error 03/08/2026 16:59:52 ConfigItemExecutor.Execute(): Error during execution (Turn): ConfigErrorException_SetCustomDevice
Error 03/08/2026 16:59:52 ConfigItemExecutor.Execute(): Error during execution (Ball): ConfigErrorException_SetCustomDevice
Error 03/08/2026 16:59:52 ConfigItemExecutor.Execute(): Error during execution (Ball): ConfigErrorException_SetCustomDevice
Error 03/08/2026 16:59:52 ConfigItemExecutor.Execute(): Error during execution (Ball): ConfigErrorException_SetCustomDevice
that would explain it
but maybe the configs are not fully working, need to see, at least that has a lot of the things twice, not sure if that is intentional
oh wait it has preconditions based on device type
btw
the g5 shows 270 and 4kt
for wind
oh I updated weather and now g1000 shows 279 and 26kt, and the g5 shows 280 26kt
will keep an eye at this and see if there is some pattern
no wait
the thing is not updating, dang
controller mapping is annoying when you have two identical devices
but the config reads the AMBIENT WIND DIRECTION and shows that, so its sim then
hmm, there is a bit of an interesting situation with the HSI btw
if you have also a g1000 for example
it kinda should sync with the sim's CRS display
wait it was OBS mode in g1000
oh there is a separate GPS OBS VALUE
heh the unit is a bit surprised about that 🙂
so yeah, depending on the value of GPS OBS ACTIVE the hsi needs to follow either the GPS OBS VALUE or NAV OBS:n
man this is quite a state machine
Yeah, I need to republish the configs. There were a couple errors in the very original ones. This is the one: https://github.com/ccrawford/CC_G5/blob/main/MF/G5 ROOT CONFIG.mfproj you should give a try
I also agree about the double device config. I’ve had multiple second thoughts about combining the devices into one to support the “real-time swap from menu” feature.
It was the only way to support that, but I think I could just drop the feature and make the MF configuration a lot cleaner.
Oh that’s interesting. I wonder if I added a smoothing value I shouldn’t have.
it seems the hsi deviation bar and the arrow are drawn at a different time and the update lags
or yeah, the arrow might have smoothing
and the same smoothing is not used for the deviation part
Hope to get the dev machine back working soon!
I am vibing some python in #1447919735185604722
I'm considering switching back to two separate MobiFlight device setup. Currently, you can switch between HSI and PFD "on the fly". However supporting this makes it a little more difficult for people who don't have the buttons, and it greatly complicates the MobiFlight configuration, as you have to keep all variables populated for both devices to support the swap. I'm thinking the "cool" factor of this feature isn't worth the "PITA" factor of maintaining the configuration. Before I remove it and re-work the MF Configs, does anyone have any thoughts? @stray gazelle
yeah
I think it would be most popular if this becomes a very cheap and quite generic hardware instrument that is easily flashable and configurable. That being said, is there no easy way to make different definitions in MF that preconfigure the display for one trick and hide not needed parameters for that mode? So that there is one firmware, and three front end definitions for either mode or both? Maybe with multiple mcc files?
That’s what I’m thinking. I think I could just have one code base and three different build configurations (two stand alone builds and one switchable build.) I think if I just change the config file and create two new mfproj files that would do it. Cleaned up a lot of small bugs in the new layout yesterday. It’s looking good now and will have a new release soon.
hmm, so I am trying to understand how the mfproj and the device config works
I have this now
using the G5 ROOT PFD.mfproj
it shows up as hsi though
and I am pondering if I somehow fundamentally think this wrong way around
I'm working on the configs now. I just uploaded what I think is darn near complete on the firmware side.
Added a firmware installer as well at https://ccrawford.github.io/CC_G5/web-installer/
But i need to beef up the "after install" instructions. "COnfigure device in MobiFlight Connector after flashing" is doing a lot of heavy lifting.
Ok, so right now in the CC_GT/MF directory there are some mfproj files.
The current ones i'm messing with are G5 ROOT PFD.mfproj and G5 ROOT HSI.mfproj
With the latest firmware you should pick either PFD or HSI custom device in MF.
Then use the appropriate mfproj
The biggest snag i have right now are the CDI Scale labels, (TERM/ENR/LPV etc.) but I'm working on cleaning and simplifying those.
Actually...the pfd in the repo now has two projects in it. Once i get them all finalized i'll clean up that folder and get them named properly.
But should be close.
Ok, I've now updated the installer and it's working well. I fixed a core issue where setting up the first device worked really well, but if you wanted to delete one and change to another the virtual devices would get duplicated. If you see that in your config, best bet is to use the "erase device first" option on the web installer. https://ccrawford.github.io/CC_G5/web-installer/
I'm going to spend some time flying and fine-tuning the .mfproj files. They're still "good, not great"
Hmmm, I flashed with the web installer, and droppped the config files in the community folder. Screen stays black, and MF 11 only shows this....
Might be necessary to kill the efuse for the bootloader debug output?
Tried this: #1433279689878798336 message
Burning eFuses:
- 'UART_PRINT_CONTROL' (Set the default UART boot message output mode) 0b00 -> 0b11
Check all blocks for burn...
idx, BLOCK_NAME, Conclusion
[00] BLOCK0 is not empty
(written ): 0x0000000000000100000000000000d1f50000000000000000
(to write): 0x00000000000000c000000000000000000000000000000000
(coding scheme = NONE)
.
This is an irreversible operation!
Type 'BURN' (all capitals) to continue.
BURN
BURN BLOCK0 - OK (all write block bits are set)
Burn postponed eFuses from BLOCK0.
Reading updated eFuses...
Checking eFuses...
Successful.
However, still same result
python3 -m espefuse --chip esp32s3 --port COM5 summary
UART_PRINT_CONTROL (BLOCK0) Set the default UART boot message output mode = Disable R/W (0b11)
It's an issue with the overlap of PID/VID of the CH340 chip that is used on both the Mega and your display.
Let me find the full instructions.
Assuming you've installed MF into the default directory: Find this file: %USERPROFILE%\AppData\Local\MobiFlight\MobiFlight Connector\Boards\arduino_mega.board.json
On line 14, change this line:
"DtrEnable": true,
to
"DtrEnable": false,
That will fix it. HOWEVER, you have to update that line whenever MF updates itself. I have a issue raised with the main maintainers. I'll check in on it now.
Success, thanks!
👍
Nice! There's a mfproj in the repo for your MF install
What might be useful is a setting to set the vertical position top/center/bottom and users can hide the excess display. I thought about making a little console with displays sticking out from the top.
It's a variable in the code, i just haven't exposed it. I can add it to the list of things you can set in MF useful.
Maybe I should throw an always on garmin logo up in the top 40 px.
yeah the logo would work on top. could be just a logo.png that you convert at build time?
or a .h
Garmin might send their legal team after you... I know there are many projects that try to copy some Garmin hardware, but I don't think any of the bigger ones dare to claim they are reproducing Garmin hardware. So if any logo at all, MF would be better. But I would like to switch the logo off 🙂
G4RMIN
It is like there are copies for Specalized bike apparel, they are spelled SPECIAUZED
Reminds me of all the Wü accessories for Nintendo's 2007 console
the U looks like LI
That in turn reminds me of a very unfortunately labeled box of flickering lights
I would not put anything there that looks like an existing trademark, because trademark owners need to protect them legally, as far as I know.
Maybe make it a flag in the .ini to add 40 pixels tall logo graphic, and shift the display to bottom of the screen and we could have a default MOBIFLIGHT logo there in .h format, one could replace with another graphic exported from GIMP, using the "Export as C header" plug-in.
https://www.youtube.com/watch?v=pThSBrl3Bsk
has some good footage of the button / encoder functions.
I was searching for a G5 intro video to share with my clients. Garmin's look at the G5 in combination with the GFC500 autopilot but I was looking for one which is much more basic. I found this.
Thanks to Hodge Aviation Services in Concord, California for this simple into into the G5's basic layout and functions.
https://www.hodgeflightservices...
so I need to look into the encoders stuff still. @swift latch I have been thinking that I want to redesign the "piggypack" PCB a bit more, to add 4 solder pads to the pcb back side, so that we can solder a flat cable that goes into the relay connector, so we would get 3 more IO pins, and it would still be pretty clean design.
That would give us GPIO 1, 2 and 40 on the relay, and by luck GPIO 1 and 2 are also analog pins, if I found the right pinout on google.
so we could have:
SD card connector, 4 io pins:
- IO42 power button
- IO41, IO48 encoder A/B
- IO47 encoder push button
Relay header, 3 IO pins:
- IO1 - ambient light sensor?
- IO2
- IO40 - PWM for the backlight?
I think it would be quite clean setup, a click-on pcb to the sd card slot, and a small flat cable to push into the backside header.
We could also design a case that replaces the black protective board on top of the PCB and holds everything in place using the PCB mount screws.
Would it be possible to optionally support the on-board IO pins for this? I could of course also make a RP2040 board to fit in there but it is kind of waste when the IO pins do exist if I understood this right.
Oh yeah. I have a whole playlist of G5 videos. There are actually a lot out there. That was a good one. The thing is, there are multiple versions of the G5 code. It went through a decent update around 2022 that moved some information around, and different installations turn on-and-off different features as well. Early on I was totally confused when I'd code something, and then see a video with the field missing or in a different place! Even in the manuals they sometimes show old screen shots. I eventually settled on the version described in this edition of the manual: https://static.garmin.com/pumac/190-01112-12_j.pdf
After seeing your video last week I realized that you and I are working with differernt versions of the hardware. I have the ones without relays (flat back) and a 2x4 row header. I think you have the one with the protruding back case with relays and screw terminals.
I really like the idea of making the encoder/button easier to connect than the RP2040 as i2c device method.
I think we need 4 IO (encoder a/b/sw, power button). If a 5th is availabe, we could add a power LED, but that's not essential and/or could just be hard wired to vcc/ground.
I originally used the RP2040 because I didn't have an i2c io expander in my parts drawer, so i coded the rp to act as one. I think if we're making a custom board for this, just add a pcf8574 to the design.
(Dang it. just placed an AliExpress order. I should have gotten some of those.)
Same thing. The relay stuff is an external module that connects through that header, I believe
I loved the SD card idea, but i'm concerned it's going to be fragile/unreliable if the intent is to sell these in the store. I think using the 2x4 header with io1 and io2 for i2c and io40 for interrupt (so we're not polling) is going to be a more reliable solution. I like your idea of a custom back lid that could integrate with the buttons/connector. Maybe a custom board that would hold the pcf8574 and resistors and the encoder, then headers for wires to the power button/ring light and header?
hmm actually
since it is a custom firmware
it could likely do the encoder in the mux or expander too?
and I do agree the sd card is a cool hack but might be something that might oxidise or something later
i think it would make sense to stay inside the MF ecosystem and use components that are already supported
it is a custom device to begin with though
if we use the pin header we are down to 3 IO pins
those are robust to interface to
yeah. but that code is thouroughly tested
but if we screw the sd-card hack on a pcb that is exactly the right size and anchors to the frame
but yeah. it would be a motiviation to add encoder support to shifters
it should be quite firmly in place though
so maybe it would work
wait there was some other way of putting this, "eating our own dogshit" or how someone put it at work after a bit of a nasty debugging day
but hmm
so you are saying that none of the pins on the ESP32 are available anymore for hooking up stuff?
Ralf found a screen version with a pico2
we have 4 in the SD card connector
i meant really available... not hijacked
and 3 in the relay header
then some small 1.5mm pitch jst connectors that I would need to look up but they are likely wired to peripherals
see red text
most pins go to the screen
I wonder what that top right UART header is
speaker header compromises the relay, battery header is hardwired into a battery management IC. UART is shared with the CH340.
so none of those are usable, sadly
Same with the P2 debug header. Just have pins that are already used by other components
Maybe the three GPIOs of the touch panel could be repurposed, depends on how things are wired inside the LCD
two GPIOs, apparently they decided to just shunt the interrupt to ground
the 40-pin RGB connector just breaks the touch panel I2C stuff out to solder pads on the FPC
So today I use IO1, IO2, and IO40 from that header to connect to my RP2040 acting as an I2C slave. However right now I have the 2040 not just multiplexing the IO but managing the encoder. It sends the delta of the encoder changes since it was last updated, not just the pulses, if that makes sense. Basically I just use the interrupt line to signal to the ESP32 that there's data available and continue to accumulate the pulse changes on the rp2040 until they get picked up by the ESP32 at which time i reset it.
I use that one RP2040 to monitor both encoders+sw and both buttons on my PFD/HSI dual screen. Never had any issues.
There are so many "modes" for that encoder, realistically it's pulses have to be managed locally by the custom device, and not by MF. (the encoder could be changing any of a handful of values or it could be manipulating the menus).
yeah the modal UI makes it really hard to do that from the custom device messages
because you would have to break out all those preconditions into the MF config I guess
its a bit the same dilemma like what I would have to do if I would implement for example the stored frequencies or settings menus etc in the GNC255
because the firmware could do it, but then its the same situation, the knob does different things depending on where in the UI you are
like if you have the menu open, it does not adjust the frequency anymore
I guess you would need to have "outer knob" encoder device, but there is no way for MobiFlight to know if you are in settings menu or tuning the radio
ie, the dilemma you asked on the other channel
hmm
but yea this is actually quite specific topic related to custom devices and one limit is they are output only
there is no "custom input device" so that you could just send sim events from the code for example
you'd have to fake button events or such
@swift latch seems you committed some iomux things?
let me see if my tree is up to date
s_RGB.cpp:98:5: error: 'gpio_hal_iomux_func_sel' was not declared in this scope; did you mean 'gpio_hal_func_sel'?
98 | gpio_hal_iomux_func_sel(GPIO_PIN_MUX_REG[pin], PIN_FUNC_GPIO);
| ^~~~~~~~~~~~~~~~~~~~~~~
| gpio_hal_func_sel
*** [.pio\build\ccrawford_cc_g5_esp32s3\lib56b\LovyanGFX\lgfx\v1\platforms\esp32s3\Bus_RGB.cpp.o] Error 1
oof I thin my environment has some issues now
oh I think its some python issue, I downgraded my python for esphome which doesnt support the latest version or something
oh it was my environment
works now
I had a new idea for the screen + pcb mechanics
what if there was a smoked acrylic "glass" on top, 3mm thick, that has a cutout for a low profile encoder and button? Could we have it on top of the display?
I don't see why not.
that way it would maybe look like it is flush with the display
the screen would be a bit "sunken in" but might still work ok
My device kind of does act like an
This is my first (and last so far) attempt at an enclosure
it was done when i was using more of the screen
Now, I'd be tempted to make the bezels cover some of the dead space
Any my code does do "virtual input device" in that I send encoder and button messages for encoders that don't really exist. That way I can support using one encoder for course/heading/altitude/kohlsman depending on which menu item is active (just like the real G5)
yea, I am also rotating to (2) to test, when the usb is on bottom, the left side of screen margin is wider
and pondering offsets on where to place the image
in relation to the frame to get this thought out
My latest firmware has X_OFFSET and Y_OFFSET constants that my layout should respect, but I'll admit i haven't tested different values yet.
Correct. It's 0. But it's there!
so did one need to create a custom device? I am trying to remember how to do this new one
flash firmware, choose by custom device type what it is?
Now there are three devices in the file. One called PFD one called HSI and one that is just G5 (that should still be configurable, but I need to test that one!)
So, add a different custom device rather than fuss with the MF setting.
In general I don't think the ability to switch it with the menu was worth the gross complications and redundancies that were necessay with the MF config.
yea, I would assume most people just run one
I mean, to switch it on the fly is a feature in the unit of course
but yeah, maybe a lot of hassle for a very little thing in practice
there is an interesting edge case in the dual config I think @noble galleon
because
oh there was a glitch
but in this case
you probably should name your devices when you save the config
it is hard to know which is which and then stuff dont work if you map the HSI to PFD and vice versa, because the custom devices dont add up
also if I click "bind controllers" I dont get the dialog, need to do it form menu, hmm
so I need to look that C4 is attitude indicator
right side is way nicer now
maybe it would autobind if the names were unique
I dont want to make a PR because it would anyways screw up your serial numbers then
this needs a courtesy lens cloth 🙂
it looks very nice
Yes: You should set the name of the board at the same time you add the device. I can only give the board a single default name.
The biggest thing with the on-the-fly switching is that you have to have a complete MF config for both device types. So you end up sending a lot of data that the device will never use.
oh btw, there is this feature in the board.json:
I will test this out and will make a PR
this would allow us set a predefined name
the only problem I see is it looks like config upload suffers from this, that we have seen on many custom devices
@hard flint I wonder if you have an idea why this happens?
the upload works though
but it just fails when it reads it back I think
if I right click -> reload config it shows the arduino logo and doesnt show any devices, but works if I unplug and plug it back
I have that “failed to upload “ problem a lot on my community projects. I haven’t hunted down the issue yet. Sometimes you can just have the connector re-read and it’s ok.
Never knew this! I’ll take a look
we had that in the gnc255 too, maybe @hard flint has an idea what could cause it
it seems always in custom devices
Yeah, i've gotten too used to it not working to the point where i don't worry about it. I already have Ralf actively working on two other things for me right now. Not going to add a third 😉
the new thing in this one, is when I right click to "reload config" after the failed config upload, it shows up with the arduino icon, and requres unplugging to work again but oddly retains the name I gave it. The upload worked though but something messes up after the upload.
Not sure if this is some odd clue for @noble galleon regarding the recent "device shows up as compatible" case - maybe not, but this is new behavior that I have not seen before.
And does the screen go dark?
If so, it's the "dtr puts esp32 into firmware upload mode" issue. I've entered an issue on the github, and ralf is considering it.
The resolution is to change the mega-board.json dtrEnable setting to false. There are more detailed instructions on my github repo for the project.
hmm it might be but I think I edited the mega json
I need to check that
migth have been on my laptop where I did it because it was what I had at fsweekend
And, you'll need to re-edit after every MF update (like the one from yesterday)
actually let me just make a branch and a PR
the dtr to false didnt fix it unfortunately it seems, will test a bit more
the upload works though, you just need to unplug and plug back in
I had this issue in the past too. Can't remember what I did, even if I did something.
I think it's a timing issue, the board info is requested before the board has booted up, might be to a to long initializing of the custom device. It happens also if the board sends some status messages and the connector thinks it's the answer of the requested board info.
Changing the time in the board.json for connecting could help.
let me try
Oh sorry, too early this morning. I mean when the connector expects the successful upload message...
@stray gazelle @swift latch you could test the following:
- enable debug logging
- upload your config, it will show up like:
Debug 03/29/2026 10:52:49 MobiFlightModule.SaveConfig(): Uploading config part 8.0.1.1.Encoder:1.2.Button:7.39.16.2.LcdDisplay:
Debug 03/29/2026 10:52:49 MobiFlightModule.SaveConfig(): Uploading config part 11.28.10.Analog Input:7.38.20.4.LcdDisplay 1:
Debug 03/29/2026 10:52:49 MobiFlightModule.SaveConfig(): Uploading config part 16.0.6.7.8.15.2.LedModule:6.3.Servo:
Debug 03/29/2026 10:52:49 MobiFlightModule.SaveConfig(): Uploading config part 11.27.10.Analog Input 1:
Debug 03/29/2026 10:52:49 MobiFlightModule.SaveConfig(): Uploading config part 15.10.11.12.13.0.0.0.0.0.Stepper:
Debug 03/29/2026 10:52:49 MobiFlightModule.SaveConfig(): Uploading config part 12.14.15.9.4.InputShifter:3.16.Output:
Debug 03/29/2026 10:52:49 MobiFlightModule.SaveConfig(): Uploading config part 14.17.18.19.20.21.2.Multiplexer:
Debug 03/29/2026 10:52:49 MobiFlightModule.SaveConfig(): Saving config.
Debug 03/29/2026 10:52:50 MobiFlightModule.SaveConfig(): Config activated.```
* copy this to a text editor, delete all text from each row, add a `11,` before the config part and a `;` at the end. It should look like:
```11,8.0.1.1.Encoder:1.2.Button:7.39.16.2.LcdDisplay:;
11,11.28.10.Analog Input:7.38.20.4.LcdDisplay 1:;
11,16.0.6.7.8.15.2.LedModule:6.3.Servo:;
11,11.27.10.Analog Input 1:;
11,15.10.11.12.13.0.0.0.0.0.Stepper:;
11,12.14.15.9.4.InputShifter:3.16.Output:;
11,14.17.18.19.20.21.2.Multiplexer:;```
- now open a terminal session to this board (Connector must be closed!)
- type
9;and12;into the terminal (it's not shown up in terminal), the board reports it's info and config. - next type
13;, the config gets resettet - next copy each of your modified row, e.g.
11,8.0.1.1.Encoder:1.2.Button:7.39.16.2.LcdDisplay:;into the terminal - after each copied row the board responds with
5,48;(48 is length of the copied string). - at least type
14;and16;, this saves and activates the config.
The only messages you must see is like:
5,48;
5,93;
15,OK;
17,OK;```
No other messages must show up (I copied only rows, so for each row you will get a `5,xy;`)
If this is the case, it's most likely a timing issue. Loading and activating the config could take too much time so the message 17,OK; comes too late.
lets see
will test
this is the log so far
so it looks like timeout
I wonder what that one lowercase "s" is
but maybe its part of the device name, will try
the gnc255 has the same issue now hmm
I think it is if you only have one custom device and nothing more
seem to recall this from earlier
hm, but this is not reproduceable always, now it worked with the gnc255
hm, I get a crash in Connector when I try to rename the custom device
"index 0 is out of range" - maybe this is somehow related, But I will try with the terminal now
ok now we get somewhere
15,OK;
[ 59620][E][esp32-hal-ledc.c:206] ledcAttachChannel(): Pin 38 is already attache d to LEDC (channel 0, resolution 9)
[ 59630][E][esp32-hal-ledc.c:321] ledcAttach(): No free timers available for fre q=1200, resolution=9. To attach a new channel, use the same frequency and resolu tion as an already attached channel to share its timer.
E (59644) lcd_panel.io.i80: esp_lcd_new_i80_bus(173): no free i80 bus slot
Failed to allocate DMA-capable internal SRAM buffer!
so it is very chatty for a reason, it seems
at this point the board does not respond anymore until you reconnect (reboot)
that lowercase "s" is part of the custom device name
I think the problem might be that since the G5 custom device has no settings at all, Connector expects a pin to be defined, in addition to the device name, and that causes the index out of range segfault
just a theory but it is what is different to for example compared to the GNC255 custom device
@swift latch PR incoming for the stuff
for now there is no way to differentiate by the variant, only mobiflight device type, that is the same for both custom devices. Might not make sense to have two firmware binaries just for this.
Rather we should perhaps match for the default board name for custom icons, with fallback to board-logo.png but this is not implemented yet as far as I know.
Yes, a custom device needs at least one pin.
The connector can't handle a custom device without pin.
Hmhm, need to have a deeper look later on
But I am pretty sure that it's the reason for the failure message after uploading. Not really what the connector expects 😉
I thought that need for a dummy pin was fixed in the connector.
that message though looks like something that comes from tbe esp32 core framework maybe?
I’ll step through some of it this morning. I’m not sure what all that device upload stuff was doing in your config, Thomas.
(Autocorrect…apologies)
I think the resource stuff might be some pin allocation conflict in the firmware side?
not sure, everything seems to work though
this project is an interesting test case again btw
- no pins in custom device
- two different (well, three, if you count the combined) custom devices per MobiFlightType
- would be interesting to set unique icons for each board + custom device combination
- for autoload of profiles (planned later) there is a combined mfproj project file that spans both devices (though if we had auto-matching of configs, they could well be split into their own files and thus would show up in two tabs which would be actually even better)
Hmhm, not sure. Might be that I don't remember. Have to check the release notes for this...
I haven't found anything in the release notes that no pins defined for custom devices leads to an exception is fixed...
the way it crashes sounds exactly like it expects a pin to exist in the data structure
to my totally untrained eye 🙂
Tuomas, can you tell me what exactly is crashing? I'm not having any issues
Or, are you just trying to fix the error message after uploading device profile?
Also, i've never seen a screen like the one you link above with the thumbnails and the "Upload board's default config:" option. Is that a beta version i don't have?
Honestly, i'm doing so much shady stuff on this device with respect to configuration that I always blamed the errors on the firmware.
I have hooked the read and save functions to inject my pseudo devices back in the response, and to block the core firmware from seeing my pseudo devices when the connector tries to write them back when the HSI/PFD is removed from the board.
I use "virtual" pins >100 for these pseudo device, and the hooks filter those out before it hits the core firmware
shouldnt the config simply be stored on flash and read from there? there is a flag for that in the firmware
ah. ok.
Maybe i don't understand this scenario entirely
The device uses the encoder to do a lot of things: adjust menu and change different sim values depending on which menu is visible.
So, my firmware just sends the necessary cmdMessenger messages when it needs to. But the profile on the pc must know about those messages so they can be assigned in the connector.
@swift latch it is connector that crashes if I try to rename the custom device
because it only has a name
no pins defined
So you'll see that when you add a PFD device to the custom board, you get about five or six other devices when you reload. @stray gazelle i now see what you're saying about the lockup/dead screen when you first assign the PFD. Let me look at that
right now we only have three types of messages from the firmware to MF. Button, Encoder, AnalogInput event. You are saying that some of these events gotta make it to MobiFlight while other events are processed in your firmware directly.
@swift latch the "upload config" only shows if you have a matching board, and the board json has an entry for a mfmc file
oh wow. i didn't know about that afeature
yeah, checkout my PR branch and deploy
it should just work
and use the pattched mfproj also in the PR, it should match your devices even if you regenerate serials
that button shows up only if its configured for the board
Looking now
but there is that other pin allocation / dma message that comes on serial console when you upload a config
that is a different thing, and likely why Connector does not recognize the board after config upload
because it expects "config uploaded" reply and gets some other debug stuff
I see one of your mfmc has a pin def and the other doesn't. Should I add a dummy pin to both devices?
oh
if so, that is accidental
let me check
it might have a button that I tested, left over by accident
it doesnt have any here though, hmm
interesting, yeah
If the lack of a pin is causing an issue, i can add a dummy one easy enough
actually there is a discrepancy here
how did I manage to save that mfmc is a good question
I wonder if the firmware on one of these is from some older commit that created stuff differently?
Not quite. The board/device doesn't have enough GPIO for the user to add any other devices to the board. However there is a feature that I use (and I'm probably the only one!) that allows you to connect an i2c device to the screen and i use that i2c device to run the physical controls. The encoder on that i2c device is used to manipulate menus and change settings (like the heading bug or the CDI course heading or the altitude bug or the kohlsman setting). My firmware knows what menu is visible or not and sends the appropriate encoder message back to MF using raw cmdMessenger text.
I (and @dapper fjord ) have tried other strategies that are more in-line with what MF expects (i.e. swapping around the devices to make my i2c device the only thing that talks to MF and having it send the display commands to the screen) and that works for simple devices but for the G5 there's just way too much data and I was losing commands left and right. I took a half-hearted attempt at a queue, but eventualy reverted back to the scheme I use now where MF talks to the display device and I have my own button/encoder handlers.
Possibly? I make frequent use of:
python -m esptool --chip esp32s3 -p COM26 erase-flash
When i'm testing this
Tuomas and I are contemplating other ways to attach buttons and encoders to the screen. I'm like one pin short!
Unfortunately my display is still on its way, I wasn't able to try it... but you're saying the encoder messages that are sent to mobiflight, meaning the device name/id depend on the current context that the G5 is in?
if it is not hard to add a method to use local pins, I can try to figure out hardware options
there are 4 + 3 pins available
but like you said not exactly super robust or easy, but would work for a demo nicely
But only 3 that are broken out to a header pin
Four more could be soldered, or use Tuomas's SD card interface
yeah, but its also solderable on the sd card connector, its not impossibly small
but I think if I even want to try to make it more actual size I need 2 pieces of pcb
one sd card insert that has a pin header, and another that connects to the header pins on the back,
and then a wire to the front pcb with encoder, leds, button and photosensor 🙂
The encoder that's activated depends on the context. When you add the base PFD device, I inject the six btn and enc devices into the profile
it is doable but just needs a bit of CAD and head scratching
Then you can just add those as input devices in your .mfproj
@swift latch I dont ever see those encoders though, is it a matter of activating also the i2c stuff?
to "do the needful" as my indian friends say
oh wait
Correct. @stray gazelle
You will only get those messages in response to the physical controls
Of course, if you have other hardware that changes the current heading in the sim, the G5 gets it
The G5 always changes the pressure, target alt, track, etc in response to the sim, never the physical control
So a heading change (default use of the HSI encoder) follows this path: encoder->rp2040 (as i2c)->ESP32->G5 firmware->MF Connector->Sim->MF Connector->G5 firmware->Display
yeah, but you wouldnt access the other functions with the button unless it is a in-device handled encoder
although hmm
what if there was just a "encoder" and "button" event?
and power button event
in the custom device messages?
would that work?
or did you already try that?
If you want to write all the logic that would have to sync up the menu display and MF. Total non-starter
for me at least 🙂
I'm not
hold on, let me think
no I mean
if there was a custom device message type "encoder up"
and "encoder down" and "power button pressed" and "encoder button press"
would that work?
no idea of the performance
I'm recalling a convo we had on this about 1000 messages back
yeah hmm
Bottom line: My scheme works really well and is very maintainable in my firmware
and doesn't rely on the MF connector knowing what menu/screen/mode the G5 is in
very clean
yea and it would be a nightmare of sorts trying to sync the state to MF Connector side
For a generic "encoder" message to work MF would have to know what mode the screen is in. And only way it could do that would be to count button presses and encoder clicks which would be a nightmare
it is a matter of architecture here: do custom devices handle their state or not
Device controls its own state and the sim controls all the data.
and MF facilitates the communication between them
just like MF would say "heading bug in sim turned right"
oh, i see. I've not had good luck doing that @stray gazelle
I think of them as "virtual", but yes.
Basically, input devices that are divorced from pins on the device.
Certainly, and people do that today, right?
thats not what i referred to
the virtual pins make sense
but the context would be different
Yes, you can certainly have an encoder change the standby com or the standby nav radio
today
What I needed here was "an encoder that has no physical analog"
no. today. you could send the state by using analog inlut
analog input = 0 > HDG
ablog inout = 1 > QNH
Ah
and then you can decide on mobiflight side how to interpret the encoder event
your virtual encoder combines context with encoder event
I see now. Yes. Instead of sending 3 different virtual encoders i could send one with a mode switch.
or this together could also be modeled by a real custom input device.
simply sending a message type to mobiflight with some payload
I think my virtual encoder simplifies the MF programming, but that's just me
agree
it just could get out of sync
so the virtual encoders are more reliable
i think its ok.
hm are esp32 gpios differently named?
What do you mean?
I am trying to add just regular MF encoder to pins 48 and 41
on the sd connector pcb
is there a reason it should not work?
it works in the gnc255, just the LCD device is a custom device
electrically or MF?
and the buttons and encoders are regular encoders wired in gpio pins (its a RP2040) and added as regular devices in MF
I may not have all the pins properly config'ed in the board.json tbh. Those need attention
I've lost you
yeah. not going to work
the firmware does its own thing I guess?
For a while, i was filtering all the button and encoder assignments
I thought i took that code out
and replaced with the config hooks that now filter out where pin# > 100
but tbh i never tested to see if adding encoders works
maybe I will test your setup also
again
but that setup won't get you menus
you have to use my RP2040 i2c slave software and wire in as the device expects
to the pins on the back.
in the relay pins I guess?
I also still think playing with the Garmin RS232 message frames over espnow would be a worthwhile experiment at some point, and for that the state needs to be in the device
In the photo (and the firmware in the repo) i'm using one RP2040 to run 2 encoders, 4 buttons, 2 LEDs functioning as 2 different i2c slave devices
so it connects to both guition units' over i2c
right. Grounds to both, 5v from one
and that RP2040 obviously has no serial/USB connection to anything
yea
so it would not need an extra usb, which is nice
it could also be a esp32 supermini I guess
if there are enough pins
It might be able to be replaced with a simple i2c multiplexer, but i'd be just a tiny bit concerned about dropping encoder pulses given how busy that ESP32 is
I just have a lot of those rp2040s lying around, it fit, and they're like $2 each.
one option is to do a pcb for this that plugs to the back of one guition, hosts the pico and has a cable to the other relay header
or for a completely standalone unit of course could use two picos I guess
I think the whole thing could work cleanly with some headers and built cabling.
or even a pcb with headers for jst wiring or something. There's nothing tricky here, just point to point wiring.
An rp2040 is like $3 now, and two TCA9548 i2c multiplexer modules are about $2. I'd just do the RP.
or this
I got a few
the 26 and 27 are broken out, the i2c0 (20,21) is on the bottom solderpads but I guess they would work on any of those i2c0 pin pairs too?
this is a nice form factor
@stray gazelle @swift latch could you please shortly summarize how many pins on the ESP32 are available and how many LED's, buttons and encoders must be connected?
Yeah, those would be just fine
On the Guition 4" screen there are 3 pins (
There are three pins on the 8-pin header: io1, io2, io40. Very easily accessed and ready to be used.
yea though there are not enough pins on the pi zero I am afraid
The SD Card interface has 4 pins: 41, 42, 47, 48
the regular pi is filling quite much up
That need some small soldering skills
The device needs 1 encoder with push button. One power button. (4 pins total) would be nice to have a configurable LED pin for the ring light around the power button, but not essential, or could just be wired to power.
I think it has enough pins if we want to go that way
So, ideally 5 pins, but 4 for sure. 3 would be better than none.
we can do
- encoder with push, and power switch on the SD card slot
- backlight (ring light) led on the relay connector
- photocell on the relay connector
- one pin is free
so it can work, its just mechanical issue to solve
what I thought of in the sd card connector track, is to make a sd connector with pin header and another pcb on the back, that plugs to the relay pins and screws on the back
and then some wire to the button / encoder pcb in front
There are three buttons on the device, but none attached to gpio. There are other headers but they are for power/battery and UART breakout.
I do think the sd card socket is fine as long as we just secure it well in the design. If it is soldered on the backside PCB with pin socket + header, it likely will work ok
I will draw something
but I will also try this pico route
but I think the esp32 gpios are analog capable, at least those in the relay connector should be
I am noting this down here, its a nice way to visualize the prototyping board stuff too, because the pico has the pin labels on the bottom
actually the rp2040 zero mini board has way more pins that I thought 🙂 it should be fine
Just ordered some Picos to use that panel the intended way this weekend
The 8 pin header is the relay connector? 3 pins are fine for an InputShifter 😉
@swift latch what pin order in the 8 pin header?
Personally, while encoders on shifters are definitely a useful potential addition, I kind of like the idea of having a separate processor for encoder readout, particularly in the context of custom devices where the µC core might be heavily loaded by the display output
pin 1/2 = GND, pin 3 = GPIO40, pin 5 = GPIO2, pin 7 = GPIO1, pin 8 = +5V
yes, that is known
GND, +5V and the RX/TX lines are labeled on the board
https://github.com/ccrawford/CC_G5
It's also in the readme
and the pi side is spelled out in the slave repo's readme: https://github.com/ccrawford/CC_G5_Slave
For me, the 5v was the important one not to mistake! Didn't want to send 5v to a i2c gpio.
I could have done a better job labeling 1 2 3 there.
If we're doing this "for real" i would use a keyed header to prevent pluggin it in upside down.
erm
sorry
UnknownBoard: Unknown board ID 'generic'
keyboard is full of wires
missing platform I think, hold on
I nuked my platformio install since I changed my python version earlier I think
ok now it might build
automated build frameworks are great until they are not
I think the framework doesnt work on a new installation, copied the ini environment from the mf firmware RP pico section and now platformio installs a ton of stuff
and now it built
@swift latch care to share the .uf2 for the pico?
I just want to test it in action first
Sure. it hasn't changed for a long time. lemme find it
lovely mess
Let the display routine running on the 2nd core
I tried that. Killed my performance. Didn't try to debug, just reverted
Hmhm...
ok it works, I will do a proper quick pcb I think, I hate wiring 😄
especially these dupont wires
should get proper silicone ones
Note that I’m just now committing some changes to the menu drawing. Z order of a few elements were messed up after the big display refactor
Yeah, I love those small gauge, stranded silicon wires
I just found this on AliExpress: | (5 Colors Mix Kit)Heat Resistant Flexible Silicone Wire 30/28/26/24/22/20/18/16AWG Stranded Cable Electrical Tinned Copper Wires
https://a.aliexpress.com/_mO7ogvF
yea
you can also find silicone prototype wires
searching for "gold plated contacts" is not gold for sure, but rumor is, thicker metal pins
so they supposedly are holding better on the prototyping board holed
Ok. Just committed some fixes to the menu drawing and updated the binary in the web installer.
Gotta go get outside now!
@swift latch any feedback on the PR?
Haven't loaded it up yet. Where did we land on the pins issue?
not sure really
kinda two options, either the rp2040 approach for pcb, or native pins
I like the lifehack vibe of the microsd connector but then again it will need a pcb anyways, the rp2040 is kinda self contained thing, if on a back side pcb, we can then live with the 3 pins. Though, can we dim the led output along with backlight adjustment or is it already doing that?
Sorry. i meant on the "one of your mfmc's has a pin defined" No worries. I'll take a look and revise/review
Wow, didn't realize those features were there. I've made some adjustments and incorporated them into the main branch. (I suck at Git...please don't take this as me being dismissive of your work!)
Hey, one thing I've noticed, if i use these buttons (Website, Docs, Support) it looks like they go to a redirect on the mf.com site that breaks e.g. https://www.mobiflight.com/en/index/redirect/https://github.com/ccrawford/CC_G5.html
Am I not setting up these values properly?
"Project": "CC G5",
"Website": "https://github.com/ccrawford/CC_G5",
"Docs": "https://github.com/ccrawford/CC_G5/blob/main/README.md",
"Support": "https://github.com/ccrawford/CC_G5/issues"
}, ```
Or is there something broken on the mf.com site?
yea totally no worries
I find vscode git tab to be nice for git
yeah the redirect is currently broken, I noticed that too
Describe the bug The redirector in mobiflight.com does not work properly, perhaps due to site updates? Steps To Reproduce Steps to reproduce the behavior: click any of the 3 buttons: Browser opens ...
came accross this when I was making the PR
I hope you are ok with me butchering your photos for the logo 🙂
I also wish we could differentiate the device icons per installed custom device, but I guess we are a very very special case with this
Agree on the logos. I used your big logo and added an un-tilted one for the little board logo. I had no idea all that was possible! Is it documented somewhere I missed?
Ok, published new version to the web installer. I added a logo option as well, configurable from MF. Also updated the available pins on the device. I just noticed there are three more unused pins (35, 36, 37) the are right there, but would need fine soldering to the esp32s3 pins to break them out. Doable for a one off for sure.
I may try cutting the TX/RX/GND traces on the 8 pin header and running some wires.
Oh crap. Just remembered 35, 36, 37 are used for SPRAM communication on the ESP32 S3. Never mind.
Already fell for that trap. Hooray for OSPI, I guess.
Just had inputs configured for those and started wondering why I was not getting video anymore
I think its documented in the source code and existing examples
that stuff has grown kinda organically and "we'll do it more once the new UI is done"
There are a lot of obscure rules about what pins can be used for what
so did we have like 4 scenarios for the encoder and other peripherals?
- the rp2040 thingy via i2c on the relay header, do peripherals on RP2040, ESP32 drives it
- the sdcard connector + relay header, run encoder and photocell and led light on esp32, virtual encoders based on device state
- port expander on relay header to run all on esp32
- encoders and buttons on esp32 as regular MF devices, send encoder and button events as custom device messages back to ESP32, handle them based on device state
The IO is there but only 3 pins are readily available. 4 more on the SD card. Could either run jumpers from those pins to the 8-pin header, or perfect the SD card solution. I love that hack, but I'm concerned about it's longevity.
I am not sure if #4 is feasible, but it is a thought I had one day
I think the sd card hack works if the board AND the unit casing is anchored together well
I could give #4 one more chance. I think the buttons would be ok, but the encoder will feel bad.
Yeah. I mean you can always "click one more time" if a transition is lost, but if you're spinning the encoder to change heading and it's only inching along that would be irritating
one thought
if the "basic" stuff was handled so,
crap no, custom devices cannot communicate back
unless it fakes it
what I was thinking is
we do the menu nav etc via "G5 encoder right" and "G5 encoder left" events etc
and then the device sends virtual buttons as state flags
but it gets just weird easily but could work
so that if HDG-mode-button = 1
I think the coding on the MF Connector side would be a nightmare
we enable precondition to drive heading directly
yea it would add complexity
and there is that garmin messaging idea that I hope to try one day
These are all things i played with early on before the 2040 approach
so that these guitions could talk in a mesh if it would work
yeah
I can see how it could get hairy
this is how I anchored the pcb - would be good to have another screw on the other side of encoder too
Oh wow. That looks pretty solid though
and then it would need a back lid that screws on those guition case holes
Why not just use the stock lid?
Do you have tabs on the print to mae with the slots in the guition?
I mean hold a sec
(Just below your thumb in pic)
screws absolutely necessary
But your idea about a mating part that uses the existing screw slots is better
Much nicer than mine
But my pushbutton is only panel mount...i like it because it's close to the real thing
I'm going for a run. I'll think while im out
have fun!
then again, I dont know if it really matters that it is so tall - it might make the black bars on the screen stand out though
I think I lost the screws by now, but the screw holes are also flimsy as hell
Very much favor the idea of an over-frame to hold the screen in place
could also be used to conceal the asymmetry in the original bezel
my idea would be to have a back panel on the entire combo and use that to retain the screen, like the cross brace on cacrawf's design
@stray gazelle
I'm re-trying the "completely external, standard MF device to manage physical controls" approach. Tell me if this approach makes sense:
I have a standard, stand alone RP2040 with encoder+switch and another momentary switch. In the Controller I have the rp2040 devices set mobiflight variables and then I send the value of that variable to the G5. Button: no problem, as the state changes are there in press and release. Works well.
But the encoder I set my mfVariable to -5, -1, 1, or 5 (left/right, fast slow), but i need the variable to go back to 0 after the value is sent to the g5. I tried different ways to accomplish this, but nothing is working for me. As a result, i cannot send multiple encoder pulses to the device. I tried using preconditions but no luck.
Any brilliant ideas?
have a variable count the running total. Increase/decrease by 1 for slow turn, N for fast turn. Do the internal processing on the difference between an internal counter and the incoming signal
Well, the good news is this approach seems to work great. The bad news is I'm not sure why I resisted this approach when about three people recommended it earlier.
Only bad part is it needs another USB connection, but that's not the end of the world and infinitely preferrable to having to open up the device and solder.
So if anyone wants to design a case/mount/support, go for it. I need to clean up code and do some more testing.
Transmitting position changes since last reset is a rather common way of communicating encoder states. Professionally I work with ISO 11783-6, which uses that method, and I had suggested a similar interface to VKB when I requested a direct encoder API (that I later integrated in MF connector). I would assume that this was compatible with how their encoder states were handled internally already, since they maintain a queue of pulses.
As for USB connections, I was wondering. Your old approach with the I2C slave for the encoders - how much effort would it be to have that RPi also serve as a dual USB-to-UART adapter and bypass the CH340 on the Guitions? With the UART interface available on the relay header, it seems as if you might be able to avoid relying on having to squeeze an angled USB connector between the panels like that
Hmmm. That's an interesting idea. TX/RX and 5v, gnd are on that 8 pin header already. So, could do that without having to mod the Guition.
Not sure how well the CH340G is safe against being backdriven though, sadly the schematic does not seem to have resistors between the USB UART and the ESP and the headers
I'm concerned about power as well. I think i've measured the Guition at around 300ma so two on one USB power line would be way over.
240ma right now
I guess we could try using io1 and 2 as uart lines to side-step the ch340, but that would require surgery on the core mf Firmware.
But i think the power requirement is the real issue here. I think we're almost exactly at 500ma for two screens + rp2040
Some companies play rather fast and loose with USB power specs. On a self-powered hub, or if you have few devices plugged into your machine you can usually get away with more than the spec allows
can't you have the encoders in tbe guition itself?
and the button, on those free pins ?
or is it the difficulty of ports?
If we had encoders on input shifters that'd be it
except the led
For me? sure. But if it's just for me I'll stick with my i2c solution. I was trying to make it "plug and play" if you and Sebastian wanted to sell it in the store.
sounds hard to reconcile with the I2C slave angle - only way that seems feasible is if the RPi provides a third virtual serial port that then runs the MF I/O, and yeah, that seems like MF firmware surgery in action
Much cleaner to tell someone "if you want to mimic the rotary and power button on the devices, here's what you need to add to either a new or existing standard MF device.
I'm just saying: for me the project is done 🙂
If we want to make it more accessible, and doesn't require more than the usual MF soldering/assembly skills, this is a clean solution.
yeah I willl try the regular encoder on the SD slot, it just needs to accept the default devices on extra pins
Go for it!
yeah and you can easily do it so that you have a prototyping board and encoder and button
need to test if the encoder works on the piggyback board, I think it did t at o e pount
will test soon
In the code, the "G5Hardware" class is fairly well encapsulated. You could add hard-wired devices there very easily.
ok and the code would process them? that would be nicest for a PCB kit
And the code as it exsits right now works with either solution (i2c or MF signals)...no switches or compiler settings.
It doesn't work with directly conencted encoder/button now, but i think it would be trivial to add it. If you're just going to wire them up and add them via the connector as regular MF devices, that would work from a configuration/setup angle, but that's the approach that didn't work well with me.
The G5 hardware processes based on button state and encoder deltas.
You could either wire them in directly or try to round-trip them. It's that round trip that I had issues with when i tried initially, but maybe you'll have better luck.
I was dropping too many encoder pulses
but i honestly don't remember how hard i worked to fix that
Either way, i've set the actual pins available correctly in the board.json now. Oh, and I see that Ralf has a patch in for the dtrEnable=false waiting for Sebastian to approve which will make life a lot easier!
Sorry. That string of messages could be a bit confusing. What I'm trying to say is if you wired the physical controls directly to the Guition (either through the SD and header pins or via a multiplexer) you have two options then to hook them up to my G5 code:
- Treat them like normal MF devices and use the MF interface I just added, but use with a stand alone board.
- Handle them directly in the firmware, bypassing the Connector similar to the way I process i2c buttons/encoders today. This would require mods to the firmware, but I believe would have better results and fewer dropped encoder pulses.
you said it worked ok when separate Arduino had the encoder and passed the events to the custom device though?
Correct.
I'm worried about the G5 that is doing all the heavy lifting on the display dropping encoder pulses
seen it in the past when the core firmware doesn't get enough time
and believe that's what was happening to me early in the project. (I started this about a year ago, so my memory of what i was doing then is hazy. I originally had the RP2040 acting as the MF front end and the display as the slave.
@swift latch so did you already commit the "regular encoder anywhere in MF" variant?
could try that out with the encoders on the sd connector and see how it is in practice
but yea it might be a system load issue
so does the encEncoderState stuff work in the code yet?
sorry my questions but I am not sure 🙂
Doesn't the ESP32 have an internal pulse counter so that you don't have to keep track with software? Or is that a problem with the available pins?
had not, just did. Note the PFD .mfproj has the new items, the HSI does not. I have not included the RP2040 .mfmc but probably should. In fact, i'
ll add that now
I would think that's a function of the Encoder library you choose, unless there's some cool function in the ESP32 i don't know about.
Ok, uploaded to repo. Did not rebuild web installer as i haven't really tested this fully yet. Included a mfmc for the RP2040 in the community directory
This example uses a library rotary_encoder.h to use the pulse counter:
https://esp32tutorials.com/esp32-pulse-counter-pcnt-esp-idf-rotary-encoder/
Well thank you! I wasn't aware of this.
oh yeah the new "rp2040" hardware events seem to work great
heading increments by 2 though, need to look into that, but it seems otherwise great
oh heading knob config is twice there, disabled one and it works
@swift latch thank you for all the work, this works great - now I need to figure out why it doesnt work if I add the encoders to the guition itself
"heading knob config is twice there"
Where do you see it 2x? In the .mfproj or the .mfmc? I only see 1x in either.
At least that's what I thought I saved to the repo.
should be one input from the rp2040 and one output to the ESP32 for each control.
the pfd config
Yeah, havent' even built an HSI one yet. (but it will look similar)
Ahhhhh
Yep. Bug. Thanks.
(Oh, and remember: if you're on the menu, pick "heading" and twist the knob, the heading value you see will only change if MF is running and connected to the sim!)
(because the knob changes the value in the sim, and the display gets it's value from the sim)
yeah
hm, the firmware defines config in flash = 1
so that means I should be able to add the encoder and buttons with MF?
and uploading the config? or does it mean I need to hardcode it in the .h file?
no wait exactly the other way
reading the customdeviceconfig.h now
Honest, i've never tried adding.
You're in uncharted waters
And, since you just cloned my repo, you may not even see the hooks i put in there.
oh wait these are the virtual encoders
Those, honestly, could be stale. I tried so many different ways to get this working I may not have cleaned up after dead-ends.
Also, in my local repo here on my dev machine i'm using Ralf's to-be-deployed memory management routines.
(allocateMem.cpp)
yea
no worries
(Wife wants to go get dinner---gotta run)
Yes, despite the extra USB, I think if the objective is to sell these screens as a G5 (or ISIS or SFD) in the store, then the no-solder/just works solution is the best.
yea
I tested the encoders on esp32, they work if no custom device is present,
or also if I add them first and then the custom device
but if I run the thing at the same time the display goes wild when I rotate the encoder
not sure if its some memory corruption or just lack of processing cycles, but it puts weird data on the display, so I suspect its something else than just lack of processing cycles
like I had numbers in the autopilot mode display at some point
but I will see if I get a photo / video
I wonder if the second core could process the encoders but it might of course be the overhead of running two cores can cause slowdown.
I also tested the "use second core" definition after you mentioned not having tested it lately and the unit works but it is clearly slower indeed
Ok, last update for a while. Web installer updated. New .mfproj (cleaned, corrected, incorporates new independent hardware controller). New Community folder with Tuomas's changes and the new controller messages. I need to get back to my JPI engine monitor before my internal memory cache expires on it! And traveling in Europe next week.
i understand only half of what you guys are talking 🤣 but on the bright side: my display arrived yesterday.
Oh yeah, my one arrived also yesterday. The one with RP2350 is scheduled for beginning of next week 😉
You should be able to use the web installer to get the firmware on it (esp32 not supported by avrdude install), links to the Community zip and mfproj linked from the install page. https://ccrawford.github.io/CC_G5/web-installer/
You can now use any generic MF device with an encoder and button to control the menus.
@swift latch I just had a rough look into your code.
In get_version.py line 21, core_firmware_version = "2.5.1" must be set to 3.0.0! Otherwise outputs will not work.
My ESP32 branch is always based on the latest main branch from the FW repo, and there was a change addressing outputs from 2.5.1 to 3.0.0
So your board reports the version 2.5.1 but requires the commands from 3.0.0.
Thank you. I will admit, all of the version numbering confuses the (stuff) out of me. I would love to add a definitive guide to it in that developer documentation I did a while ago.
What errors should I expect to see from that mis-match?
Totally happy to change it, but would like to understand it as well!
"Requires the commands from 3.0.0" are those commands from the MF Connector or from the core MF Firmware?
the output does not work
up to 2.5.1 the pin number was part of the message, from 3.0.0 the x.th output device is send like for all other output devices
and the pin number is now saved in the class
So am i not seeing issues because i don't use any pins? But that doesn't seem right. It seems like my code works?
Or is it because all the other code i'm using to build the device is also 2.5.1? I'm confused. Sorry.
As long as no outputs are used it doesn't care.
If outputs are used, they will not be set to the required status.
Up to 2.5.1 the command was: set pin number 4 to H
Assuming this output is the first configured output, the new command with 3.0.0 is: set the first configured output, which is 0, to H. FW version 2.5.1 interprets this as setting pin number 0 to H.
Only outputs, not encoders or other devices
oh right
I am still a bit confused, since the encoders and buttons work great without the custom device present.
But when I add the custom device for the display, they stop working.
this is with the "piggyback" pcb
curiously if I do it so that the custom device is added first (I need to adjust the mfmc to move the custom device blog before the encoder and button devices) it flashes ok and it works but the encoder is not being updated well - I wonder if it is just cpu being too limited, but the buttons do work
there is also ESP32Encoder lib that uses interrupts, hm
I believe the custom device takes too much time. Encoders must be read best every 1ms, but at least every 3ms so far I have tested it.
Using interrupts could be a solution. I have a branch where I tested it, but as far as I remember only for AVR's and Pico.
yeah
I get like a sporadic input from encoder but its just one here and there
it uses the esp32 pulse counter
just pondering whether it is worth it ot not, and if I should just ditch the piggyback pcb and do a simple encoder + button pcb separately
dont mind my notes 😄
dang, I think I have a plan
not ideal, but for a demo unit at least
those are conveniently close to the edge
so cut them there so the header can be repurposed for USB for the esp32
I will need to solder jumpers from the ch340C to the header but it is not super difficult
so I can get rid of the usb connector on the side
will see if that helps or if it is just easier to do with a angled connector
sorry this is pretty chaotic, I am just making notes here (maybe I should just start my own thread on this)
I'd personally look into putting the USB-serial off board. Might still require severing traces though
yeah I am thinking of re-routing it to the eight pin header Rx and tx pins
so I could do a PCB that hooks to the header for both USB and i2c
and then has the encoder , buttons, and led backlight
and connects with the small screw holes
nice design excercise
it would also have a rp2040 zero
it might work nicely
Just did some investigations on the Guition screen, and can confirm that the UART RX pin is driven quite strongly by the CH340 even without USB connected
I have no idea why they decided to put the UART signals on three different headers considering nothing can actually drive them without horrifically abusing at least one of the chips
I feel like those pins would be infinitely more useful with some resistores between the CH340 and the rest of the board
@swift latch https://photos.app.goo.gl/RXnnQm4FSWfHXJSw6
went to the garmin booth at friedrichshafen
some shaky video of me feeling the buttons and encoders
Whenever I go up in friends' planes and we're in cruise, I always ask if it's ok if i mess with the avionics. Then they laugh at me when I start gushing over how good the buttons and encoders feel.
I think that's how i have my buttons wired up: Click of the power button brings up brightness that is then controlled with the encoder.
I don't have the setting for the photo-resistor (nor the photoresistor at all!) Would be easy, but hasn't been a priority