-
Notifications
You must be signed in to change notification settings - Fork 44
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 clocks - Model H401 and H402 #86
Open
Martinius79
wants to merge
44
commits into
SmittyHalibut:main
Choose a base branch
from
Martinius79:AddedIPSTUBEs
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…he main.cpp, added photos and wiring schematics of the clock, added components list
…Changed components list to MD file
…er "documentation" - Changed location for images in the MD - Moved hardware description folders and other to the documentation folder - Modified README.MD in the pre-build-images subfolder - deleted redundant image
…to ModifiedReadMeFilesAndContentForIt
…w used for all IPSTUBE models and versions
…be Gen2 PCB top view and IPSTUBE H402 bottom view - Modified inital notes section
Added the branch https://github.com/Martinius79/EleksTubeHAX/tree/ModifiedReadMeFilesAndContentForIt into this branch and PR now. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Added support for IPSTUBE clocks
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.
1,2MB app partition, 6,8MB 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 clocks configs in the GLOBAL_DEFINES.H file.
See section "#ifdef HARDWARE_IPSTUBE_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).
Added "#define TOUCH_CS -1" to get rid of a warning (also possible with #define DISABLE_ALL_LIBRARY_WARNINGS).
Set TFT_CS to -1
Added ACTIVATEDISPLAYS and DEACTIVATEDISPLAYS defines, because power on/off is switched for IPSTUBEs.
I modified the _USER_DEFINES - empty.h file
Added "#define HARDWARE_IPSTUBE_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. enableDigitCSPins, disableDigitCSPins, enableAllCSPins and disableAllCSPins.
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 (using DEACTIVATEDISPLAYS and ACTIVATEDISPLAYS).
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_CLOCK)"
Modified the main.cpp file.
Init TFTs first, before gesture in the setup function.
Working and Not-Working list for IPSTUBE:
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.
Limited working:
Button:
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 "right 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.
TFT LCD disable/enable:
Depending on the board version of the IPSTUBEs, the transistor Q1 is present on the board or not.
If the transistor is present, the displays can be turned on and off like on other clocks.
If the transistor is not present, the TFT LCDs can NOT turned on or off by software without modifing the hardware!