Skip to content

Commit 9ff041e

Browse files
authored
Merge pull request #4 from FreeSK8/0.9.1
0.9.1
2 parents fad26ce + 847a1f9 commit 9ff041e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+2619
-1048
lines changed

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,8 @@ SRC_FILES += \
123123
$(SDK_ROOT)/integration/nrfx/legacy/nrf_drv_ppi.c \
124124
$(SDK_ROOT)/modules/nrfx/drivers/src/nrfx_ppi.c \
125125
$(SDK_ROOT)/modules/nrfx/drivers/src/nrfx_qspi.c \
126-
littlefs/lfs.c \
127-
littlefs/lfs_util.c \
126+
littlefs-2.4.0/lfs.c \
127+
littlefs-2.4.0/lfs_util.c \
128128
ble_fus.c \
129129
rtc.c \
130130
uart_gps/gps_uart_fifo.c \
@@ -285,7 +285,7 @@ INC_FOLDERS += \
285285
. \
286286
sdk_mod \
287287
SSD1306 \
288-
littlefs/ \
288+
littlefs-2.4.0/ \
289289
uart_gps \
290290
lwgps/src/include/ \
291291
$(SDK_ROOT)/components/ble/nrf_ble_gq/ \

SSD1306/Adafruit_GFX.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,12 +356,19 @@ void Adafruit_GFX_drawBitmap(int16_t x, int16_t y,
356356
}
357357
}
358358

359-
void Adafruit_GFX_print(char * buffer) {
359+
static bool _updating_display_buffer = false;
360+
void Adafruit_GFX_print(char * buffer, int16_t x, int16_t y) {
361+
if (_updating_display_buffer) {
362+
return;
363+
}
364+
_updating_display_buffer = true;
365+
Adafruit_GFX_setCursor(x,y);
360366
int index = 0;
361367
while( buffer[index] != 0 )
362368
{
363369
Adafruit_GFX_write((uint8_t)buffer[index++]);
364370
}
371+
_updating_display_buffer = false;
365372
}
366373

367374
void Adafruit_GFX_write(uint8_t c) {

SSD1306/Adafruit_GFX.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ void Adafruit_GFX_drawBitmap(int16_t x, int16_t y,
8181
void Adafruit_GFX_drawChar(int16_t x, int16_t y, unsigned char c,
8282
uint16_t color, uint16_t bg, uint8_t size);
8383

84-
void Adafruit_GFX_print(char * buffer);
84+
void Adafruit_GFX_print(char * buffer, int16_t x, int16_t y);
8585
void Adafruit_GFX_write(uint8_t);
8686

8787
void Adafruit_GFX_setCursor(int16_t x, int16_t y);

command_interface.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ extern volatile bool update_rtc;
2929
extern volatile bool log_file_active;
3030

3131
static lfs_file_t file_command_interface;
32-
static uint8_t lfs_file_buf[256]; // Must be cache size
32+
static uint8_t lfs_file_buf[4096]; // Must be cache size
3333
static struct lfs_file_config lfs_file_config;
3434
static lfs_dir_t directory;
3535
static int32_t bytes_sent = -1; //file.ctz.size;
@@ -241,7 +241,7 @@ void command_interface_process_byte(char incoming)
241241
}
242242
else if(strncmp(command_input_buffer, "version", 7) == 0)
243243
{
244-
sprintf((char *)command_response_buffer, "version,0.9.0,beta");
244+
sprintf((char *)command_response_buffer, "version,0.9.1,beta");
245245
m_ble_tx_logbuffer(command_response_buffer, strlen((const char *)command_response_buffer));
246246
}
247247
else if(strncmp(command_input_buffer, "getcfg", 6) == 0)

datatypes.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,12 @@ typedef struct {
5555
int16_t duty_cycle; // Div/1000
5656
int16_t motor_current; // Div/10
5757
int16_t battery_current; // Div/10
58-
uint16_t watt_hours; // Div/100
58+
uint16_t not_used2; //NOTE: padding
5959

6060
uint16_t watt_hours_regen; // Div/100
6161
uint8_t fault;
6262
uint8_t not_used; //NOTE: padding
63-
uint32_t not_used2; //NOTE: padding
63+
uint32_t watt_hours; // Div/100
6464

6565
int32_t e_rpm;
6666
uint32_t e_distance;
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: post-release
2+
on:
3+
release:
4+
branches: [master]
5+
types: [released]
6+
7+
jobs:
8+
post-release:
9+
runs-on: ubuntu-18.04
10+
steps:
11+
# trigger post-release in dependency repo, this indirection allows the
12+
# dependency repo to be updated often without affecting this repo. At
13+
# the time of this comment, the dependency repo is responsible for
14+
# creating PRs for other dependent repos post-release.
15+
- name: trigger-post-release
16+
continue-on-error: true
17+
run: |
18+
curl -sS -X POST -H "authorization: token ${{secrets.BOT_TOKEN}}" \
19+
"$GITHUB_API_URL/repos/${{secrets.POST_RELEASE_REPO}}/dispatches" \
20+
-d "$(jq -n '{
21+
event_type: "post-release",
22+
client_payload: {
23+
repo: env.GITHUB_REPOSITORY,
24+
version: "${{github.event.release.tag_name}}"}}' \
25+
| tee /dev/stderr)"
26+
Lines changed: 215 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,215 @@
1+
name: release
2+
on:
3+
workflow_run:
4+
workflows: [test]
5+
branches: [master]
6+
types: [completed]
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-18.04
11+
12+
# need to manually check for a couple things
13+
# - tests passed?
14+
# - we are the most recent commit on master?
15+
if: ${{github.event.workflow_run.conclusion == 'success' &&
16+
github.event.workflow_run.head_sha == github.sha}}
17+
18+
steps:
19+
- uses: actions/checkout@v2
20+
with:
21+
ref: ${{github.event.workflow_run.head_sha}}
22+
# need workflow access since we push branches
23+
# containing workflows
24+
token: ${{secrets.BOT_TOKEN}}
25+
# need all tags
26+
fetch-depth: 0
27+
28+
# try to get results from tests
29+
- uses: dawidd6/action-download-artifact@v2
30+
continue-on-error: true
31+
with:
32+
workflow: ${{github.event.workflow_run.name}}
33+
run_id: ${{github.event.workflow_run.id}}
34+
name: results
35+
path: results
36+
37+
- name: find-version
38+
run: |
39+
# rip version from lfs.h
40+
LFS_VERSION="$(grep -o '^#define LFS_VERSION .*$' lfs.h \
41+
| awk '{print $3}')"
42+
LFS_VERSION_MAJOR="$((0xffff & ($LFS_VERSION >> 16)))"
43+
LFS_VERSION_MINOR="$((0xffff & ($LFS_VERSION >> 0)))"
44+
45+
# find a new patch version based on what we find in our tags
46+
LFS_VERSION_PATCH="$( \
47+
( git describe --tags --abbrev=0 \
48+
--match="v$LFS_VERSION_MAJOR.$LFS_VERSION_MINOR.*" \
49+
|| echo 'v0.0.-1' ) \
50+
| awk -F '.' '{print $3+1}')"
51+
52+
# found new version
53+
LFS_VERSION="v$LFS_VERSION_MAJOR`
54+
`.$LFS_VERSION_MINOR`
55+
`.$LFS_VERSION_PATCH"
56+
echo "LFS_VERSION=$LFS_VERSION"
57+
echo "LFS_VERSION=$LFS_VERSION" >> $GITHUB_ENV
58+
echo "LFS_VERSION_MAJOR=$LFS_VERSION_MAJOR" >> $GITHUB_ENV
59+
echo "LFS_VERSION_MINOR=$LFS_VERSION_MINOR" >> $GITHUB_ENV
60+
echo "LFS_VERSION_PATCH=$LFS_VERSION_PATCH" >> $GITHUB_ENV
61+
62+
# try to find previous version?
63+
- name: find-prev-version
64+
continue-on-error: true
65+
run: |
66+
LFS_PREV_VERSION="$(git describe --tags --abbrev=0 --match 'v*')"
67+
echo "LFS_PREV_VERSION=$LFS_PREV_VERSION"
68+
echo "LFS_PREV_VERSION=$LFS_PREV_VERSION" >> $GITHUB_ENV
69+
70+
# try to find results from tests
71+
- name: collect-results
72+
run: |
73+
# previous results to compare against?
74+
[ -n "$LFS_PREV_VERSION" ] && curl -sS \
75+
"$GITHUB_API_URL/repos/$GITHUB_REPOSITORY/`
76+
`status/$LFS_PREV_VERSION" \
77+
| jq -re 'select(.sha != env.GITHUB_SHA) | .statuses[]' \
78+
>> prev-results.json \
79+
|| true
80+
81+
# unfortunately these each have their own format
82+
[ -e results/code-thumb.csv ] && ( \
83+
export PREV="$(jq -re '
84+
select(.context == "results / code").description
85+
| capture("Code size is (?<result>[0-9]+)").result' \
86+
prev-results.json || echo 0)"
87+
./scripts/code.py -u results/code-thumb.csv -s | awk '
88+
NR==2 {printf "Code size,%d B",$2}
89+
NR==2 && ENVIRON["PREV"]+0 != 0 {
90+
printf " (%+.1f%%)",100*($2-ENVIRON["PREV"])/ENVIRON["PREV"]}
91+
NR==2 {printf "\n"}' \
92+
>> results.csv)
93+
[ -e results/code-thumb-readonly.csv ] && ( \
94+
export PREV="$(jq -re '
95+
select(.context == "results / code (readonly)").description
96+
| capture("Code size is (?<result>[0-9]+)").result' \
97+
prev-results.json || echo 0)"
98+
./scripts/code.py -u results/code-thumb-readonly.csv -s | awk '
99+
NR==2 {printf "Code size<br/>(readonly),%d B",$2}
100+
NR==2 && ENVIRON["PREV"]+0 != 0 {
101+
printf " (%+.1f%%)",100*($2-ENVIRON["PREV"])/ENVIRON["PREV"]}
102+
NR==2 {printf "\n"}' \
103+
>> results.csv)
104+
[ -e results/code-thumb-threadsafe.csv ] && ( \
105+
export PREV="$(jq -re '
106+
select(.context == "results / code (threadsafe)").description
107+
| capture("Code size is (?<result>[0-9]+)").result' \
108+
prev-results.json || echo 0)"
109+
./scripts/code.py -u results/code-thumb-threadsafe.csv -s | awk '
110+
NR==2 {printf "Code size<br/>(threadsafe),%d B",$2}
111+
NR==2 && ENVIRON["PREV"]+0 != 0 {
112+
printf " (%+.1f%%)",100*($2-ENVIRON["PREV"])/ENVIRON["PREV"]}
113+
NR==2 {printf "\n"}' \
114+
>> results.csv)
115+
[ -e results/code-thumb-migrate.csv ] && ( \
116+
export PREV="$(jq -re '
117+
select(.context == "results / code (migrate)").description
118+
| capture("Code size is (?<result>[0-9]+)").result' \
119+
prev-results.json || echo 0)"
120+
./scripts/code.py -u results/code-thumb-migrate.csv -s | awk '
121+
NR==2 {printf "Code size<br/>(migrate),%d B",$2}
122+
NR==2 && ENVIRON["PREV"]+0 != 0 {
123+
printf " (%+.1f%%)",100*($2-ENVIRON["PREV"])/ENVIRON["PREV"]}
124+
NR==2 {printf "\n"}' \
125+
>> results.csv)
126+
[ -e results/code-thumb-error-asserts.csv ] && ( \
127+
export PREV="$(jq -re '
128+
select(.context == "results / code (error-asserts)").description
129+
| capture("Code size is (?<result>[0-9]+)").result' \
130+
prev-results.json || echo 0)"
131+
./scripts/code.py -u results/code-thumb-error-asserts.csv -s | awk '
132+
NR==2 {printf "Code size<br/>(error-asserts),%d B",$2}
133+
NR==2 && ENVIRON["PREV"]+0 != 0 {
134+
printf " (%+.1f%%)",100*($2-ENVIRON["PREV"])/ENVIRON["PREV"]}
135+
NR==2 {printf "\n"}' \
136+
>> results.csv)
137+
[ -e results/coverage.csv ] && ( \
138+
export PREV="$(jq -re '
139+
select(.context == "results / coverage").description
140+
| capture("Coverage is (?<result>[0-9\\.]+)").result' \
141+
prev-results.json || echo 0)"
142+
./scripts/coverage.py -u results/coverage.csv -s | awk -F '[ /%]+' '
143+
NR==2 {printf "Coverage,%.1f%% of %d lines",$4,$3}
144+
NR==2 && ENVIRON["PREV"]+0 != 0 {
145+
printf " (%+.1f%%)",$4-ENVIRON["PREV"]}
146+
NR==2 {printf "\n"}' \
147+
>> results.csv)
148+
149+
# transpose to GitHub table
150+
[ -e results.csv ] || exit 0
151+
awk -F ',' '
152+
{label[NR]=$1; value[NR]=$2}
153+
END {
154+
for (r=1; r<=NR; r++) {printf "| %s ",label[r]}; printf "|\n";
155+
for (r=1; r<=NR; r++) {printf "|:--"}; printf "|\n";
156+
for (r=1; r<=NR; r++) {printf "| %s ",value[r]}; printf "|\n"}' \
157+
results.csv > results.txt
158+
echo "RESULTS:"
159+
cat results.txt
160+
161+
# find changes from history
162+
- name: collect-changes
163+
run: |
164+
[ -n "$LFS_PREV_VERSION" ] || exit 0
165+
# use explicit link to github commit so that release notes can
166+
# be copied elsewhere
167+
git log "$LFS_PREV_VERSION.." \
168+
--grep='^Merge' --invert-grep \
169+
--format="format:[\`%h\`](`
170+
`https://github.com/$GITHUB_REPOSITORY/commit/%h) %s" \
171+
> changes.txt
172+
echo "CHANGES:"
173+
cat changes.txt
174+
175+
# create and update major branches (vN and vN-prefix)
176+
- name: create-major-branches
177+
run: |
178+
# create major branch
179+
git branch "v$LFS_VERSION_MAJOR" HEAD
180+
181+
# create major prefix branch
182+
git config user.name ${{secrets.BOT_USER}}
183+
git config user.email ${{secrets.BOT_EMAIL}}
184+
git fetch "https://github.com/$GITHUB_REPOSITORY.git" \
185+
"v$LFS_VERSION_MAJOR-prefix" || true
186+
./scripts/prefix.py "lfs$LFS_VERSION_MAJOR"
187+
git branch "v$LFS_VERSION_MAJOR-prefix" $( \
188+
git commit-tree $(git write-tree) \
189+
$(git rev-parse --verify -q FETCH_HEAD | sed -e 's/^/-p /') \
190+
-p HEAD \
191+
-m "Generated v$LFS_VERSION_MAJOR prefixes")
192+
git reset --hard
193+
194+
# push!
195+
git push --atomic origin \
196+
"v$LFS_VERSION_MAJOR" \
197+
"v$LFS_VERSION_MAJOR-prefix"
198+
199+
# build release notes
200+
- name: create-release
201+
run: |
202+
# create release and patch version tag (vN.N.N)
203+
# only draft if not a patch release
204+
[ -e results.txt ] && export RESULTS="$(cat results.txt)"
205+
[ -e changes.txt ] && export CHANGES="$(cat changes.txt)"
206+
curl -sS -X POST -H "authorization: token ${{secrets.BOT_TOKEN}}" \
207+
"$GITHUB_API_URL/repos/$GITHUB_REPOSITORY/releases" \
208+
-d "$(jq -n '{
209+
tag_name: env.LFS_VERSION,
210+
name: env.LFS_VERSION | rtrimstr(".0"),
211+
target_commitish: "${{github.event.workflow_run.head_sha}}",
212+
draft: env.LFS_VERSION | endswith(".0"),
213+
body: [env.RESULTS, env.CHANGES | select(.)] | join("\n\n")}' \
214+
| tee /dev/stderr)"
215+
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: status
2+
on:
3+
workflow_run:
4+
workflows: [test]
5+
types: [completed]
6+
7+
jobs:
8+
status:
9+
runs-on: ubuntu-18.04
10+
steps:
11+
# custom statuses?
12+
- uses: dawidd6/action-download-artifact@v2
13+
continue-on-error: true
14+
with:
15+
workflow: ${{github.event.workflow_run.name}}
16+
run_id: ${{github.event.workflow_run.id}}
17+
name: status
18+
path: status
19+
- name: update-status
20+
continue-on-error: true
21+
run: |
22+
ls status
23+
for s in $(shopt -s nullglob ; echo status/*.json)
24+
do
25+
# parse requested status
26+
export STATE="$(jq -er '.state' $s)"
27+
export CONTEXT="$(jq -er '.context' $s)"
28+
export DESCRIPTION="$(jq -er '.description' $s)"
29+
# help lookup URL for job/steps because GitHub makes
30+
# it VERY HARD to link to specific jobs
31+
export TARGET_URL="$(
32+
jq -er '.target_url // empty' $s || (
33+
export TARGET_JOB="$(jq -er '.target_job' $s)"
34+
export TARGET_STEP="$(jq -er '.target_step // ""' $s)"
35+
curl -sS -H "authorization: token ${{secrets.BOT_TOKEN}}" \
36+
"$GITHUB_API_URL/repos/$GITHUB_REPOSITORY/actions/runs/`
37+
`${{github.event.workflow_run.id}}/jobs" \
38+
| jq -er '.jobs[]
39+
| select(.name == env.TARGET_JOB)
40+
| .html_url
41+
+ "?check_suite_focus=true"
42+
+ ((.steps[]
43+
| select(.name == env.TARGET_STEP)
44+
| "#step:\(.number):0") // "")'))"
45+
# update status
46+
curl -sS -X POST -H "authorization: token ${{secrets.BOT_TOKEN}}" \
47+
"$GITHUB_API_URL/repos/$GITHUB_REPOSITORY/statuses/`
48+
`${{github.event.workflow_run.head_sha}}" \
49+
-d "$(jq -n '{
50+
state: env.STATE,
51+
context: env.CONTEXT,
52+
description: env.DESCRIPTION,
53+
target_url: env.TARGET_URL}' \
54+
| tee /dev/stderr)"
55+
done

0 commit comments

Comments
 (0)