bugfix payload encoder (txpower was missing)
This commit is contained in:
		
							parent
							
								
									477b6bd749
								
							
						
					
					
						commit
						d55899a83f
					
				
							
								
								
									
										74
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										74
									
								
								README.md
									
									
									
									
									
								
							@ -131,35 +131,37 @@ Hereafter described is the default *plain* format, which uses MSB bit numbering.
 | 
			
		||||
 | 
			
		||||
**Port #2:** Device status query result
 | 
			
		||||
 | 
			
		||||
  	byte 1-2:	Voltage [mV]
 | 
			
		||||
	byte 3-11:	Uptime [seconds]
 | 
			
		||||
	bytes 12-16: 	CPU temperature [°C]
 | 
			
		||||
  	byte 1-2:	Battery or USB Voltage [mV], 0 if unreadable
 | 
			
		||||
	byte 3-10:	Uptime [seconds]
 | 
			
		||||
	bytes 11-14: 	CPU temperature [°C]
 | 
			
		||||
 | 
			
		||||
**Port #3:** Device configuration query result
 | 
			
		||||
 | 
			
		||||
	byte 1: 	LoRa spread factor
 | 
			
		||||
	byte 2:		ADR mode on/off
 | 
			
		||||
	byte 3:		Screensaver on/off
 | 
			
		||||
	byte 4:		Display on/off
 | 
			
		||||
	byte 5:		Counter mode
 | 
			
		||||
	bytes 6-7: 	RSSI limit
 | 
			
		||||
	byte 8: 	Payload send cycle [sec/2]
 | 
			
		||||
	byte 9: 	Wifi channel switch cycle [sec/100]
 | 
			
		||||
	byte 10: 	Bluetooth scan duration [sec/100]
 | 
			
		||||
	byte 11: 	Bluetooth scanning on/off
 | 
			
		||||
	byte 12: 	Wifi antenna internal/external
 | 
			
		||||
	byte 13: 	Vendorfilter on/off
 | 
			
		||||
	byte 14: 	RGB Led luminosity [%]
 | 
			
		||||
	byte 15: 	GPS data on/off
 | 
			
		||||
	bytes 16-26: 	Software version [ASCII]
 | 
			
		||||
	byte 1:			Lora SF (7..12) [default 9]
 | 
			
		||||
	byte 2:			Lora TXpower (2..15) [default 15]
 | 
			
		||||
	byte 3:			Lora ADR (1=on, 0=off) [default 1]
 | 
			
		||||
	byte 4:			Screensaver status (1=on, 0=off) [default 0]
 | 
			
		||||
	byte 5:			Display status (1=on, 0=off) [default 0]
 | 
			
		||||
	byte 6:			Counter mode (0=cyclic unconfirmed, 1=cumulative, 2=cyclic confirmed) [default 0]
 | 
			
		||||
	bytes 7-8:		RSSI limiter threshold value (negative) [default 0]
 | 
			
		||||
	byte 9:			Lora Payload send cycle in seconds/2 (0..255) [default 120]
 | 
			
		||||
	byte 10:		Wifi channel switch interval in seconds/100 (0..255) [default 50]
 | 
			
		||||
	byte 11:		Bluetooth channel switch interval in seconds/100 (0..255) [efault 10]
 | 
			
		||||
	byte 12:		Bluetooth scanner status (1=on, 0=0ff) [default 1]
 | 
			
		||||
	byte 13:		Wifi antenna switch (0=internal, 1=external) [default 0]
 | 
			
		||||
	byte 14:		Vendorfilter mode (0=disabled, 1=enabled) [default 0]
 | 
			
		||||
	byte 15:		RGB LED luminosity (0..100 %) [default 30]
 | 
			
		||||
	byte 16:		GPS send data mode (1=on, 0=ff) [default 1]
 | 
			
		||||
	bytes 17-27:		Software version (ASCII format, terminating with zero)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
**Port #4:** GPS query result
 | 
			
		||||
 | 
			
		||||
	bytes 1-4:	Latitude
 | 
			
		||||
	bytes 5-8:	Longitude
 | 
			
		||||
	bytes 9-10:	Number of satellites
 | 
			
		||||
	bytes 11-12:	HDOP
 | 
			
		||||
	bytes 13-14:	Altitude [meter]
 | 
			
		||||
	byte 9:		Number of satellites
 | 
			
		||||
	bytes 10-11:	HDOP
 | 
			
		||||
	bytes 12-13:	Altitude [meter]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
[**plain_decoder.js**](src/TTN/plain_decoder.js)
 | 
			
		||||
@ -297,38 +299,16 @@ Note: all settings are stored in NVRAM and will be reloaded when device starts.
 | 
			
		||||
 | 
			
		||||
0x80 get device configuration
 | 
			
		||||
 | 
			
		||||
device answers with it's current configuration. The configuration is a C structure declared in file [main.h](src/main.h#L13-L31) with the following definition:
 | 
			
		||||
 | 
			
		||||
	byte 1:			Lora SF (7..12) [default 9]
 | 
			
		||||
	byte 2:			Lora TXpower (2..15) [default 15]
 | 
			
		||||
	byte 3:			Lora ADR (1=on, 0=off) [default 1]
 | 
			
		||||
	byte 4:			Screensaver status (1=on, 0=off) [default 0]
 | 
			
		||||
	byte 5:			Display status (1=on, 0=off) [default 0]
 | 
			
		||||
	byte 6:			Counter mode (0=cyclic unconfirmed, 1=cumulative, 2=cyclic confirmed) [default 0]
 | 
			
		||||
	bytes 7-8:		RSSI limiter threshold value (negative) [default 0]
 | 
			
		||||
	byte 9:			Lora Payload send cycle in seconds/2 (0..255) [default 120]
 | 
			
		||||
	byte 10:		Wifi channel switch interval in seconds/100 (0..255) [default 50]
 | 
			
		||||
	byte 11:		Bluetooth channel switch interval in seconds/100 (0..255) [efault 10]
 | 
			
		||||
	byte 12:		Bluetooth scanner status (1=on, 0=0ff) [default 1]
 | 
			
		||||
	byte 13:		Wifi antenna switch (0=internal, 1=external) [default 0]
 | 
			
		||||
	byte 14:		Vendorfilter mode (0=disabled, 1=enabled) [default 0]
 | 
			
		||||
	byte 15:		RGB LED luminosity (0..100 %) [default 30]
 | 
			
		||||
	byte 16:		GPS send data mode (1=on, 0=ff) [default 1]
 | 
			
		||||
	bytes 17-27:		Software version (ASCII format, terminating with zero)
 | 
			
		||||
	Device answers with it's current configuration on Port 3. 
 | 
			
		||||
 | 
			
		||||
0x81 get device status
 | 
			
		||||
 | 
			
		||||
	bytes 1-2:		Battery voltage in millivolt, 0 if unreadable
 | 
			
		||||
	bytes 3-10:		Uptime in seconds
 | 
			
		||||
	bytes 11-14:		Chip temperature in degrees celsius
 | 
			
		||||
	Device answers with it's current status on Port 2. 
 | 
			
		||||
	
 | 
			
		||||
0x84 get device GPS status
 | 
			
		||||
 | 
			
		||||
	bytes 1-4:		Latitude
 | 
			
		||||
	bytes 5-8:		Longitude
 | 
			
		||||
	byte 9:			Number of satellites
 | 
			
		||||
	byte 10-11:		HDOP
 | 
			
		||||
	bytes 12-13:		Altidute [meter]
 | 
			
		||||
	Device answers with it's current status on Port 4. 
 | 
			
		||||
 | 
			
		||||
	
 | 
			
		||||
# License
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -11,8 +11,8 @@
 | 
			
		||||
 | 
			
		||||
; ---> SELECT TARGET PLATFORM HERE! <---
 | 
			
		||||
[platformio]
 | 
			
		||||
env_default = generic
 | 
			
		||||
;env_default = heltec
 | 
			
		||||
;env_default = generic
 | 
			
		||||
env_default = heltec
 | 
			
		||||
;env_default = ttgov1
 | 
			
		||||
;env_default = ttgov2
 | 
			
		||||
;env_default = ttgov21
 | 
			
		||||
 | 
			
		||||
@ -24,7 +24,7 @@ function Decoder(bytes, port) {
 | 
			
		||||
 | 
			
		||||
    if (port === 3) {
 | 
			
		||||
        // device config data      
 | 
			
		||||
        return decode(bytes, [uint8, uint16, uint8, uint8, uint8, uint8, bitmap], ['lorasf', 'rssilimit', 'sendcycle', 'wifichancycle', 'blescantime', 'rgblum', 'flags']);
 | 
			
		||||
        return decode(bytes, [uint8, uint8, uint16, uint8, uint8, uint8, uint8, bitmap], ['lorasf', 'txpower', 'rssilimit', 'sendcycle', 'wifichancycle', 'blescantime', 'rgblum', 'flags']);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (port === 4) {
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										10
									
								
								src/main.cpp
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								src/main.cpp
									
									
									
									
									
								
							@ -1,5 +1,6 @@
 | 
			
		||||
/*
 | 
			
		||||
ESP32-Paxcounter
 | 
			
		||||
 | 
			
		||||
//////////////////////// ESP32-Paxcounter \\\\\\\\\\\\\\\\\\\\\\\\\\
 | 
			
		||||
 | 
			
		||||
Copyright  2018 Oliver Brandmueller <ob@sysadm.in>
 | 
			
		||||
Copyright  2018 Klaus Wilting <verkehrsrot@arcor.de>
 | 
			
		||||
@ -28,11 +29,10 @@ licenses. Refer to LICENSE.txt file in repository for more details.
 | 
			
		||||
// Initialize global variables
 | 
			
		||||
configData_t cfg; // struct holds current device configuration
 | 
			
		||||
char display_line6[16], display_line7[16]; // display buffers
 | 
			
		||||
uint64_t uptimecounter = 0;                // timer global for uptime counter
 | 
			
		||||
uint8_t DisplayState = 0;                  // globals for state machine
 | 
			
		||||
uint8_t DisplayState = 0, channel = 0;     // globals for state machine
 | 
			
		||||
uint16_t macs_total = 0, macs_wifi = 0,
 | 
			
		||||
         macs_ble = 0; // MAC counters globals for display
 | 
			
		||||
uint8_t channel = 0;   // wifi channel rotation counter global for display
 | 
			
		||||
         macs_ble = 0;      // MAC counters globals for display
 | 
			
		||||
uint64_t uptimecounter = 0; // timer global for uptime counter
 | 
			
		||||
hw_timer_t *channelSwitch = NULL, *displaytimer = NULL,
 | 
			
		||||
           *sendCycle = NULL; // configure hardware timer for cyclic tasks
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -39,8 +39,6 @@
 | 
			
		||||
#define PROGVERSION "1.3.91" // use max 10 chars here!
 | 
			
		||||
#define PROGNAME "PAXCNT"
 | 
			
		||||
 | 
			
		||||
//--- Declarations ---
 | 
			
		||||
 | 
			
		||||
// Struct holding devices's runtime configuration
 | 
			
		||||
typedef struct {
 | 
			
		||||
  uint8_t lorasf;      // 7-12, lora spreadfactor
 | 
			
		||||
 | 
			
		||||
@ -44,6 +44,7 @@ void TTNplain::addGPS(gpsStatus_t value) {
 | 
			
		||||
 | 
			
		||||
void TTNplain::addConfig(configData_t value) {
 | 
			
		||||
  buffer[cursor++] = value.lorasf;
 | 
			
		||||
  buffer[cursor++] = value.txpower;
 | 
			
		||||
  buffer[cursor++] = value.adrmode;
 | 
			
		||||
  buffer[cursor++] = value.screensaver;
 | 
			
		||||
  buffer[cursor++] = value.screenon;
 | 
			
		||||
@ -112,6 +113,7 @@ void TTNpacked::addGPS(gpsStatus_t value) {
 | 
			
		||||
 | 
			
		||||
void TTNpacked::addConfig(configData_t value) {
 | 
			
		||||
  writeUint8(value.lorasf);
 | 
			
		||||
  writeUint8(value.txpower);
 | 
			
		||||
  writeUint16(value.rssilimit);
 | 
			
		||||
  writeUint8(value.sendcycle);
 | 
			
		||||
  writeUint8(value.wifichancycle);
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user