-
Notifications
You must be signed in to change notification settings - Fork 49
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
Added support for IPSTUBE clock - Model H401 #77
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May I suggest that you create a hardware folder like the one that exists for the other clocks and enter the corresponding pictures of the board and pin assignment there.
This would support further development by others.
…he main.cpp, added photos and wiring schematics of the clock, added components list
Done! |
I found out, how the LED stripe on the bottom of the clock is working. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work! Still has potential for improvement.
The top-level README could do with a few words on IPSCLock, including what works and what doesn't.
…Changed components list to MD file
Yes, a lot :)
I couldn't resist and doing an "refresh" of the README.MD file(s) in a seperated PR. Still working on it, because I noticed, I missed to tell, what is working ;( |
@Martinius79 I don't know how to disassemble the case without damaging it, so I can't really confirm the connections. |
Hello, thx @Walmtech for the pictures! Yes, on this side of the board, it looks nearly all the same, except two places. But there seems to be no components soldered there (U6 left to the USB C connector and BT2 on the top right). So the LCD selection lines seems to be all the same and the code modification should work here. @sozonnyk: Did you also flash the second (data) partition? It sounds, like you saw the "setup phase" on the displays, with the little text lines on the screen? You can also watch the modified Readme.md file. See section: https://github.com/Martinius79/EleksTubeHAX/blob/OneDisplayTestH401/README.md#configure-build-and-upload-new-firmware PS: I ordered a H402 now, but will take some time to be delievered from China. Bye |
Hi @Martinius79, thanks for your help. Yes I uploaded both firmware and filesystem. I updated Not sure what else I could try. @Walmtech |
@Martinius79 Also, is |
@sozonnyk The bottom plate is a piece of thin black acrylic with double sided adhesive on it after you remove all the screws I just used a small flat screwdriver inside the screw hole to gently lever it up once it had risen enough to insert a second screwdriver between the outer edge and the plate I just gently removed the whole plate by hand. Came off with no scratches. I haven't flashed anything yet my visual studio code is setup for other things so will probably need to set up a VM so I can have a clean environment to work in. Not had the time yet :) |
Yes, this is the branch, where this PR is coming from. So it is the right one. |
@Martinius79
|
Ok, the logs are looking good, so no idea, what is going wrong... I watched the pictures again and noticed, that the SPI lines look a bit different then on the H401. I guess, only way to be sure, is measure the known pins on the ESP and the ones on the displays. Bye |
Also one more question: Can the displays turned on and off on the H402 with the original firmware? Bye |
Do I understand correctly that displays are connected to the SPI, and each display's CS is selected through a shirt register? Ok, scratch that, I've found your kicad file and looked at the schematics.
Do you mean by using a default mobile app? I actually never tried it. |
@Martinius79 Thanks for your help and contribution. |
Hello again! I am happy to hear, that the H402 has a On and Off mechanism for the displays and you made it to activate it! I am now wondering, if I missed something with the H401 :)
Yes. If you believe it or not, I had the idea, that the transistor is in use for the H402, so that you can turn on and off the displays with the firmware somehow... I will try to change the code, that the displays can be enabled if it is a model H402. Do you see any other changes? Bye |
@Martinius79 there is no transistor in solder position Q1 one pin of the missing transitistor goes to GPIO4 (pin 24), One pin is connected to the ground plane and the other look like it goes through vias to a line on the other side of the board - but reads as connected to ground! |
I guess that if we want to mod these to control the display backlights at least we have a spare GPIO that soldering to would be easier than off the ESP. |
@Martinius79 @Walmtech Regarding soldering directly to ESP, I honestly doubt it. |
I finally received my version of a H402 and it also has a transistor soldered. The transitor is marked "A19TF" and seems to be a model 3401 (like this one https://www.reichelt.de/de/de/mosfet-p-ch-30v-3a-1-25w-sot-23-tsm-3401-smd-p115912.html). The board is marked as "HN-213X31-HGSY-A" So there is a good chance, that the transistor can be soldered on the Q1 spot on boards where it is missing. Bye |
Thanks @Martinius79 ! |
I created a new branch for the changes (https://github.com/Martinius79/EleksTubeHAX/tree/AddedIPSTUBEs). |
I am creating a new PR with changes merged from main and improvments for the second IPSTUBE clock |
Added support for IPSTUBE clock - Model H401
Just the minimum changes, to support the model with this branch.
The IPSTUBE clock has 8MB flash, so no default board from PIO is fitting. I created a JSON file with the modified values (esp32dev8MB.json) under the subfolder "boards" so it can be used in the PIO project.
I created a new "partition table file" (partition_noOta_1Mapp_7Mspiffs.csv) for the 8MB flash version.
1MB app partition, 7MB SPIFFS partition
I added a new environment in the platform.ini file (env:esp32dev8MB), to use the new board configuration file and the new partition table file.
Because each environment has its own target directory (PROJECTDIR.pio\build\ENVNAME), the helper scripts to copy and modify the libs files needs another target folder. So I created script_adjust_gesture_sensor_lib_8MB.py and script_configure_tft_lib_8MB.py and added it to the new env.
I added/copied a section to define the IPSTUBE clock configs in the GLOBAL_DEFINES.H file.
See section "#ifdef HARDWARE_IPSTUBE_H401_CLOCK" in the file.
Specials:
New defintion for a one button menu (#define ONE_BUTTON_ONLY_MENU), because only one hardware button is available for IPSTUBE.
Removed the shift register pin config definitions (CSSR_DATA_PIN,CSSR_CLOCK_PIN, CSSR_LATCH_PIN).
Removed defintion of "TFT_ENABLE_PIN", because the LCDs are always on for the IPSTUBE and then the exisitng logic can be used.
Added "#define TOUCH_CS -1" to get rid of a warning (also possible with #define DISABLE_ALL_LIBRARY_WARNINGS).
Set TFT_CS to -1
I modified the _USER_DEFINES - empty.h file
Added "#define HARDWARE_IPSTUBE_H401_CLOCK as "Type of clock"
I modified the ChipSelect class.
Moved inline defined methods from ChipSelect.H file to ChipSelect.CPP file.
Modified the existing "digit" select methods, that they work with IPSTUBE and other clocks. Normaly by keeping the existing logic and just switching or leaving out code where needed by checking, which hardware is defined.
Added the array for the CS pins of the IPSTUBE.
Added some IPSTUBE specific methods to select the right LCDs. enableDigitCSPinsH401, disableDigitCSPinsH401, enableAllCSPinsH401 and disableAllCSPinsH401.
So the existing logic for selecting and activating/disabling the LCDs from the TFTs class can be used without modification.
I modified the TFTs class.
Moved some inline defined methods from TFTs.H file to TFTs.CPP file (enableAllDisplays, disableAllDisplays, toggleAllDisplays).
Modified existing methods that they work with IPSTUBE and other clocks. Normaly by keeping the existing logic and just switching or leaving out code where needed by checking, which hardware is defined.
I renamed the Button.CPP file to Buttons.CPP and modified the header file as well to use the new file.
I modified the Button class.
I added some public helper methods, to be able to set button states from outside of the instance of the class (setDownLongEdgeState, setUpEdgeState, setUpLongEdgeState)
I modified the Buttons class.
Two constructors are needed now, depending on the definition of ONE_BUTTON_ONLY_MENU or not. Classic way, Buttons instance with four buttons is created, new, Buttons instance with only one button is created.
Moved some inline defined methods for Buttons class from Buttons.H file to Buttons.CPP file (loop, begin, stateChanged). Also for the one button menu implementation.
I modified the Menu class.
Two loop methods are now implemented. One for the one button menu (ONE_BUTTON_ONLY_MENU defined) ot the classic one, with four buttons.
The "edge" logic for the buttons is changed now, from "down_edge" to "up_edge". So the software (here the menu) only reacts, if a button is "released", not while it is pressed.
This makes "long pressed button" possible without having a "wrong" button state left.
So in the one button mode, a long press of the button, is interpreted as a "move to the right" (right button).
I added a method to print out the names of the menu states (getStateStr).
I modified the Clock class file.
IPSTUBE is using the DS1302 as RTC chip, so needs to be defined as well, to use another driver as for HARDWARE_SI_HAI_CLOCK.
Modified to "#if defined(HARDWARE_SI_HAI_CLOCK) || defined(HARDWARE_IPSTUBE_H401_CLOCK)"
Modified the main.cpp file.
Init TFTs first, before gesture in the setup function.
Working and Not-Working list for IPSTUBE H401:
Working:
All "normal" clock functions are working.
Possible to flash all needed partitions to the clock (button needs to be pressed while connecting USB-C cable and then released to go into download mode every time you want to flash)
Passing the setup() function with initalizing messages on the LCDs.
Connecting to Wifi network.
Getting time from NTP server.
Loading the images for the clock faces from the SPIFFS partition.
Showing the actual time on the LCDs with the loaded clock face images.
Running the main loop function.
Menu is working (see below for limitations with the one button menu). Able to go through all sub-menu points and select the functionalities (backlight pattern selection, backlight color if pattern is constant, backlight intensity, 24/12h clock, blank zero, time zone offset hours, time zone offset 15 min, clock face selection, WPS menu if activated).
Loading and storing config values from the config partition.
Connecting to the MQTT broker server for sending and receiving MQTT messages.
"Dimming" the images of the clock face.
"Normal" LED backlights on the bottom of each LCD are working. Turning on and off is possible. Dimming is possible. All patters working.
Night and Daytime mode is working.
LED stripe on the bottom of the clock, as a continuation of the normal 6 backlight LEDs.
Can't tell if working:
Geolocation broker based time zone selection -> no account, so not tested.
WPS connect -> never used, never tested.
Temperature sensor -> There is no connector/socket on the PCB for this, so no temp sensor support for this clock!
Limited working:
The PCB has only one button!
There is a special menu mode activated for the IPSTUBE hardware, that short pressing brings up the menu and long pressing changes the value of the actual selected menu then.
The value always changes "to the right", because the long button press is emulating a "rigth button" press in the menu only in the moment.
This limits the setup of the timezone values and makes the selection of the other menu values a bit "unhandy", because you have to pass all values, to be at first option again, but it works for now.
Not working:
LED stripe: On some versions there is a LED stripe on the bottom of the device installed. It is connected to a socket on the PCB between FPC5 and FPC6. So it can be retrofitted, if you find the right LED stripe. This LED stripe is not working in the moment, because no specific initialization is done for it. Sometimes, the LED stripe is turning on by accident, so it seems, as if this is somehow connected to same lines, as the "normal" LED backlights on the bottom of each LCD. Needs further investigation.TFT LCD disable/enable:
TFT LCDs can not turned on/enabled or turned off/disabled on the device without modifing the hardware!
The pin 1 and pin 7 of each FPC for each TFT LCDs are connected together directly to the +V3.3 line of the PCB.
Pin 1 is the general VCC power (LED Anode) and pin 7 is the VDD (Power Supply for Analog).
So there is no way to control the VDD on pin 7 seperately or to turn on or turn off power to pin 1.
One possible solution would be disconnecting pin 1 and pin 7 and connecting pin 1 to the existing "switchable" power control lines, like the one from the backlights.
Connecting all pin 7 somehow to an unused pin on the ESP32 is really really tricky and I don't belive, the chip would survice this procedure (just my opinion).