Lots of changes

- internationalization
- new logo
- connection screen improved
- always try provisioning IP for connection
This commit is contained in:
Martin Bauer
2021-07-28 15:08:25 +02:00
parent 03812fe514
commit 4614a28ead
21 changed files with 8916 additions and 70 deletions

View File

@@ -30,9 +30,10 @@ export const STOP_SESSION = "STOP_SESSION";
export const WIFI_SET_STATE = "WIFI_SET_STATE";
export const reportNewWifiState = (newStateStr) => ({
export const reportNewWifiState = (newStateStr, newHostname) => ({
type: WIFI_SET_STATE,
newStateStr: newStateStr
newStateStr: newStateStr,
newHostname: newHostname,
});
export const reportSessionStarted = (sessionId) => ({
@@ -83,7 +84,6 @@ export class DeviceReduxCoupling {
const state = this.reduxStore.getState();
if (this.conn === null || (state.settings.swimTrackerHost != this.conn.swimTrackerHost)) {
console.log(" ---- starting websocket connection to ", state.settings.swimTrackerHost);
if( this.conn !== null) {
this.conn.close();
}
@@ -92,7 +92,7 @@ export class DeviceReduxCoupling {
this._onNewData,
(sessionId) => this.reduxStore.dispatch(reportSessionStarted(sessionId)),
() => this.reduxStore.dispatch(reportSessionStopped()),
(response) => this.reduxStore.dispatch(reportNewWifiState(response["state"])),
(response) => this.reduxStore.dispatch(reportNewWifiState(response["state"], response["hostname"])),
() => this.reduxStore.dispatch(reportDeviceConnect()),
() => this.reduxStore.dispatch(reportDeviceDisconnect())
);
@@ -130,6 +130,7 @@ const INITIAL_DEVICE_STATE = {
sessionId: 0,
measurements: List(),
analysis: INITIAL_ANALYSIS,
deviceReportedHostname: "",
};
export const deviceStateReducer = (state = INITIAL_DEVICE_STATE, action) => {
@@ -162,7 +163,7 @@ export const deviceStateReducer = (state = INITIAL_DEVICE_STATE, action) => {
if (action.newStateStr === "STATION_MODE") { wifiState = WifiState.STA; }
else if (action.newStateStr === "AP_PROVISIONING") { wifiState = WifiState.AP_PROVISIONING; }
else if (action.newStateStr === "AP_SECURE") { wifiState = WifiState.AP_SECURE; }
return { ...state, wifiState: wifiState };
return { ...state, wifiState: wifiState, deviceReportedHostname: action.newHostname };
default:
//console.log("Unhandled state in deviceStateReducer", action, action.type, "state", state);
return state;

View File

@@ -10,7 +10,7 @@ export const changeUsername = newUsername => ({
newUserName: newUsername,
});
export const changeSwimTrackerHostname = newSwimTrackerHost => ( {
export const changeSwimTrackerHostname = newSwimTrackerHost => ({
type: CHANGE_SWIMTRACKER_HOSTNAME,
newSwimTrackerHost: newSwimTrackerHost,
});
@@ -34,7 +34,7 @@ const INITIAL_SETTINGS = {
windowSizeInSecs: 5,
numMeasurementsPerSec: 10,
kgFactor: 1.0 / 701.0,
kgFactor: 1.0 / 701.0,
peakDetector: 'SIMPLE', // either 'SIMPLE' or 'ZSCORE'
peakDetectorSimpleThreshold: 2000,
@@ -44,17 +44,17 @@ const INITIAL_SETTINGS = {
peakDetectorZScoreInfluence: 0.1,
activeTimeThreshold: 700,
movingAverageWindowSize: 10*3,
movingAverageWindowSize: 10 * 3,
}
};
const settingsReducer = (state = INITIAL_SETTINGS, action) => {
switch (action.type) {
case CHANGE_USER_NAME:
return { ...state, username: action.newUsername };
case CHANGE_SWIMTRACKER_HOSTNAME:
return {... state, swimTrackerHost: action.newSwimTrackerHost};
return { ...state, swimTrackerHost: action.newSwimTrackerHost };
default:
return state;
}