bugfix payload port

This commit is contained in:
Klaus K Wilting 2018-11-17 22:49:14 +01:00
parent 019af5ef8c
commit 2e51071d87
7 changed files with 15 additions and 17 deletions

View File

@ -26,7 +26,7 @@ void os_getDevEui(u1_t *buf);
void showLoraKeys(void); void showLoraKeys(void);
void switch_lora(uint8_t sf, uint8_t tx); void switch_lora(uint8_t sf, uint8_t tx);
void lora_send(osjob_t *job); void lora_send(osjob_t *job);
void lora_enqueuedata(uint8_t messageType, MessageBuffer_t *message); void lora_enqueuedata(MessageBuffer_t *message);
void lora_queuereset(void); void lora_queuereset(void);
void lora_housekeeping(void); void lora_housekeeping(void);
void user_request_network_time_callback(void *pVoidUserUTCTime, void user_request_network_time_callback(void *pVoidUserUTCTime,

View File

@ -28,7 +28,7 @@ licenses. Refer to LICENSE.txt file in repository for more details.
esp_err_t spi_init(); esp_err_t spi_init();
void spi_enqueuedata(uint8_t messageType, MessageBuffer_t *message); void spi_enqueuedata(MessageBuffer_t *message);
void spi_queuereset(); void spi_queuereset();
void spi_housekeeping(); void spi_housekeeping();

View File

@ -29,7 +29,7 @@ description = Paxcounter is a proof-of-concept ESP32 device for metering passeng
[common] [common]
; for release_version use max. 10 chars total, use any decimal format like "a.b.c" ; for release_version use max. 10 chars total, use any decimal format like "a.b.c"
release_version = 1.6.63 release_version = 1.6.68
; DEBUG LEVEL: For production run set to 0, otherwise device will leak RAM while running! ; DEBUG LEVEL: For production run set to 0, otherwise device will leak RAM while running!
; 0=None, 1=Error, 2=Warn, 3=Info, 4=Debug, 5=Verbose ; 0=None, 1=Error, 2=Warn, 3=Info, 4=Debug, 5=Verbose
debug_level = 0 debug_level = 0
@ -43,6 +43,9 @@ board_build.partitions = min_spiffs.csv
monitor_speed = 115200 monitor_speed = 115200
lib_deps_all = lib_deps_all =
ArduinoJson@^5.13.1 ArduinoJson@^5.13.1
Adafruit Unified Sensor@^1.0.2
Adafruit BME680 Library@^1.0.7
Time@>=1.5
lib_deps_lora = lib_deps_lora =
; MCCI LoRaWAN LMIC library@^2.2.2 ; MCCI LoRaWAN LMIC library@^2.2.2
lib_deps_display = lib_deps_display =
@ -51,10 +54,6 @@ lib_deps_rgbled =
SmartLeds@>=1.1.3 SmartLeds@>=1.1.3
lib_deps_gps = lib_deps_gps =
TinyGPSPlus@>=1.0.2 TinyGPSPlus@>=1.0.2
Time@>=1.5
lib_deps_sensors =
Adafruit Unified Sensor@^1.0.2
Adafruit BME680 Library@^1.0.7
build_flags = build_flags =
-include $PROJECTSRC_DIR/hal/${PIOENV}.h -include $PROJECTSRC_DIR/hal/${PIOENV}.h
-include $PROJECTSRC_DIR/paxcounter.conf -include $PROJECTSRC_DIR/paxcounter.conf
@ -336,7 +335,6 @@ lib_deps =
${common.lib_deps_rgbled} ${common.lib_deps_rgbled}
${common.lib_deps_gps} ${common.lib_deps_gps}
${common.lib_deps_display} ${common.lib_deps_display}
${common.lib_deps_sensors}
build_flags = build_flags =
${common.build_flags} ${common.build_flags}
upload_protocol = ${common.upload_protocol} upload_protocol = ${common.upload_protocol}

View File

@ -389,7 +389,7 @@ esp_err_t lora_stack_init() {
#endif #endif
} }
void lora_enqueuedata(uint8_t messageType, MessageBuffer_t *message) { void lora_enqueuedata(MessageBuffer_t *message) {
// enqueue message in LORA send queue // enqueue message in LORA send queue
#ifdef HAS_LORA #ifdef HAS_LORA
BaseType_t ret = BaseType_t ret =

View File

@ -11,7 +11,7 @@
// Payload send cycle and encoding // Payload send cycle and encoding
#define SEND_SECS 30 // payload send cycle [seconds/2] -> 60 sec. #define SEND_SECS 30 // payload send cycle [seconds/2] -> 60 sec.
#define PAYLOAD_ENCODER 2 // payload encoder: 1=Plain, 2=Packed, 3=CayenneLPP dynamic, 4=CayenneLPP packed #define PAYLOAD_ENCODER 3 // payload encoder: 1=Plain, 2=Packed, 3=CayenneLPP dynamic, 4=CayenneLPP packed
// Set this to include BLE counting and vendor filter functions // Set this to include BLE counting and vendor filter functions
#define VENDORFILTER 1 // comment out if you want to count things, not people #define VENDORFILTER 1 // comment out if you want to count things, not people

View File

@ -7,14 +7,12 @@ void SendData(uint8_t port) {
MessageBuffer_t SendBuffer; MessageBuffer_t SendBuffer;
SendBuffer.MessageSize = payload.getSize(); SendBuffer.MessageSize = payload.getSize();
SendBuffer.MessagePort = PAYLOAD_ENCODER <= 2 SendBuffer.MessagePort = port;
? port
: (PAYLOAD_ENCODER == 4 ? LPP2PORT : LPP1PORT);
memcpy(SendBuffer.Message, payload.getBuffer(), payload.getSize()); memcpy(SendBuffer.Message, payload.getBuffer(), payload.getSize());
// enqueue message in device's send queues // enqueue message in device's send queues
lora_enqueuedata(port, &SendBuffer); lora_enqueuedata(&SendBuffer);
spi_enqueuedata(port, &SendBuffer); spi_enqueuedata(&SendBuffer);
// clear counter if not in cumulative counter mode // clear counter if not in cumulative counter mode
if ((port == COUNTERPORT) && (cfg.countermode != 1)) { if ((port == COUNTERPORT) && (cfg.countermode != 1)) {
@ -49,7 +47,9 @@ void sendPayload() {
ESP_LOGD(TAG, "No valid GPS position or GPS data mode disabled"); ESP_LOGD(TAG, "No valid GPS position or GPS data mode disabled");
} }
#endif #endif
SendData(COUNTERPORT); SendData(PAYLOAD_ENCODER <= 2 ? COUNTERPORT
: (PAYLOAD_ENCODER == 4 ? LPP2PORT : LPP1PORT));
} // sendpayload() } // sendpayload()
void flushQueues() { void flushQueues() {

View File

@ -149,7 +149,7 @@ esp_err_t spi_init() {
#endif #endif
} }
void spi_enqueuedata(uint8_t messageType, MessageBuffer_t *message) { void spi_enqueuedata(MessageBuffer_t *message) {
// enqueue message in SPI send queue // enqueue message in SPI send queue
#ifdef HAS_SPI #ifdef HAS_SPI
BaseType_t ret = BaseType_t ret =