Skip to content

Commit 36980b3

Browse files
jgfosterJames Foster
andauthored
Bring in tests from alert branch (#468)
* Recreate `web` directory with latest Flutter artifacts. * Compile without errors (but five tests fail). * Rename some methods * PHProbeTest passes and most of DataLoggerTest passes. * Two remaining test failures, both dealing with mean and standarsd deviation: ThermalProbeTest.cpp & DataLoggerTest.cpp. * Use external statistics library. All tests now pass. * Fix formatting. * Only set _GLIBCXX_NUMERIC_LIMITS on Apple. * Use "unbiased" (or sample) StdDev. * Updates based on code review feedback. * Fix compile error. --------- Co-authored-by: James Foster <git@jgfoster.net>
1 parent 7e65442 commit 36980b3

31 files changed

Lines changed: 748 additions & 308 deletions

Makefile

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,13 @@ INCLUDE=-I$(ARDUINO_CI)/arduino \
4747
HEADERS=$(wildcard src/*.h) $(wildcard src/wrappers/*) $(wildcard src/UIState/*)
4848

4949
.PHONY : all
50-
all : $(BIN)/PHCalibrationWarningTest.cpp.bin $(BIN)/BlinkTest.cpp.bin $(BIN)/DateTimeTest.cpp.bin $(BIN)/EEPROMTest.cpp.bin \
50+
all : $(BIN)/BlinkTest.cpp.bin $(BIN)/DataLoggerTest.cpp.bin $(BIN)/DateTimeTest.cpp.bin $(BIN)/EEPROMTest.cpp.bin \
5151
$(BIN)/EnablePIDTest.cpp.bin $(BIN)/EthernetServerTest.cpp.bin $(BIN)/EthernetTest.cpp.bin \
5252
$(BIN)/GetTimeTest.cpp.bin $(BIN)/JSONBuilderTest.cpp.bin $(BIN)/KeypadTest.cpp.bin \
5353
$(BIN)/LiquidCrystalTest.cpp.bin \
5454
$(BIN)/MenuTest.cpp.bin $(BIN)/NumberCollectorTest.cpp.bin $(BIN)/PHCalibrationHighTest.cpp.bin \
5555
$(BIN)/PHCalibrationLowTest.cpp.bin $(BIN)/PHCalibrationMidTest.cpp.bin \
56-
$(BIN)/PHCalibrationPromptTest.cpp.bin $(BIN)/PHControlTest.cpp.bin \
56+
$(BIN)/PHCalibrationPromptTest.cpp.bin $(BIN)/PHCalibrationWarningTest.cpp.bin $(BIN)/PHControlTest.cpp.bin \
5757
$(BIN)/PHProbeTest.cpp.bin $(BIN)/PIDTest.cpp.bin $(BIN)/PushingBoxTest.cpp.bin $(BIN)/SDTest.cpp.bin \
5858
$(BIN)/SeeDeviceAddressTest.cpp.bin $(BIN)/SeeDeviceUptimeTest.cpp.bin $(BIN)/SeeFreeMemoryTest.cpp.bin \
5959
$(BIN)/SeeGoogleMinsTest.cpp.bin $(BIN)/SeeLogFileTest.cpp.bin $(BIN)/SeePHCalibrationTest.cpp.bin \
@@ -75,6 +75,9 @@ $(BIN)/PHCalibrationWarningTest.cpp.bin: $(BIN)/libarduino.so $(TEST)/PHCalibrat
7575
$(BIN)/BlinkTest.cpp.bin: $(BIN)/libarduino.so $(TEST)/BlinkTest.cpp $(HEADERS)
7676
$(GPP_TEST) -o $(BIN)/BlinkTest.cpp.bin $(TEST)/BlinkTest.cpp -larduino
7777

78+
$(BIN)/DataLoggerTest.cpp.bin: $(BIN)/libarduino.so $(TEST)/DataLoggerTest.cpp $(HEADERS)
79+
$(GPP_TEST) -o $(BIN)/DataLoggerTest.cpp.bin $(TEST)/DataLoggerTest.cpp -larduino
80+
7881
$(BIN)/DateTimeTest.cpp.bin: $(BIN)/libarduino.so $(TEST)/DateTimeTest.cpp $(HEADERS)
7982
$(GPP_TEST) -o $(BIN)/DateTimeTest.cpp.bin $(TEST)/DateTimeTest.cpp -larduino
8083

@@ -302,12 +305,12 @@ $(BIN)/EthernetServer_TC.o: $(SRC)/wrappers/EthernetServer_TC.cpp $(HEADERS)
302305
$(BIN)/Ethernet_TC.o: $(SRC)/wrappers/Ethernet_TC.cpp $(HEADERS)
303306
g++ -c $(FLAGS) $(INCLUDE) -o $(BIN)/Ethernet_TC.o $(SRC)/wrappers/Ethernet_TC.cpp
304307

305-
$(BIN)/JSONBuilder.o: $(SRC)/model/JSONBuilder.cpp $(HEADERS)
306-
g++ -c $(FLAGS) $(INCLUDE) -o $(BIN)/JSONBuilder.o $(SRC)/model/JSONBuilder.cpp
307-
308308
$(BIN)/GetTime.o: $(SRC)/model/GetTime.cpp $(HEADERS)
309309
g++ -c $(FLAGS) $(INCLUDE) -o $(BIN)/GetTime.o $(SRC)/model/GetTime.cpp
310310

311+
$(BIN)/JSONBuilder.o: $(SRC)/model/JSONBuilder.cpp $(HEADERS)
312+
g++ -c $(FLAGS) $(INCLUDE) -o $(BIN)/JSONBuilder.o $(SRC)/model/JSONBuilder.cpp
313+
311314
$(BIN)/Keypad_TC.o: $(SRC)/wrappers/Keypad_TC.cpp $(HEADERS)
312315
g++ -c $(FLAGS) $(INCLUDE) -o $(BIN)/Keypad_TC.o $(SRC)/wrappers/Keypad_TC.cpp
313316

extras/device_client/.metadata

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# This file tracks properties of this Flutter project.
2+
# Used by Flutter tool to assess capabilities and perform upgrades etc.
3+
#
4+
# This file should be version controlled and should not be manually edited.
5+
6+
version:
7+
revision: "761747bfc538b5af34aa0d3fac380f1bc331ec49"
8+
channel: "stable"
9+
10+
project_type: app
11+
12+
# Tracks metadata for the flutter migrate command
13+
migration:
14+
platforms:
15+
- platform: root
16+
create_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49
17+
base_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49
18+
- platform: web
19+
create_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49
20+
base_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49
21+
22+
# User provided section
23+
24+
# List of Local paths (relative to this file) that should be
25+
# ignored by the migrate tool.
26+
#
27+
# Files that are not part of the templates will be ignored by default.
28+
unmanaged_files:
29+
- 'lib/main.dart'
30+
- 'ios/Runner.xcodeproj/project.pbxproj'
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
const String gitVersion = 'v24.4.1-21-g71e+';
1+
const String gitVersion = 'v24.4.1-17-gda4+';
Lines changed: 6 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<!DOCTYPE html>
22
<html>
3-
43
<head>
54
<!--
65
If you are serving your web app in a path other than the root, change the
@@ -24,81 +23,16 @@
2423
<!-- iOS meta tags & icons -->
2524
<meta name="apple-mobile-web-app-capable" content="yes">
2625
<meta name="apple-mobile-web-app-status-bar-style" content="black">
27-
<meta name="apple-mobile-web-app-title" content="tank_manager">
26+
<meta name="apple-mobile-web-app-title" content="device_client">
2827
<link rel="apple-touch-icon" href="icons/Icon-192.png">
2928

29+
<!-- Favicon -->
30+
<link rel="icon" type="image/png" href="favicon.png"/>
31+
3032
<title>TankController</title>
3133
<link rel="manifest" href="manifest.json">
3234
</head>
33-
3435
<body>
35-
<!-- This script installs service_worker.js to provide PWA functionality to
36-
application. For more information, see:
37-
https://developers.google.com/web/fundamentals/primers/service-workers -->
38-
<script>
39-
var serviceWorkerVersion = null;
40-
var scriptLoaded = false;
41-
function loadMainDartJs() {
42-
if (scriptLoaded) {
43-
return;
44-
}
45-
scriptLoaded = true;
46-
var scriptTag = document.createElement('script');
47-
scriptTag.src = 'main.dart.js';
48-
scriptTag.type = 'application/javascript';
49-
document.body.append(scriptTag);
50-
}
51-
52-
if ('serviceWorker' in navigator) {
53-
// Service workers are supported. Use them.
54-
window.addEventListener('load', function () {
55-
// Wait for registration to finish before dropping the <script> tag.
56-
// Otherwise, the browser will load the script multiple times,
57-
// potentially different versions.
58-
var serviceWorkerUrl = 'flutter_service_worker.js?v=' + serviceWorkerVersion;
59-
navigator.serviceWorker.register(serviceWorkerUrl)
60-
.then((reg) => {
61-
function waitForActivation(serviceWorker) {
62-
serviceWorker.addEventListener('statechange', () => {
63-
if (serviceWorker.state == 'activated') {
64-
console.log('Installed new service worker.');
65-
loadMainDartJs();
66-
}
67-
});
68-
}
69-
if (!reg.active && (reg.installing || reg.waiting)) {
70-
// No active web worker and we have installed or are installing
71-
// one for the first time. Simply wait for it to activate.
72-
waitForActivation(reg.installing || reg.waiting);
73-
} else if (!reg.active.scriptURL.endsWith(serviceWorkerVersion)) {
74-
// When the app updates the serviceWorkerVersion changes, so we
75-
// need to ask the service worker to update.
76-
console.log('New service worker available.');
77-
reg.update();
78-
waitForActivation(reg.installing);
79-
} else {
80-
// Existing service worker is still good.
81-
console.log('Loading app from service worker.');
82-
loadMainDartJs();
83-
}
84-
});
85-
86-
// If service worker doesn't succeed in a reasonable amount of time,
87-
// fallback to plaint <script> tag.
88-
setTimeout(() => {
89-
if (!scriptLoaded) {
90-
console.warn(
91-
'Failed to load app from service worker. Falling back to plain <script> tag.',
92-
);
93-
loadMainDartJs();
94-
}
95-
}, 4000);
96-
});
97-
} else {
98-
// Service workers not supported. Just drop the <script> tag.
99-
loadMainDartJs();
100-
}
101-
</script>
36+
<script src="flutter_bootstrap.js" async></script>
10237
</body>
103-
104-
</html>
38+
</html>

extras/device_client/web/manifest.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"name": "tank_manager",
3-
"short_name": "tank_manager",
2+
"name": "device_client",
3+
"short_name": "device_client",
44
"start_url": ".",
55
"display": "standalone",
66
"background_color": "#0175C2",

extras/log_file_client/.metadata

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# This file should be version controlled and should not be manually edited.
55

66
version:
7-
revision: "ba393198430278b6595976de84fe170f553cc728"
7+
revision: "761747bfc538b5af34aa0d3fac380f1bc331ec49"
88
channel: "stable"
99

1010
project_type: app
@@ -13,26 +13,11 @@ project_type: app
1313
migration:
1414
platforms:
1515
- platform: root
16-
create_revision: ba393198430278b6595976de84fe170f553cc728
17-
base_revision: ba393198430278b6595976de84fe170f553cc728
18-
- platform: android
19-
create_revision: ba393198430278b6595976de84fe170f553cc728
20-
base_revision: ba393198430278b6595976de84fe170f553cc728
21-
- platform: ios
22-
create_revision: ba393198430278b6595976de84fe170f553cc728
23-
base_revision: ba393198430278b6595976de84fe170f553cc728
24-
- platform: linux
25-
create_revision: ba393198430278b6595976de84fe170f553cc728
26-
base_revision: ba393198430278b6595976de84fe170f553cc728
27-
- platform: macos
28-
create_revision: ba393198430278b6595976de84fe170f553cc728
29-
base_revision: ba393198430278b6595976de84fe170f553cc728
16+
create_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49
17+
base_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49
3018
- platform: web
31-
create_revision: ba393198430278b6595976de84fe170f553cc728
32-
base_revision: ba393198430278b6595976de84fe170f553cc728
33-
- platform: windows
34-
create_revision: ba393198430278b6595976de84fe170f553cc728
35-
base_revision: ba393198430278b6595976de84fe170f553cc728
19+
create_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49
20+
base_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49
3621

3722
# User provided section
3823

extras/log_file_client/web/index.html

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -31,29 +31,8 @@
3131

3232
<title>log_file_client</title>
3333
<link rel="manifest" href="manifest.json">
34-
35-
<script>
36-
// The value below is injected by flutter build, do not touch.
37-
const serviceWorkerVersion = null;
38-
</script>
39-
<!-- This script adds the flutter initialization JS code -->
40-
<script src="flutter.js" defer></script>
4134
</head>
4235
<body>
43-
<script>
44-
window.addEventListener('load', function(ev) {
45-
// Download main.dart.js
46-
_flutter.loader.loadEntrypoint({
47-
serviceWorker: {
48-
serviceWorkerVersion: serviceWorkerVersion,
49-
},
50-
onEntrypointLoaded: function(engineInitializer) {
51-
engineInitializer.initializeEngine().then(function(appRunner) {
52-
appRunner.runApp();
53-
});
54-
}
55-
});
56-
});
57-
</script>
36+
<script src="flutter_bootstrap.js" async></script>
5837
</body>
5938
</html>

extras/scripts/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#! /bin/bash
22
bundle config set --local path 'vendor/bundle'
33
bundle install
4-
bundle exec arduino_ci.rb --min-free-space=5898 --skip-unittests 1> >(tee stdout.txt ) 2> >(tee stderr.txt >&2 ); result=$?
4+
bundle exec arduino_ci.rb --min-free-space=5654 --skip-unittests 1> >(tee stdout.txt ) 2> >(tee stderr.txt >&2 ); result=$?
55
exit "$result"

extras/scripts/testAndBuild.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
cp extras/scripts/p*-commit .git/hooks/
44
bundle config set --local path 'vendor/bundle'
55
bundle install
6-
bundle exec arduino_ci.rb --min-free-space=5672 1> >(tee stdout.txt ) 2> >(tee stderr.txt >&2 )
6+
bundle exec arduino_ci.rb --min-free-space=5654 1> >(tee stdout.txt ) 2> >(tee stderr.txt >&2 )
77
result="${PIPESTATUS[0]}"
88
exit "$result"

src/TankController.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,12 @@ TankController::TankController(const char *remoteLogName) {
6969
DataLogger::instance();
7070
DateTime_TC::rtc();
7171
Ethernet_TC::instance();
72+
EthernetServer_TC::instance();
7273
ThermalProbe_TC::instance();
7374
ThermalControl::instance();
7475
PHProbe::instance();
7576
PHControl::instance();
77+
PID_TC::instance();
7678
state = new MainMenu();
7779
pinMode(LED_BUILTIN, OUTPUT);
7880
}

0 commit comments

Comments
 (0)