Merge pull request #375 from cyberman54/development

Issue #373 & new feature LED matrix display
This commit is contained in:
Verkehrsrot 2019-05-29 20:15:00 +02:00 committed by GitHub
commit 90db017d12
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 48 additions and 36 deletions

View File

@ -13,33 +13,44 @@ Import("env")
# get platformio environment variables
project_config = util.load_project_config()
# check if file loraconf.h is present in source directory
keyfile = str(env.get("PROJECTSRC_DIR")) + "/loraconf.h"
if os.path.isfile(keyfile) and os.access(keyfile, os.R_OK):
print "Parsing LORAWAN keys from " + keyfile
else:
sys.exit("Missing file loraconf.h, please create it using template loraconf.sample.h! Aborting.")
# get platformio source path
srcdir = env.get("PROJECTSRC_DIR").replace("\\", "/")
# check if file ota.conf is present in source directory
keyfile = str(env.get("PROJECTSRC_DIR")) + "/" + project_config.get("common", "keyfile")
if os.path.isfile(keyfile) and os.access(keyfile, os.R_OK):
print "Parsing OTA keys from " + keyfile
# check if lmic config file is present in source directory
lmicconfig = project_config.get("common", "lmicconfigfile")
lmicconfigfile = os.path.join (srcdir, lmicconfig)
if os.path.isfile(lmicconfigfile) and os.access(lmicconfigfile, os.R_OK):
print "Parsing LMIC configuration from " + lmicconfigfile
else:
sys.exit("Missing file ota.conf, please create it using template ota.sample.conf! Aborting.")
sys.exit("Missing file " + lmicconfigfile + ", please create it! Aborting.")
# parse file ota.conf
# check if lora key file is present in source directory
lorakeyfile = os.path.join (srcdir, project_config.get("common", "lorakeyfile"))
if os.path.isfile(lorakeyfile) and os.access(lorakeyfile, os.R_OK):
print "Parsing LORAWAN keys from " + lorakeyfile
else:
sys.exit("Missing file " + lorakeyfile + ", please create it! Aborting.")
# check if ota key file is present in source directory
otakeyfile = os.path.join (srcdir, project_config.get("common", "otakeyfile"))
if os.path.isfile(otakeyfile) and os.access(otakeyfile, os.R_OK):
print "Parsing OTA keys from " + otakeyfile
else:
sys.exit("Missing file " + otakeyfile + ", please create it! Aborting.")
# parse ota key file
mykeys = {}
with open(keyfile) as myfile:
with open(otakeyfile) as myfile:
for line in myfile:
key, value = line.partition("=")[::2]
mykeys[key.strip()] = str(value).strip()
# get bintray user credentials
# get bintray user credentials from ota key file
user = mykeys["BINTRAY_USER"]
repository = mykeys["BINTRAY_REPO"]
apitoken = mykeys["BINTRAY_API_TOKEN"]
# get bintray upload parameters
# get bintray upload parameters from platformio environment
version = project_config.get("common", "release_version")
package = str(env.get("PIOENV"))
@ -49,11 +60,14 @@ env.Replace(BINTRAY_REPO=repository)
env.Replace(BINTRAY_API_TOKEN=apitoken)
# get runtime credentials and put them to compiler directive
env.Replace(CPPDEFINES=[
('WIFI_SSID', '\\"' + mykeys["OTA_WIFI_SSID"] + '\\"'),
('WIFI_PASS', '\\"' + mykeys["OTA_WIFI_PASS"] + '\\"'),
('BINTRAY_USER', '\\"' + mykeys["BINTRAY_USER"] + '\\"'),
('BINTRAY_REPO', '\\"' + mykeys["BINTRAY_REPO"] + '\\"'),
env.Append(BUILD_FLAGS=[
u'-DWIFI_SSID=\\"' + mykeys["OTA_WIFI_SSID"] + '\\"',
u'-DWIFI_PASS=\\"' + mykeys["OTA_WIFI_PASS"] + '\\"',
u'-DBINTRAY_USER=\\"' + mykeys["BINTRAY_USER"] + '\\"',
u'-DBINTRAY_REPO=\\"' + mykeys["BINTRAY_REPO"] + '\\"',
u'-DBINTRAY_PACKAGE=\\"$PIOENV\\"',
u'-DARDUINO_LMIC_PROJECT_CONFIG_H=' + lmicconfig,
u'-I \"' + srcdir + '\"'
])
# function for pushing new firmware to bintray storage using API

View File

@ -4,7 +4,7 @@
#include "LEDMatrix.h"
#include "ledmatrixfonts.h"
extern uint8_t MatrixDisplayIsOn = 0;
extern uint8_t MatrixDisplayIsOn;
extern LEDMatrix matrix;

View File

@ -40,7 +40,9 @@ debug_level = 3
upload_protocol = esptool
;upload_protocol = custom
extra_scripts = pre:build.py
keyfile = ota.conf
otakeyfile = ota.conf
lorakeyfile = loraconf.h
lmicconfigfile = lmic_config.h
platform_espressif32 = espressif32@1.8.0
;platform_espressif32 = https://github.com/platformio/platform-espressif32.git#develop
board_build.partitions = min_spiffs.csv
@ -62,7 +64,7 @@ lib_deps_sensors =
lib_deps_basic =
ArduinoJson@^5.13.1
Timezone@^1.2.2
RTC@^2.3.0
RTC@^2.3.3
SimpleButton
lib_deps_all =
${common.lib_deps_basic}
@ -70,17 +72,13 @@ lib_deps_all =
${common.lib_deps_display}
${common.lib_deps_rgbled}
${common.lib_deps_gps}
${common.lib_deps_matrix_display}
build_flags_basic =
-include "src/hal/${PIOENV}.h"
-include "src/paxcounter.conf"
-w
;use this is you have platformio version >= 4.0.0a15
'-DARDUINO_LMIC_PROJECT_CONFIG_H=../../../../../src/lmic_config.h'
;use this is you have platformio version < 4.0.0a15
;'-DARDUINO_LMIC_PROJECT_CONFIG_H=../../../src/lmic_config.h'
'-DCORE_DEBUG_LEVEL=${common.debug_level}'
'-DLOG_LOCAL_LEVEL=${common.debug_level}'
'-DBINTRAY_PACKAGE="${PIOENV}"'
'-DPROGVERSION="${common.release_version}"'
build_flags_sensors =
-Llib/Bosch-BSEC/src/esp32/
@ -358,6 +356,7 @@ upload_speed = 921600
lib_deps =
${common.lib_deps_basic}
${common.lib_deps_rgbled}
${common.lib_deps_matrix_display}
build_flags =
${common.build_flags_basic}
upload_protocol = ${common.upload_protocol}

View File

@ -24,7 +24,7 @@ const FONT_CHAR_INFO *ActiveFontCharInfo = ActiveFontInfo->Descriptors;
void init_matrix_display(const char *Productname, const char *Version) {
ESP_LOGI(TAG, "Initializing LED Matrix display");
matrix.begin(displaybuf, LED_MATRIX_WIDTH, LED_MATRIX_HEIGHT);
matrix.reverse();
//matrix.reverse();
matrix.clear();
DrawNumber(String("0"));
} // init_display

View File

@ -108,12 +108,13 @@
#define CAYENNE_SENSORREAD 13 // sensor period configuration
#define CAYENNE_SENSORENABLE 14 // sensor enable configuration
// LMIC settings
// -> in src/lmic_config.h
// LED Matrix display settings. Pin numbers work fine for Wemos Lolin32 board (all used pins are on 1 side of the board)
// LED Matrix display settings.
// Note: LED Matrix will only show number of found devices, no other information will be shown for now
//#define HAS_MATRIX_DISPLAY 1 // Uncomment to enable LED matrix display output
#define LED_MATRIX_WIDTH 64 // Width in pixels (LEDs) of your display
#define LED_MATRIX_HEIGHT 16 // Height in pixels (LEDs ) of your display
// Pin numbers work fine for Wemos Lolin32 board (all used pins are on 1 side of the board)
#define MATRIX_DISPLAY_SCAN_US 500 // Matrix display scan rate in microseconds (1ms is about 'acceptable')
#define LED_MATRIX_LATCHPIN 13 // Connects to LAT pin on display
#define LED_MATRIX_CLOCKPIN 32 // Connects to CLK pin on display
@ -123,5 +124,3 @@
#define LED_MATRIX_LC_74138 25 // Connects to LC pin on display
#define LED_MATRIX_LD_74138 26 // Connects to LD pin on display
#define LED_MATRIX_DATA_R1 33 // Connects to R1 pin on display
#define LED_MATRIX_WIDTH 64 // Width in pixels (LEDs) of your display
#define LED_MATRIX_HEIGHT 16 // Height in pixels (LEDs ) of your display