Merge pull request #94 from cyberman54/development

v1.3.81
This commit is contained in:
Verkehrsrot 2018-06-12 12:44:47 +02:00 committed by GitHub
commit e60f8b03b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 887 additions and 699 deletions

108
.clang-format Normal file
View File

@ -0,0 +1,108 @@
---
Language: Cpp
# BasedOnStyle: LLVM
AccessModifierOffset: -2
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Right
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: false
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Attach
BreakBeforeInheritanceComma: false
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeColon
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 80
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 2
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
Priority: 3
- Regex: '.*'
Priority: 1
IncludeIsMainRegex: '(Test)?$'
IndentCaseLabels: false
IndentWidth: 2
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: true
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Right
ReflowComments: true
SortIncludes: false
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp11
TabWidth: 8
UseTab: Never
...

View File

@ -264,41 +264,42 @@ Note: all settings are stored in NVRAM and will be reloaded when device starts.
0x80 get device configuration 0x80 get device configuration
device answers with it's current configuration. The configuration is a C structure declared in file [globals.h](src/globals.h#L27-L44) with the following definition: device answers with it's current configuration. The configuration is a C structure declared in file [globals.h](src/globals.h#L32-L50) with the following definition:
byte 1: Lora SF (7..12) byte 1: Lora SF (7..12) [default 9]
byte 2: Lora TXpower (2..15) byte 2: Lora TXpower (2..15) [default 15]
byte 3: Lora ADR (1=on, 0=off) byte 3: Lora ADR (1=on, 0=off) [default 1]
byte 4: Screensaver status (1=on, 0=off) byte 4: Screensaver status (1=on, 0=off) [default 0]
byte 5: Display status (1=on, 0=off) byte 5: Display status (1=on, 0=off) [default 0]
byte 6: Counter mode (0=cyclic unconfirmed, 1=cumulative, 2=cyclic confirmed) byte 6: Counter mode (0=cyclic unconfirmed, 1=cumulative, 2=cyclic confirmed) [default 0]
bytes 7-8: RSSI limiter threshold value (negative) bytes 7-8: RSSI limiter threshold value (negative) [default 0]
byte 9: Lora Payload send cycle in seconds/2 (0..255) byte 9: Lora Payload send cycle in seconds/2 (0..255) [default 120]
byte 10: Wifi channel switch interval in seconds/100 (0..255) byte 10: Wifi channel switch interval in seconds/100 (0..255) [default 50]
byte 11: Bluetooth channel switch interval in seconds/100 (0..255) byte 11: Bluetooth channel switch interval in seconds/100 (0..255) [efault 10]
byte 12: Bluetooth scanner status (1=on, 0=0ff) byte 12: Bluetooth scanner status (1=on, 0=0ff) [default 1]
byte 13: Wifi antenna switch (0=internal, 1=external) byte 13: Wifi antenna switch (0=internal, 1=external) [default 0]
byte 14: Vendorfilter mode (0=disabled, 1=enabled) byte 14: Vendorfilter mode (0=disabled, 1=enabled) [default 0]
byte 15: RGB LED luminosity (0..100 %) byte 15: RGB LED luminosity (0..100 %) [default 30]
bytes 16-26: Software version (ASCII format, terminating with zero) byte 16: GPS send data mode (1=on, 0=ff) [default 1]
bytes 17-27: Software version (ASCII format, terminating with zero)
0x81 get device uptime 0x81 get device uptime
bytes 1-8: uptime in seconds (little endian format) bytes 1-8: Uptime in seconds (little endian format)
0x82 get device cpu temperature 0x82 get device cpu temperature
bytes 1-4: chip temperature in degrees celsius (little endian format) bytes 1-4: Chip temperature in degrees celsius (little endian format)
0x83 get device battery voltage 0x83 get device battery voltage
bytes 1-2: battery voltage in millivolt, 0 if unreadable (little endian format) bytes 1-2: Battery voltage in millivolt, 0 if unreadable (little endian format)
0x84 get device GPS status 0x84 get device GPS status
bytes 1-4: latitude bytes 1-4: Latitude
bytes 5-8: longitude bytes 5-8: Longitude
byte 9-10: number of satellites byte 9-10: Number of satellites
byte 11-12: HDOP byte 11-12: HDOP
bytes 13-14: altidute [meter] bytes 13-14: altidute [meter]

View File

@ -11,11 +11,11 @@
; ---> SELECT TARGET PLATFORM HERE! <--- ; ---> SELECT TARGET PLATFORM HERE! <---
[platformio] [platformio]
env_default = heltec ;env_default = heltec
;env_default = ttgov1 ;env_default = ttgov1
;env_default = ttgov2 ;env_default = ttgov2
;env_default = ttgov21 ;env_default = ttgov21
;env_default = ttgobeam env_default = ttgobeam
;env_default = lopy ;env_default = lopy
;env_default = lopy4 ;env_default = lopy4
;env_default = fipy ;env_default = fipy

View File

@ -16,7 +16,9 @@
#define PIN_SPI_SCK GPIO_NUM_5 // ESP32 GPIO5 (Pin5) -- HPD13A SCK (Pin5) SPI Clock Input #define PIN_SPI_SCK GPIO_NUM_5 // ESP32 GPIO5 (Pin5) -- HPD13A SCK (Pin5) SPI Clock Input
// non arduino pin definitions // non arduino pin definitions
#define RST LMIC_UNUSED_PIN // connected to ESP32 RST/EN #define RST LMIC_UNUSED_PIN // connected to ESP32 RST/EN
#define DIO0 GPIO_NUM_26 // ESP32 GPIO26 <-> HPD13A IO0 #define DIO0 GPIO_NUM_26 // ESP32 GPIO26 <-> HPD13A IO0
#define DIO1 GPIO_NUM_33 // Lora1 <-> HPD13A IO1 // !! NEEDS EXTERNAL WIRING !! #define DIO1 GPIO_NUM_32 // Lora1 <-> HPD13A IO1 // !! NEEDS EXTERNAL WIRING !!
#define DIO2 LMIC_UNUSED_PIN // Lora2 <-> HPD13A IO2 // needs external wiring, but not necessary for LoRa, only FSK #define DIO2 \
LMIC_UNUSED_PIN // Lora2 <-> HPD13A IO2 // needs external wiring, but not
// necessary for LoRa, only FSK

View File

@ -105,29 +105,55 @@ void printKeys(void) {
#endif // VERBOSE #endif // VERBOSE
void do_send(osjob_t* j){ void do_send(osjob_t *j) {
// Schedule next transmission
os_setTimedCallback(&sendjob, os_getTime() + sec2osticks(cfg.sendcycle * 2),
do_send);
// Check if there is a pending TX/RX job running // Check if there is a pending TX/RX job running
if (LMIC.opmode & OP_TXRXPEND) { if (LMIC.opmode & OP_TXRXPEND) {
ESP_LOGI(TAG, "LoRa busy, rescheduling"); ESP_LOGI(TAG, "LoRa busy, rescheduling");
sprintf(display_lmic, "LORA BUSY"); sprintf(display_lmic, "LORA BUSY");
goto end; return;
} }
// prepare payload with sum of unique WIFI MACs seen // prepare payload with sum of unique WIFI MACs seen
static uint8_t mydata[4]; static uint8_t mydata[4];
mydata[0] = (macs_wifi & 0xff00) >> 8; mydata[0] = (macs_wifi & 0xff00) >> 8;
mydata[1] = macs_wifi & 0xff; mydata[1] = macs_wifi & 0xff;
if (cfg.blescan) { if (cfg.blescan) {
// append sum of unique BLE MACs seen to payload // append sum of unique BLE MACs seen to payload
mydata[2] = (macs_ble & 0xff00) >> 8; mydata[2] = (macs_ble & 0xff00) >> 8;
mydata[3] = macs_ble & 0xff; mydata[3] = macs_ble & 0xff;
} else { } else {
mydata[2] = 0; mydata[2] = 0;
mydata[3] = 0; mydata[3] = 0;
} }
#ifdef HAS_GPS
static uint8_t gpsdata[18];
if (cfg.gpsmode && gps.location.isValid()) {
gps_read();
memcpy(gpsdata, mydata, 4);
memcpy(gpsdata + 4, &gps_status, sizeof(gps_status));
ESP_LOGI(TAG, "lat=%.6f / lon=%.6f | %u Sats | HDOP=%.1f | Altitude=%u m",
gps_status.latitude / (float)1000000,
gps_status.longitude / (float)1000000, gps_status.satellites,
gps_status.hdop / (float)100, gps_status.altitude);
LMIC_setTxData2(COUNTERPORT, gpsdata, sizeof(gpsdata),
(cfg.countermode & 0x02));
ESP_LOGI(TAG, "%d bytes queued to send", sizeof(gpsdata));
} else {
#endif
LMIC_setTxData2(COUNTERPORT, mydata, sizeof(mydata),
(cfg.countermode & 0x02));
ESP_LOGI(TAG, "%d bytes queued to send", sizeof(mydata));
#ifdef HAS_GPS
}
#endif
sprintf(display_lmic, "PACKET QUEUED");
#ifdef HAS_GPS #ifdef HAS_GPS
static uint8_t gpsdata[18]; static uint8_t gpsdata[18];
@ -161,10 +187,6 @@ void do_send(osjob_t* j){
ESP_LOGI(TAG, "Counter cleared (countermode = %d)", cfg.countermode); ESP_LOGI(TAG, "Counter cleared (countermode = %d)", cfg.countermode);
} }
// Schedule next transmission
end:
os_setTimedCallback(&sendjob, os_getTime()+sec2osticks(cfg.sendcycle * 2), do_send);
} // do_send() } // do_send()
void onEvent (ev_t ev) { void onEvent (ev_t ev) {

File diff suppressed because it is too large Load Diff

View File

@ -3,9 +3,10 @@
#include "lorawan.h" #include "lorawan.h"
#include "macsniff.h" #include "macsniff.h"
// program version - note: increment version after modifications to configData_t struct!! // program version - note: increment version after modifications to configData_t
#define PROGVERSION "1.3.8" // use max 10 chars here! // struct!!
#define PROGNAME "PAXCNT" #define PROGVERSION "1.3.81" // use max 10 chars here!
#define PROGNAME "PAXCNT"
//--- Declarations --- //--- Declarations ---
@ -36,6 +37,12 @@ void led_loop(void);
//defined in gpsread.cpp //defined in gpsread.cpp
#ifdef HAS_GPS #ifdef HAS_GPS
<<<<<<< HEAD
void gps_read(void);
void gps_loop(void *pvParameters);
#endif
=======
void gps_read(void); void gps_read(void);
void gps_loop(void * pvParameters); void gps_loop(void * pvParameters);
#endif #endif
>>>>>>> master