Skip to content

Commit ddb0a90

Browse files
authored
Merge pull request #20 from jaswch/main
V0.3.3
2 parents 4cc58ad + 7def8ab commit ddb0a90

3 files changed

Lines changed: 166 additions & 39 deletions

File tree

README.md

Lines changed: 68 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,69 @@ which is closer to your location in line 44 ```const char* ntpServer = "pool.ntp
3131
Below are a few common NTP server URLs:-
3232
<br>
3333

34-
![Alt text](images/ntp.png)
34+
Area | HostName
35+
-------:|:-------------------------
36+
Asia | asia.pool.ntp.org
37+
Europe | europe.pool.ntp.org
38+
North America | north-america.pool.ntp.org
39+
Oceania | oceania.pool.ntp.org
40+
South America | south-america.pool.ntp.org
3541

3642
## For Platformio users
3743
### TQT pro N4R2 (Flash: 4MB, PSRAM: 2MB)
3844
Just upload the code without any changes to the ```platformio.ini``` file. It should look like this:
3945
<br>
40-
![Alt text](images/TQT-psram-conf.png)
46+
```
47+
; PlatformIO Project Configuration File
48+
49+
50+
[platformio]
51+
boards_dir = ./board
52+
;default_envs = T-QT-Pro-N8
53+
default_envs = T-QT-Pro-N4R2
54+
description = Open source watch OS for ESP32 based watches
55+
56+
;[env:T-QT-Pro-N8]
57+
[env:T-QT-Pro-N4R2]
58+
platform = espressif32@6.6.0
59+
board = esp32-s3-t-qt-pro
60+
framework = arduino
61+
build_flags =
62+
-DBOARD_HAS_PSRAM
63+
lib_deps =
64+
lennarthennigs/Button2@^2.3.3
65+
adafruit/Adafruit GFX Library@^1.11.11
66+
adafruit/Adafruit MPU6050 @ ^2.0.3
67+
adafruit/Adafruit Unified Sensor @ ^1.1.4
68+
```
4169

4270
Note:- Platformio is currently assuming we have total 1MB of flash and not detecting the PSRAM.
4371
### TQT pro N8 (Flash: 8MB, PSRAM: none)
4472
You will need to do some changes in the ```platformio.ini``` file before uploading the code. It should look like this:
4573
<br>
46-
![Alt text](images/TQT-non-psram-conf.png)
74+
```
75+
; PlatformIO Project Configuration File
76+
77+
78+
[platformio]
79+
boards_dir = ./board
80+
default_envs = T-QT-Pro-N8
81+
;default_envs = T-QT-Pro-N4R2
82+
description = Open source watch OS for ESP32 based watches
83+
84+
[env:T-QT-Pro-N8]
85+
;[env:T-QT-Pro-N4R2]
86+
platform = espressif32@6.6.0
87+
board = esp32-s3-t-qt-pro
88+
framework = arduino
89+
build_flags =
90+
; -DBOARD_HAS_PSRAM
91+
lib_deps =
92+
lennarthennigs/Button2@^2.3.3
93+
adafruit/Adafruit GFX Library@^1.11.11
94+
adafruit/Adafruit MPU6050 @ ^2.0.3
95+
adafruit/Adafruit Unified Sensor @ ^1.1.4
96+
```
4797

4898
## For Arduino IDE users
4999
All of the required code is in the ```src``` directory, just rename the file ```main.cpp``` to ```main.ino``` and install the below libraries and upload the code
@@ -56,7 +106,7 @@ All of the required code is in the ```src``` directory, just rename the file ```
56106
Note:- also refer to the README.md at [TQT pro](https://github.com/Xinyuan-LilyGO/T-QT/tree/main?tab=readme-ov-file#quick-start) for setting up the board in arduino ide.
57107

58108
## Configurator Tool
59-
The OpenTimeWatch Configurator tool is a python script which allows users to configure the WiFi network and time settings before compiling and uploading the firmware to the watch. This tool does not configure your board type nor does it compile and upload the code. To run the tool type
109+
The OpenTimeWatch Configurator tool is a python script which allows users to configure the Board, WiFi network and time settings before compiling and uploading the firmware to the watch. This tool does not compile and upload the code. To run the tool type
60110

61111
```python otwConfigurator.py```
62112

@@ -66,6 +116,8 @@ or
66116

67117
in your terminal.
68118

119+
Note:- This tool only configures the board for the usage in PlatformIO IDE
120+
69121
# Features
70122
1. Home screen with custom background
71123
2. Activity view shows steps walked, calories burned and weather (It is just a dummy and not functionally implemented yet)
@@ -87,25 +139,25 @@ in your terminal.
87139
4. While playing pong scroll button moves the paddle up and the menu button moves the paddle down
88140

89141
# Release Notes
90-
1. **V0.3.2** - New OpenTimeWatch Configurator tool.
91-
2. **V0.3.1** - otwUI bug fix, updated configuration for TQT pro N8 in ```platformio.ini``` file and better documentation.
92-
3. **V0.3** - New UI (created using [lopaka.app](https://lopaka.app/sandbox)), multiple watch faces, Wifi support, time synchronisation, back option in menus, accelerometer support and apps and sub menus separated from the ```main.cpp``` file.
93-
4. **V0.2.1** - Added refinements to the OS navigation, added a manual in the ```README.md``` and changed the tone of the speaker.
94-
5. **V0.2** - A significant update compared to V0.1, as it introduced menus, pong, interaction with peripherals (torch and speaker), OS being open sourced, matrix effect, settings menu.
95-
6. **V0.1** - The initial release it just had a home screen and an about screen.
142+
1. **V0.3.3** - OpenTimeWatch Configurator tool can now configure board settings.
143+
2. **V0.3.2** - New OpenTimeWatch Configurator tool.
144+
3. **V0.3.1** - otwUI bug fix, updated configuration for TQT pro N8 in ```platformio.ini``` file and better documentation.
145+
4. **V0.3** - New UI (created using [lopaka.app](https://lopaka.app/sandbox)), multiple watch faces, Wifi support, time synchronisation, back option in menus, accelerometer support and apps and sub menus separated from the ```main.cpp``` file.
146+
5. **V0.2.1** - Added refinements to the OS navigation, added a manual in the ```README.md``` and changed the tone of the speaker.
147+
6. **V0.2** - A significant update compared to V0.1, as it introduced menus, pong, interaction with peripherals (torch and speaker), OS being open sourced, matrix effect, settings menu.
148+
7. **V0.1** - The initial release it just had a home screen and an about screen.
96149

97150
# What to expect in V0.4?
98151
1. Support for our new watch hardware:- OpenTimeWatch 1
99152
2. Weather synchronisation
100153
3. Accent colours
101154
4. IR transmitter support
102155
5. Support for 3 navigation buttons
103-
6. Pulse sensor support
104-
7. Screen brightness adjustment
105-
8. Screen on-time adjustment
106-
9. Watch endurance
107-
10. Flappy bird clone
108-
11. UART console support
156+
6. Screen brightness adjustment
157+
7. Screen on-time adjustment
158+
8. Watch endurance
159+
9. Flappy bird clone
160+
10. UART console support
109161

110162
# Can I contribute ?
111163
Yes, you can contribute to the project by the following ways :

otwConfigurator.py

Lines changed: 95 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,62 @@
1-
# OpenTimeWatch Configurator tool
1+
# OpenTimeWatchOS Configurator Tool
2+
3+
print("Welcome to OpenTimeWatchOS configuration script")
4+
OSVarPath = "src/osVariables/osVariables.cpp"
5+
OSConfPath = "platformio.ini"
6+
7+
def configureBoard(userBoard):
8+
if userBoard == 1:
9+
try:
10+
with open(OSConfPath, 'r') as file:
11+
lines = file.readlines()
12+
for i, line in enumerate(lines):
13+
if i == 6: # Uncomment line 7
14+
lines[i] = line.lstrip(";")
15+
elif i == 5: # Comment line 6
16+
if not line.startswith(";"):
17+
lines[i] = ";" + line
18+
elif i == 10: # Uncomment line 11
19+
lines[i] = line.lstrip(";")
20+
elif i == 9: # Comment line 10
21+
if not line.startswith(";"):
22+
lines[i] = ";" + line
23+
elif i == 15: # Uncomment line 16
24+
lines[i] = line.lstrip(";")
25+
with open(OSConfPath, 'w') as file:
26+
file.writelines(lines)
27+
except Exception as e:
28+
print(f"An error occurred: {e}")
29+
30+
else:
31+
try:
32+
with open(OSConfPath, 'r') as file:
33+
lines = file.readlines()
34+
for i, line in enumerate(lines):
35+
if i == 5: # Uncomment line 6
36+
lines[i] = line.lstrip(";")
37+
elif i == 6: # Comment line 7
38+
if not line.startswith(";"):
39+
lines[i] = ";" + line
40+
elif i == 9: # Uncomment line 10
41+
lines[i] = line.lstrip(";")
42+
elif i == 10: # Comment line 11
43+
if not line.startswith(";"):
44+
lines[i] = ";" + line
45+
elif i == 15: # Comment line 16
46+
if not line.startswith(";"):
47+
lines[i] = ";" + line
48+
with open(OSConfPath, 'w') as file:
49+
file.writelines(lines)
50+
except Exception as e:
51+
print(f"An error occurred: {e}")
252

3-
print("Welcome to OpenTimeWatchOS configurator tool")
4-
file_path = "/home/jaswanth/Developer/Arduino/OpenTimeWatch-OS/src/osVariables/osVariables.cpp"
553

654
def configureWifiNetwork(userSSID):
755
try:
8-
with open(file_path, 'r') as file:
56+
with open(OSVarPath, 'r') as file:
957
lines = file.readlines()
1058

11-
with open(file_path, 'w') as file:
59+
with open(OSVarPath, 'w') as file:
1260
for line in lines:
1361
if 'const char* ssid = ' in line:
1462
line = f'const char* ssid = "{userSSID}";\n'
@@ -18,10 +66,10 @@ def configureWifiNetwork(userSSID):
1866

1967
def configureWifiPassword(userPassword):
2068
try:
21-
with open(file_path, 'r') as file:
69+
with open(OSVarPath, 'r') as file:
2270
lines = file.readlines()
2371

24-
with open(file_path, 'w') as file:
72+
with open(OSVarPath, 'w') as file:
2573
for line in lines:
2674
if 'const char* password = ' in line:
2775
line = f'const char* password = "{userPassword}";\n'
@@ -31,10 +79,10 @@ def configureWifiPassword(userPassword):
3179

3280
def configureGMTOffset(userGMT):
3381
try:
34-
with open(file_path, 'r') as file:
82+
with open(OSVarPath, 'r') as file:
3583
lines = file.readlines()
3684

37-
with open(file_path, 'w') as file:
85+
with open(OSVarPath, 'w') as file:
3886
for line in lines:
3987
if 'const long gmtOffset_sec = ' in line:
4088
line = f'const long gmtOffset_sec = {userGMT};\n'
@@ -44,10 +92,10 @@ def configureGMTOffset(userGMT):
4492

4593
def configureDayLightOffset(userDayLight):
4694
try:
47-
with open(file_path, 'r') as file:
95+
with open(OSVarPath, 'r') as file:
4896
lines = file.readlines()
4997

50-
with open(file_path, 'w') as file:
98+
with open(OSVarPath, 'w') as file:
5199
for line in lines:
52100
if 'const int daylightOffset_sec = ' in line:
53101
line = f'const int daylightOffset_sec = {userDayLight};\n'
@@ -56,14 +104,39 @@ def configureDayLightOffset(userDayLight):
56104
print(f"An error occurred: {e}")
57105

58106
if __name__ == "__main__":
59-
60-
userSSID = input("Enter your WiFi network name: ")
61-
configureWifiNetwork(userSSID)
62-
userPassword = input("Enter your WiFi network password: ")
63-
configureWifiPassword(userPassword)
64-
userGMT = input("Enter your area's GMT offset(in seconds): ")
65-
configureGMTOffset(userGMT)
66-
userDayLight = input("Enter your area's day light offset(in seconds): ")
67-
configureDayLightOffset(userDayLight)
68-
69-
print("Configuration complete. Please compile and upload the firmware.")
107+
print("1. Configure")
108+
print("2. About")
109+
print("3. Exit")
110+
userOption = input("Select an option: ")
111+
112+
if userOption == "1":
113+
print("Watch Hardware: ")
114+
print("1. T-QT-Pro-N4R2")
115+
print("2. T-QT-Pro-N8")
116+
userBoard = int(input("Select your board: "))
117+
configureBoard(userBoard)
118+
if userBoard == 1:
119+
print("You have selected T-QT-Pro-N8")
120+
else:
121+
print("You have selected T-QT-Pro-N4R2")
122+
userSSID = input("Enter your WiFi network name: ")
123+
configureWifiNetwork(userSSID)
124+
userPassword = input("Enter your WiFi network password: ")
125+
configureWifiPassword(userPassword)
126+
userGMT = input("Enter your area's GMT offset(in seconds): ")
127+
configureGMTOffset(userGMT)
128+
userDayLight = input("Enter your area's day light offset(in seconds): ")
129+
configureDayLightOffset(userDayLight)
130+
print("Configuration complete. Please upload the code.")
131+
elif userOption == "2":
132+
print("OpenTimeWatchOS Configuration Script V1.1")
133+
print("This is a configuration script for OpenTimeWatchOS for your watch hardware")
134+
print("It allows you to configure the Board, WiFi SSID, password, GMT offset, and daylight offset")
135+
print("For more information, visit the OpenTimeWatchOS GitHub repository.")
136+
print("https://github.com/OpenTimeWatch-Project/OpenTimeWatch-OS")
137+
elif userOption == "3":
138+
print("Exiting the script. Goodbye!")
139+
exit(0)
140+
else:
141+
print("Invalid option. Please try again.")
142+
exit(1)

src/main.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@
1919
* Stable release of V0.3
2020
* 15 February 2025 - V 0.3.1 -
2121
* Minor update, otwUI bug fix and better documentation.
22-
* 19 April 2025 - V 0.3.1 -
22+
* 19 April 2025 - V 0.3.2 -
2323
* A new configurator tool.
24+
* 19 April 2025 - V 0.3.3 -
25+
* OpenTimeWatch Configurator tool update.
2426
*/
2527

2628
// include all the necessary libraries for the OS

0 commit comments

Comments
 (0)