Skip to content

Commit cc2db05

Browse files
authored
Merge pull request #34 from tobozo/unstable
Unstable
2 parents 5d5bd18 + e4b71ee commit cc2db05

13 files changed

+582
-455
lines changed

.travis.yml

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
language: python
2+
python: 3.6
3+
4+
5+
sudo: required
6+
7+
env:
8+
global:
9+
# The Arduino IDE will be installed at APPLICATION_FOLDER/arduino
10+
- APPLICATION_FOLDER="${HOME}/arduino-ide"
11+
- SKETCHBOOK_FOLDER="${HOME}/arduino-sketchbook"
12+
13+
before_install:
14+
15+
# TODO: undo
16+
# remove submodules, we don't want those to be actually tested for compliance
17+
- git submodule status | rm -Rf `cut -d ' ' -f 3`
18+
19+
# Formatting checks:
20+
# Check for files starting with a blank line
21+
- find . -type d \( -path './.git' -o -path './examples' -o -path './src/Fonts' \) -prune -or -type f -print0 | xargs -0 -L1 bash -c 'head -1 "$0" | grep --binary-files=without-match --regexp="^$"; if [[ "$?" == "0" ]]; then echo "Blank line found at start of $0."; false; fi'
22+
# don't check for tabs
23+
- find . -type d \( -path './.git' -o -path './examples' -o -path './src/Fonts' \) -prune -or -type f \( ! -iname ".gitmodules" \) -exec grep --with-filename --line-number --binary-files=without-match --regexp=$'\t' '{}' \; -exec echo 'Tab found.' \; -exec false '{}' +
24+
# Check for trailing whitespace
25+
- find . -type d \( -path './.git' -o -path './examples' -o -path './src/Fonts' \) -prune -or -type f -exec grep --with-filename --line-number --binary-files=without-match --regexp='[[:blank:]]$' '{}' \; -exec echo 'Trailing whitespace found.' \; -exec false '{}' +
26+
# Check for non-Unix line endings
27+
- find . -type d \( -path './.git' -o -path './examples' -o -path './src/Fonts' \) -prune -or -type f -exec grep --files-with-matches --binary-files=without-match --regexp=$'\r$' '{}' \; -exec echo 'Non-Unix EOL detected.' \; -exec false '{}' +
28+
# Check for blank lines at end of files
29+
- find . -type d \( -path './.git' -o -path './examples' -o -path './src/Fonts' \) -prune -or -type f -print0 | xargs -0 -L1 bash -c 'tail -1 "$0" | grep --binary-files=without-match --regexp="^$"; if [[ "$?" == "0" ]]; then echo "Blank line found at end of $0."; false; fi'
30+
# Check for files that don't end in a newline (https://stackoverflow.com/a/25686825)
31+
- find . -type d \( -path './.git' -o -path './examples' -o -path './src/Fonts' \) -prune -or -type f -print0 | xargs -0 -L1 bash -c 'if test "$(grep --files-with-matches --binary-files=without-match --max-count=1 --regexp='.*' "$0")" && test "$(tail --bytes=1 "$0")"; then echo "No new line at end of $0."; false; fi'
32+
33+
- git clone https://github.com/per1234/arduino-ci-script.git "${HOME}/scripts/arduino-ci-script"
34+
- cd "${HOME}/scripts/arduino-ci-script"
35+
# Get new tags from the remote
36+
- git fetch --tags
37+
# Checkout the latest tag
38+
- git checkout $(git describe --tags `git rev-list --tags --max-count=1`)
39+
- source "${HOME}/scripts/arduino-ci-script/arduino-ci-script.sh"
40+
41+
#- set_script_verbosity 1
42+
#- set_verbose_output_during_compilation "true"
43+
44+
# Check for library issues that don't affect compilation
45+
- set_library_testing "true"
46+
47+
- set_application_folder "$APPLICATION_FOLDER"
48+
- set_sketchbook_folder "$SKETCHBOOK_FOLDER"
49+
50+
#- install_ide '("1.8.0" "1.8.10" "1.8.11")'
51+
- install_ide '("newest")'
52+
53+
# Install the library from the repository
54+
#- install_library ESP32-Chimera-Core
55+
- install_library https://github.com/tobozo/ESP32-Chimera-Core/archive/master.zip
56+
- install_library https://github.com/PaulStoffregen/Time/archive/master.zip
57+
- install_library M5Stack-SD-Updater
58+
- install_library Sqlite3Esp32
59+
- install_library https://github.com/tobozo/ESP32-BLECollector/releases/download/1.3/BLE.zip
60+
- install_package "esp32:esp32" "https://dl.espressif.com/dl/package_esp32_index.json" # # esp32:esp32:m5stack-core-esp32
61+
- pip install pyserial
62+
63+
script:
64+
# Compile all example sketches included with the library
65+
# build_sketch arguments: sketch name, fqbn, allow failure, IDE version/list/range
66+
- check_library_manager_compliance "$TRAVIS_BUILD_DIR"
67+
# compile at least one basic example
68+
- set_ide_preference "compiler.warning_level=auto"
69+
70+
- mkdir "/tmp/BLECollector-binaries"
71+
- mkdir "/tmp/m5stack"
72+
- mkdir "/tmp/odroidgo"
73+
- mkdir "/tmp/m5fire"
74+
75+
#- set_ide_preference "custom_PartitionScheme=min_spiffs"
76+
- set_ide_preference "build.path=/tmp/m5stack"
77+
- build_sketch "${TRAVIS_BUILD_DIR}/ESP32-BLECollector.ino" "esp32:esp32:m5stack-core-esp32:PartitionScheme=min_spiffs" "false" "newest"
78+
- cp "/tmp/m5stack/ESP32-BLECollector.ino.bin" "/tmp/BLECollector-binaries/M5stack-BLECollector.bin"
79+
- set_ide_preference "build.path=/tmp/odroidgo"
80+
- build_sketch "${TRAVIS_BUILD_DIR}/ESP32-BLECollector.ino" "esp32:esp32:odroid_esp32:PartitionScheme=min_spiffs" "false" "newest"
81+
- cp "/tmp/odroidgo/ESP32-BLECollector.ino.bin" "/tmp/BLECollector-binaries/OdroidGo-BLECollector.bin"
82+
- set_ide_preference "build.path=/tmp/m5fire"
83+
- build_sketch "${TRAVIS_BUILD_DIR}/ESP32-BLECollector.ino" "esp32:esp32:m5stack-fire:PartitionScheme=default" "false" "newest"
84+
- cp "/tmp/m5fire/ESP32-BLECollector.ino.bin" "/tmp/BLECollector-binaries/M5Fire-BLECollector.bin"
85+
- ls /tmp/BLECollector-binaries -la
86+
87+
#- if [ "$TRAVIS_BRANCH" != "master" ]; then echo "This commit was made against the $TRAVIS_BRANCH, skipping examples compilation"; exit 0; fi
88+
#- if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then echo "This is a pull request, skipping examples compilation"; exit 0; fi
89+
90+
after_script:
91+
# Commit a report of the job results to the CI-reports repository
92+
#- USER_NAME="$(echo "$TRAVIS_REPO_SLUG" | cut -d'/' -f 1)"
93+
#- REPOSITORY_NAME="$(echo "$TRAVIS_REPO_SLUG" | cut -d'/' -f 2)"
94+
#- publish_report_to_repository "$REPORT_GITHUB_TOKEN" "https://github.com/${USER_NAME}/CI-reports.git" "$REPOSITORY_NAME" "build_$(printf "%05d\n" "${TRAVIS_BUILD_NUMBER}")" "false"
95+
# Print a tab separated report of all sketch verification results to the log
96+
- display_report
97+
98+
notifications:
99+
email:
100+
on_success: always
101+
on_failure: always
102+
webhooks:
103+
urls:
104+
- https://www.travisbuddy.com/
105+
on_success: never
106+
on_failure: always
107+
108+
deploy:
109+
- provider: releases
110+
api_key: "${GH_TOKEN}"
111+
file:
112+
- "/tmp/BLECollector-binaries/M5stack-BLECollector.bin"
113+
- "/tmp/BLECollector-binaries/OdroidGo-BLECollector.bin"
114+
- "/tmp/BLECollector-binaries/M5Fire-BLECollector.bin"
115+
#skip_cleanup: true
116+
# draft: true
117+
on:
118+
branch: master

Assets.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1771,7 +1771,7 @@ const unsigned char disk00_jpg[] /* 30x30 */= {
17711771
0x2e, 0xe9, 0x3f, 0x6d, 0x5f, 0x02, 0x49, 0xf7, 0xca, 0x64, 0x0f, 0xf8,
17721772
0x27, 0x4f, 0xec, 0x0a, 0xa1, 0xdd, 0xd6, 0x32, 0x4c, 0x85, 0x42, 0x29,
17731773
0x50, 0xbb, 0x02, 0x22, 0x00, 0x49, 0x52, 0xce, 0x01, 0xff, 0xd9
1774-
};
1774+
};
17751775

17761776
const unsigned int disk00_jpg_len = 1775;
17771777

BLECache.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ class BlueToothDeviceHelper {
177177
CacheItem->appearance = 0;
178178
CacheItem->rssi = 0;
179179
CacheItem->manufid = -1;
180-
if( hasPsram ) {
180+
if( hasPsram ) {
181181
CacheItem->name = (char*)ps_calloc(MAX_FIELD_LEN+1, sizeof(char));
182182
CacheItem->address = (char*)ps_calloc(MAC_LEN+1, sizeof(char));
183183
CacheItem->ouiname = (char*)ps_calloc(MAX_FIELD_LEN+1, sizeof(char));
@@ -278,9 +278,9 @@ class BlueToothDeviceHelper {
278278
set(CacheItem, "address", advertisedDevice.getAddress().toString().c_str());
279279
set(CacheItem, "rssi", advertisedDevice.getRSSI());
280280
set(CacheItem, "addr_type", advertisedDevice.getAddressType());
281-
if( advertisedDevice.getAddressType() == BLE_ADDR_TYPE_RANDOM
281+
if( advertisedDevice.getAddressType() == BLE_ADDR_TYPE_RANDOM
282282
|| advertisedDevice.getAddressType() == BLE_ADDR_TYPE_RPA_RANDOM ) {
283-
set(CacheItem, "ouiname", "[random]");
283+
set(CacheItem, "ouiname", "[random]");
284284
} else {
285285
set(CacheItem, "ouiname", "[unpopulated]");
286286
}
@@ -367,7 +367,7 @@ class BlueToothDeviceHelper {
367367
i++;
368368
}
369369
return "Unknown";
370-
} // gattServiceToString
370+
} // gattServiceToString
371371

372372
static uint16_t getNextCacheIndex( BlueToothDevice **CacheItem, uint16_t CacheItemIndex ) {
373373
uint16_t minCacheValue = 65535;

DateTime.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
-----------------------------------------------------------------------------
2727
2828
This wrapper mainly exists to supply friend methods to the RTC Library based on JeeLabs's code http://news.jeelabs.org/code/
29-
The changes are added dependencies to PaulStoffregen's Time library https://github.com/PaulStoffregen/Time/
29+
The changes are added dependencies to PaulStoffregen's Time library https://github.com/PaulStoffregen/Time/
3030
3131
*/
3232

@@ -72,7 +72,7 @@ DateTime::DateTime(uint32_t unixtime) {
7272
hh = tm.Hour;
7373
mm = tm.Minute;
7474
ss = tm.Second;
75-
yOff = tm.Year; // offset from 1970;
75+
yOff = tm.Year; // offset from 1970;
7676
};
7777
DateTime::DateTime(tmElements_t dateTimeNow) {
7878
tm = dateTimeNow;
@@ -81,7 +81,7 @@ DateTime::DateTime(tmElements_t dateTimeNow) {
8181
hh = tm.Hour;
8282
mm = tm.Minute;
8383
ss = tm.Second;
84-
yOff = tm.Year; // offset from 1970;
84+
yOff = tm.Year; // offset from 1970;
8585
};
8686
DateTime::DateTime(uint16_t year, uint8_t month, uint8_t day, uint8_t hour, uint8_t min, uint8_t sec) {
8787
if (year >= 1970)
@@ -99,7 +99,7 @@ DateTime::DateTime (const char* date, const char* time) {
9999
// DateTime now (__DATE__, __TIME__);
100100
// sample input: date = "Dec 26 2009", time = "12:34:56"
101101
yOff = DateTimeConv2d(date + 9) + 30; // 2000 offset to 1970 offset
102-
// Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
102+
// Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
103103
switch (date[0]) {
104104
case 'J': m = (date[1] == 'a') ? 1 : (date[2] == 'n') ? 6 : 7; break;
105105
case 'F': m = 2; break;
@@ -129,8 +129,8 @@ uint32_t DateTime::tm2unixtime(tmElements_t tm_) {
129129

130130
// for debug
131131

132-
void dumpTime(const char* message, DateTime dateTime) {
133-
Serial.printf("[%s]: %04d-%02d-%02d %02d:%02d:%02d\n",
132+
void dumpTime(const char* message, DateTime dateTime) {
133+
Serial.printf("[%s]: %04d-%02d-%02d %02d:%02d:%02d\n",
134134
message,
135135
dateTime.year(),
136136
dateTime.month(),
@@ -142,7 +142,7 @@ void dumpTime(const char* message, DateTime dateTime) {
142142
}
143143

144144
void dumpTime(const char* message, tmElements_t tm) {
145-
Serial.printf("[%s]: %04d-%02d-%02d %02d:%02d:%02d\n",
145+
Serial.printf("[%s]: %04d-%02d-%02d %02d:%02d:%02d\n",
146146
message,
147147
tm.Year + 1970,
148148
tm.Month,

GPS.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/*\
2+
* GPS Helpers
3+
\*/
4+
15

26
HardwareSerial GPS(1); // uart 1
37
#define GPS_RX 39 // io pin number

NTP.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
1+
/*\
2+
* NTP Helpers
3+
\*/
24

35
// returns true if time has been updated
46
static bool checkForTimeUpdate( DateTime &internalDateTime ) {
@@ -35,7 +37,7 @@ static bool checkForTimeUpdate( DateTime &internalDateTime ) {
3537
#if HAS_EXTERNAL_RTC // have external RTC, adjust internal RTC accordingly
3638
setTime( externalDateTime.unixtime() );
3739
if(drift > 5) {
38-
log_e("[***** WTF Clocks don't agree after adjustment] %d - %d = %d", internalDateTime.unixtime(), externalDateTime.unixtime(), drift);
40+
log_e("[***** WTF Clocks don't agree after adjustment] %d - %d = %d", internalDateTime.unixtime(), externalDateTime.unixtime(), drift);
3941
} else {
4042
log_i("[***** OK Clocks agree-ish] %d - %d = %d", internalDateTime.unixtime(), externalDateTime.unixtime(), drift);
4143
}
@@ -52,7 +54,7 @@ void TimeInit() {
5254
lastSyncDateTime = preferences.getUInt("epoch", millis());
5355
byte clockUpdateSource = preferences.getUChar("source", 0);
5456
preferences.end();
55-
sprintf(YYYYMMDD_HHMMSS_Str, YYYYMMDD_HHMMSS_Tpl,
57+
sprintf(YYYYMMDD_HHMMSS_Str, YYYYMMDD_HHMMSS_Tpl,
5658
lastSyncDateTime.year(),
5759
lastSyncDateTime.month(),
5860
lastSyncDateTime.day(),

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Software requirements
4343
- [mandatory] https://github.com/siara-cc/esp32_arduino_sqlite3_lib
4444
- [optional] https://github.com/mikalhart/TinyGPSPlus
4545

46-
Behaviours (auto-selected):
46+
Behaviours (auto-selected):
4747
---------------------------
4848
- **Hobo**: when no TinyRTC module exists in your build, only uptime will be displayed
4949
- **Rogue**: TinyRTC module adjusted after flashing (build DateTime), shares time over BLE
@@ -55,7 +55,7 @@ Optional I2C RTC Module requirements
5555
- Insert the SD Card
5656
- Set `#define HAS_EXTERNAL_RTC true` in [Settings.h](https://github.com/tobozo/ESP32-BLECollector/blob/master/Settings.h)
5757
- Flash the ESP with partition scheme `Minimal SPIFFS (Large APPS with OTA)`
58-
58+
5959
Optional Serial GPS Module requirements
6060
---------------------------------------
6161
- Wire your GPS module to TX1/RX1 (edit `GPS_RX` and `GPS_TX` in GPS.h
@@ -68,7 +68,7 @@ Time Sharing
6868
------------
6969
- Once the time is set using RTC and/or GPS, the BLECollector will start the TimeSharing service and advertise a DateTime characteristic for other BLECollectors to sync with.
7070
- Builds with no RTC/GPS will try to identify this service during their scan duty cycle and subscribe for notifications.
71-
71+
7272
File Sharing (still experimental)
7373
------------
7474
- This feature is currently limited to sharing the two necessary .db files, if at least one of those files is missing or corrupted at boot, the BLECollector will start a BLE File server and wait for another BLECollector to send those files.

RTC.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ uint32_t BLE_RTC_DS1307::unixtime() {
7474
}
7575
uint8_t BLE_RTC_DS1307::isrunning(void) {
7676
Wire.beginTransmission(DS1307_ADDR);
77-
Wire.write(ZEROINT);
77+
Wire.write(ZEROINT);
7878
Wire.endTransmission();
7979
Wire.requestFrom(DS1307_ADDR, 1);
8080
uint8_t ss = Wire.read();
@@ -96,7 +96,7 @@ void BLE_RTC_DS1307::adjust(const tmElements_t& dt) {
9696
}
9797
tmElements_t BLE_RTC_DS1307::now() {
9898
Wire.beginTransmission(DS1307_ADDR);
99-
Wire.write(ZEROINT);
99+
Wire.write(ZEROINT);
100100
Wire.endTransmission();
101101
Wire.requestFrom(DS1307_ADDR, 7);
102102
uint8_t ss = BLE_RTC_bcd2bin(Wire.read() & 0x7F);

SDUtils.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
/*\
2+
* SD Helpers
3+
\*/
14

25
static bool sd_mounted = false;
36

ScrollPanel.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ class ScrollableOutput {
102102
// draw rounded corners boxes inside the scroll view, with scroll limit overlap support
103103
void drawScrollableRoundRect(uint16_t x, uint16_t y, uint16_t _width, uint16_t _height, uint16_t radius, uint16_t bordercolor, bool fill = false ) {
104104
int yStart = translate(y, 0); // get the scrollview-translated y position
105-
if ( yStart >= scrollTopFixedArea && (yStart+_height)<(height-scrollBottomFixedArea) ) {
105+
if ( yStart >= scrollTopFixedArea && (yStart+_height)<(height-scrollBottomFixedArea) ) {
106106
// no scroll loop point overlap, just render the translated box using the native method
107107
log_d("Rendering native x:%d, y:%d, width:%d, height:%d, radius:%d", x, y, _width, _height, radius);
108108
if( fill ) {

UI.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
/*
32
43
ESP32 BLE Collector - A BLE scanner with sqlite data persistence on the SD Card

UI_Icons.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/*\
2+
* UI Icons
3+
\*/
4+
15

26
#include "Assets.h" // bitmaps
37

@@ -524,4 +528,3 @@ void BLERssiIconUpdateCB( uint16_t posX, uint16_t posY, uint16_t bgcolor ) {
524528

525529

526530
IconBar BLECollectorIconBar;
527-

0 commit comments

Comments
 (0)