Open tlhagan opened 1 week ago
@tlhagan Thank you for stepping up to help. A couple of suggestions...
This would be best added as its own separate source/header file rather than adding to ratgdo.cpp... but that can wait until you are comfortable that things are working well.
And I see use of IRAM_ATTR... I am not sure what the effect of that is on our use of IRAM for allocating some blocks of memory during startup, but I suggest you go into the log.h file and change the line #define LOG_BUFFER_SIZE 8192
such that the size is much smaller... say 1024. We can put it back up once we know if IRAM_ATTR uses the same block of memory.
Thanks.
Thank you for the guidance. I removed the light related code and lowered the buffer size. I also added the dryContactLoop function to the main loop, if that is not correct you can let me know.
Another question I had was about the controlProtocol variable. In the mqtt code I see it defaults to secplus2 and can be secplus1 or drycontact, but I couldn't find where it was first declared and how it it is changed from the default. Could you explain how it is working, and if we need it in the homekit code?
The IRAM_ATTR's are telling it to put the Interrupt service routines in IRAM so it's not fetching them from flash so they can be serviced quickly and deterministically. We would need to verify, but I don't think this will get put in the location we are using for the IRAM heap allocations.
My next step will be to try and add the communication with HomeKit.
My next step will be to try and add the communication with HomeKit.
You should look at the file comms.cpp
and search on _"notifyhomekit" the available functions are in homekit.h
. The HomeKit part calls functions defined in comms.h
to trigger door open/close.
In fact it is probably best to integrate your code into comms.cpp
, look for where we test for gdoSecurityType
, and add a new possible value to that and then add the dry contact code when this is set to whatever value you select (we currently use values 1 and 2. You can take 0 or 3 or 99 or whatever you want).
@tlhagan I just merged the tweaks I was working on into main, you will need to rebase your branch onto the new release.
Thanks.
Sorry I'm also not very experienced with rebasing. I gave it a shot but I thought it was done incorrectly, so I force pushed back to the commit before the rebase (perhaps not the most proper solution). Now I tried again but the rebase results seem the same. The code seems ok, but is the commit history correct? From what I expected the latest commits from you/the bot should be before my commits on this branch, but they are after.
Also it is not clear to me why it is still showing here that platformio.ini has a conflict
It didn't seem like there was much movement towards adding dry contact control so I thought I would give it a shot. I took the sections from https://github.com/ratgdo/mqtt-ratgdo/blob/2.5/src/ratgdo.cpp that were relevant from what I could tell.
I'm sure I've missed things, I have experience in other languages but very little in C++ so I hope you'll be patient with me.
I have a dry contact GDO and have figured out how to build/flash the code locally so I should be able to test things.