NTP Timezone & Enable/Disable Setting (#80)

* quick and dirty WIP to investigate timezones, currently only building under esp8266 platform
much of the status stuff has been stripped for now, to test the concepts

* support set of common features across ESP32/ESP8266 WRT timezone and sntp
return dates as ISO format strings

* remove time library, and timelib fix which is no longer required

* fix the icons

* remove temporary changes to demo project
This commit is contained in:
rjwats
2020-01-20 11:14:46 +00:00
committed by GitHub
parent 59326c6426
commit ced5b74ba1
16 changed files with 620 additions and 184 deletions

View File

@ -32,5 +32,3 @@ if (len(BUILD_TARGETS) == 0 or "upload" in BUILD_TARGETS):
buildWeb()
else:
print("Skipping build interface step for target(s): " + ", ".join(BUILD_TARGETS))

View File

@ -1,40 +0,0 @@
import os
import sys
import re
Import("env")
# Find files under 'root' of a given 'fileName' in directories matching 'subDirectoryPattern'
# This will allow us to safely find the offending Time.h file for removal prior to building
def findSubDirectoryFiles(root, subDirectoryPattern, fileName):
subDirectories = os.listdir(root)
subDirectories = filter(lambda d: re.match(subDirectoryPattern, d), subDirectories)
result = []
for subDirectory in subDirectories:
candidateFile = os.path.join(root, subDirectory, fileName)
if os.path.isfile(candidateFile):
result.append(candidateFile)
return result
def deleteTimeHeader(libDepsDir):
timeHeaderFile = "Time.h"
timeLibDirectoryPattern = "Time(_ID[0-9]+)?"
# delete the file, as long as we only find one
if os.path.isdir(libDepsDir) :
deletionCandidates = findSubDirectoryFiles(libDepsDir, timeLibDirectoryPattern, timeHeaderFile)
numDeletionCandidates = len(deletionCandidates)
if numDeletionCandidates == 1:
os.remove(deletionCandidates[0])
elif numDeletionCandidates > 1:
os.write(2, "Can\'t delete Time.h, more than one instance found:\n" + "\n".join(deletionCandidates))
sys.exit(1)
# old lib deps directory
deleteTimeHeader(os.path.join(env.subst("$PROJECT_DIR"), ".piolibdeps"))
# pre 4.x lib deps directory
deleteTimeHeader(os.path.join(env.subst("$PROJECTLIBDEPS_DIR"), env.subst("$PIOENV")))
# >4.x lib deps directory
deleteTimeHeader(os.path.join(env.subst("$PROJECT_LIBDEPS_DIR"), env.subst("$PIOENV")))