mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 15:59:52 +03:00
Merge branch 'emsesp:dev' into dev
This commit is contained in:
@@ -35,6 +35,7 @@
|
|||||||
- Buderus RC25 - "hc1 mode type" incorrect value [#273](https://github.com/emsesp/EMS-ESP32/issues/273)
|
- Buderus RC25 - "hc1 mode type" incorrect value [#273](https://github.com/emsesp/EMS-ESP32/issues/273)
|
||||||
- Increased number of Mixers and Heating Circuits [#294](https://github.com/emsesp/EMS-ESP32/issues/294)
|
- Increased number of Mixers and Heating Circuits [#294](https://github.com/emsesp/EMS-ESP32/issues/294)
|
||||||
- Check receive status before removing a telegram fetch [#268](https://github.com/emsesp/EMS-ESP32/issues/268), [#282](https://github.com/emsesp/EMS-ESP32/issues/282)
|
- Check receive status before removing a telegram fetch [#268](https://github.com/emsesp/EMS-ESP32/issues/268), [#282](https://github.com/emsesp/EMS-ESP32/issues/282)
|
||||||
|
- Fix uploading firmware on OSX [#345](https://github.com/emsesp/EMS-ESP32/issues/345)
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
|||||||
114
interface/package-lock.json
generated
114
interface/package-lock.json
generated
@@ -12,10 +12,10 @@
|
|||||||
"@emotion/styled": "^11.6.0",
|
"@emotion/styled": "^11.6.0",
|
||||||
"@msgpack/msgpack": "^2.7.1",
|
"@msgpack/msgpack": "^2.7.1",
|
||||||
"@mui/icons-material": "^5.3.1",
|
"@mui/icons-material": "^5.3.1",
|
||||||
"@mui/material": "^5.3.1",
|
"@mui/material": "^5.4.0",
|
||||||
"@types/lodash": "^4.14.178",
|
"@types/lodash": "^4.14.178",
|
||||||
"@types/node": "^17.0.10",
|
"@types/node": "^17.0.15",
|
||||||
"@types/react": "^17.0.38",
|
"@types/react": "^17.0.39",
|
||||||
"@types/react-dom": "^17.0.11",
|
"@types/react-dom": "^17.0.11",
|
||||||
"@types/react-router-dom": "^5.3.3",
|
"@types/react-router-dom": "^5.3.3",
|
||||||
"async-validator": "^4.0.7",
|
"async-validator": "^4.0.7",
|
||||||
@@ -28,7 +28,7 @@
|
|||||||
"react": "^17.0.2",
|
"react": "^17.0.2",
|
||||||
"react-app-rewired": "^2.1.11",
|
"react-app-rewired": "^2.1.11",
|
||||||
"react-dom": "^17.0.2",
|
"react-dom": "^17.0.2",
|
||||||
"react-dropzone": "^11.5.1",
|
"react-dropzone": "^12.0.0",
|
||||||
"react-icons": "^4.3.1",
|
"react-icons": "^4.3.1",
|
||||||
"react-router-dom": "^6.2.1",
|
"react-router-dom": "^6.2.1",
|
||||||
"react-scripts": "5.0.0",
|
"react-scripts": "5.0.0",
|
||||||
@@ -2707,9 +2707,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@mui/base": {
|
"node_modules/@mui/base": {
|
||||||
"version": "5.0.0-alpha.66",
|
"version": "5.0.0-alpha.67",
|
||||||
"resolved": "https://registry.npmjs.org/@mui/base/-/base-5.0.0-alpha.66.tgz",
|
"resolved": "https://registry.npmjs.org/@mui/base/-/base-5.0.0-alpha.67.tgz",
|
||||||
"integrity": "sha512-LARfVx0HmGV5YwU2pdIqEApQwz/CtEnYtKkV856hlY0cgi5NQL2htzZ/9ujKz0j3LFUaMYiYuJ2AOwrNtGFGrw==",
|
"integrity": "sha512-yK2++NivZUitAVpheMc5QVuwrVCphrTw85L6qjKcvnSpB8wmVYne58CY2vzMCNEuHkuHG2jccq9/JlRZFGAanw==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/runtime": "^7.16.7",
|
"@babel/runtime": "^7.16.7",
|
||||||
"@emotion/is-prop-valid": "^1.1.1",
|
"@emotion/is-prop-valid": "^1.1.1",
|
||||||
@@ -2763,13 +2763,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@mui/material": {
|
"node_modules/@mui/material": {
|
||||||
"version": "5.3.1",
|
"version": "5.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/@mui/material/-/material-5.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/@mui/material/-/material-5.4.0.tgz",
|
||||||
"integrity": "sha512-XWPsJ2jet2zfnKojth5d2IaHIJPpJnHq1ACCSlNf898BjYh1j50gRWsPpIHiptQ0oc0pdWmMcmrXbdANKR1ybw==",
|
"integrity": "sha512-vfBIAMsRNWI/A4p/eP01MjqhSACwxRGYp/2Yi7WAU64PpI/TXR4b9SRl+XJMMJXVC7+abu4E3hTdF3oqwMCSYA==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/runtime": "^7.16.7",
|
"@babel/runtime": "^7.16.7",
|
||||||
"@mui/base": "5.0.0-alpha.66",
|
"@mui/base": "5.0.0-alpha.67",
|
||||||
"@mui/system": "^5.3.0",
|
"@mui/system": "^5.4.0",
|
||||||
"@mui/types": "^7.1.0",
|
"@mui/types": "^7.1.0",
|
||||||
"@mui/utils": "^5.3.0",
|
"@mui/utils": "^5.3.0",
|
||||||
"@types/react-transition-group": "^4.4.4",
|
"@types/react-transition-group": "^4.4.4",
|
||||||
@@ -2863,9 +2863,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@mui/system": {
|
"node_modules/@mui/system": {
|
||||||
"version": "5.3.0",
|
"version": "5.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/@mui/system/-/system-5.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/@mui/system/-/system-5.4.0.tgz",
|
||||||
"integrity": "sha512-mblz3EObrhhIMPwSEe2Az7MbMaXOFgrvItPOzZwcY5O9qERB7Rr8KQgbU8VouWLUqyV2i8BaFpLrkKPA6eX2Aw==",
|
"integrity": "sha512-LX7g5gK5yCwiueSUVG73uVNc0yeHjsWUIFLrnPjP3m+J7O38RkPqyao5nZahhaSL1PGNbR9+zfkxljXthO9QqA==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/runtime": "^7.16.7",
|
"@babel/runtime": "^7.16.7",
|
||||||
"@mui/private-theming": "^5.3.0",
|
"@mui/private-theming": "^5.3.0",
|
||||||
@@ -3597,9 +3597,9 @@
|
|||||||
"integrity": "sha512-YATxVxgRqNH6nHEIsvg6k2Boc1JHI9ZbH5iWFFv/MTkchz3b1ieGDa5T0a9RznNdI0KhVbdbWSN+KWWrQZRxTw=="
|
"integrity": "sha512-YATxVxgRqNH6nHEIsvg6k2Boc1JHI9ZbH5iWFFv/MTkchz3b1ieGDa5T0a9RznNdI0KhVbdbWSN+KWWrQZRxTw=="
|
||||||
},
|
},
|
||||||
"node_modules/@types/node": {
|
"node_modules/@types/node": {
|
||||||
"version": "17.0.10",
|
"version": "17.0.15",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.10.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.15.tgz",
|
||||||
"integrity": "sha512-S/3xB4KzyFxYGCppyDt68yzBU9ysL88lSdIah4D6cptdcltc4NCPCAMc0+PCpg/lLIyC7IPvj2Z52OJWeIUkog=="
|
"integrity": "sha512-zWt4SDDv1S9WRBNxLFxFRHxdD9tvH8f5/kg5/IaLFdnSNXsDY4eL3Q3XXN+VxUnWIhyVFDwcsmAprvwXoM/ClA=="
|
||||||
},
|
},
|
||||||
"node_modules/@types/parse-json": {
|
"node_modules/@types/parse-json": {
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
@@ -3632,9 +3632,9 @@
|
|||||||
"integrity": "sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw=="
|
"integrity": "sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw=="
|
||||||
},
|
},
|
||||||
"node_modules/@types/react": {
|
"node_modules/@types/react": {
|
||||||
"version": "17.0.38",
|
"version": "17.0.39",
|
||||||
"resolved": "https://registry.npmjs.org/@types/react/-/react-17.0.38.tgz",
|
"resolved": "https://registry.npmjs.org/@types/react/-/react-17.0.39.tgz",
|
||||||
"integrity": "sha512-SI92X1IA+FMnP3qM5m4QReluXzhcmovhZnLNm3pyeQlooi02qI7sLiepEYqT678uNiyc25XfCqxREFpy3W7YhQ==",
|
"integrity": "sha512-UVavlfAxDd/AgAacMa60Azl7ygyQNRwC/DsHZmKgNvPmRR5p70AJ5Q9EAmL2NWOJmeV+vVUI4IAP7GZrN8h8Ug==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/prop-types": "*",
|
"@types/prop-types": "*",
|
||||||
"@types/scheduler": "*",
|
"@types/scheduler": "*",
|
||||||
@@ -7858,9 +7858,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/file-selector": {
|
"node_modules/file-selector": {
|
||||||
"version": "0.2.4",
|
"version": "0.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/file-selector/-/file-selector-0.2.4.tgz",
|
"resolved": "https://registry.npmjs.org/file-selector/-/file-selector-0.4.0.tgz",
|
||||||
"integrity": "sha512-ZDsQNbrv6qRi1YTDOEWzf5J2KjZ9KMI1Q2SGeTkCJmNNW25Jg4TW4UMcmoqcg4WrAyKRcpBXdbWRxkfrOzVRbA==",
|
"integrity": "sha512-iACCiXeMYOvZqlF1kTiYINzgepRBymz1wwjiuup9u9nayhb6g4fSwiyJ/6adli+EPwrWtpgQAh2PoS7HukEGEg==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"tslib": "^2.0.3"
|
"tslib": "^2.0.3"
|
||||||
},
|
},
|
||||||
@@ -14227,16 +14227,16 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/react-dropzone": {
|
"node_modules/react-dropzone": {
|
||||||
"version": "11.5.1",
|
"version": "12.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/react-dropzone/-/react-dropzone-11.5.1.tgz",
|
"resolved": "https://registry.npmjs.org/react-dropzone/-/react-dropzone-12.0.0.tgz",
|
||||||
"integrity": "sha512-eNhttdq4ZDe3eKbXAe54Opt+sbtqmNK5NWTHf/l5d+1TdZqShJ8gMjBrya00qx5zkI//TYxRhu1d9pemTgaWwg==",
|
"integrity": "sha512-xGZr9YFTLqLkYDSx7CMRhjW4rIEqE9w2DhJB0CIEslPzUj3OQQcg7fK8uW85exB+UaJoPfk74lnKi0kv7q6rDw==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"attr-accept": "^2.2.1",
|
"attr-accept": "^2.2.2",
|
||||||
"file-selector": "^0.2.2",
|
"file-selector": "^0.4.0",
|
||||||
"prop-types": "^15.7.2"
|
"prop-types": "^15.8.1"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 10"
|
"node": ">= 10.13"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"react": ">= 16.8"
|
"react": ">= 16.8"
|
||||||
@@ -19333,9 +19333,9 @@
|
|||||||
"integrity": "sha512-ApwiSL2c9ObewdOE/sqt788P1C5lomBOHyO8nUBCr4ofErBCnYQ003NtJ8lS9OQZc11ximkbmgAZJjB8y6cCdA=="
|
"integrity": "sha512-ApwiSL2c9ObewdOE/sqt788P1C5lomBOHyO8nUBCr4ofErBCnYQ003NtJ8lS9OQZc11ximkbmgAZJjB8y6cCdA=="
|
||||||
},
|
},
|
||||||
"@mui/base": {
|
"@mui/base": {
|
||||||
"version": "5.0.0-alpha.66",
|
"version": "5.0.0-alpha.67",
|
||||||
"resolved": "https://registry.npmjs.org/@mui/base/-/base-5.0.0-alpha.66.tgz",
|
"resolved": "https://registry.npmjs.org/@mui/base/-/base-5.0.0-alpha.67.tgz",
|
||||||
"integrity": "sha512-LARfVx0HmGV5YwU2pdIqEApQwz/CtEnYtKkV856hlY0cgi5NQL2htzZ/9ujKz0j3LFUaMYiYuJ2AOwrNtGFGrw==",
|
"integrity": "sha512-yK2++NivZUitAVpheMc5QVuwrVCphrTw85L6qjKcvnSpB8wmVYne58CY2vzMCNEuHkuHG2jccq9/JlRZFGAanw==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@babel/runtime": "^7.16.7",
|
"@babel/runtime": "^7.16.7",
|
||||||
"@emotion/is-prop-valid": "^1.1.1",
|
"@emotion/is-prop-valid": "^1.1.1",
|
||||||
@@ -19355,13 +19355,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@mui/material": {
|
"@mui/material": {
|
||||||
"version": "5.3.1",
|
"version": "5.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/@mui/material/-/material-5.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/@mui/material/-/material-5.4.0.tgz",
|
||||||
"integrity": "sha512-XWPsJ2jet2zfnKojth5d2IaHIJPpJnHq1ACCSlNf898BjYh1j50gRWsPpIHiptQ0oc0pdWmMcmrXbdANKR1ybw==",
|
"integrity": "sha512-vfBIAMsRNWI/A4p/eP01MjqhSACwxRGYp/2Yi7WAU64PpI/TXR4b9SRl+XJMMJXVC7+abu4E3hTdF3oqwMCSYA==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@babel/runtime": "^7.16.7",
|
"@babel/runtime": "^7.16.7",
|
||||||
"@mui/base": "5.0.0-alpha.66",
|
"@mui/base": "5.0.0-alpha.67",
|
||||||
"@mui/system": "^5.3.0",
|
"@mui/system": "^5.4.0",
|
||||||
"@mui/types": "^7.1.0",
|
"@mui/types": "^7.1.0",
|
||||||
"@mui/utils": "^5.3.0",
|
"@mui/utils": "^5.3.0",
|
||||||
"@types/react-transition-group": "^4.4.4",
|
"@types/react-transition-group": "^4.4.4",
|
||||||
@@ -19394,9 +19394,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@mui/system": {
|
"@mui/system": {
|
||||||
"version": "5.3.0",
|
"version": "5.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/@mui/system/-/system-5.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/@mui/system/-/system-5.4.0.tgz",
|
||||||
"integrity": "sha512-mblz3EObrhhIMPwSEe2Az7MbMaXOFgrvItPOzZwcY5O9qERB7Rr8KQgbU8VouWLUqyV2i8BaFpLrkKPA6eX2Aw==",
|
"integrity": "sha512-LX7g5gK5yCwiueSUVG73uVNc0yeHjsWUIFLrnPjP3m+J7O38RkPqyao5nZahhaSL1PGNbR9+zfkxljXthO9QqA==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@babel/runtime": "^7.16.7",
|
"@babel/runtime": "^7.16.7",
|
||||||
"@mui/private-theming": "^5.3.0",
|
"@mui/private-theming": "^5.3.0",
|
||||||
@@ -19902,9 +19902,9 @@
|
|||||||
"integrity": "sha512-YATxVxgRqNH6nHEIsvg6k2Boc1JHI9ZbH5iWFFv/MTkchz3b1ieGDa5T0a9RznNdI0KhVbdbWSN+KWWrQZRxTw=="
|
"integrity": "sha512-YATxVxgRqNH6nHEIsvg6k2Boc1JHI9ZbH5iWFFv/MTkchz3b1ieGDa5T0a9RznNdI0KhVbdbWSN+KWWrQZRxTw=="
|
||||||
},
|
},
|
||||||
"@types/node": {
|
"@types/node": {
|
||||||
"version": "17.0.10",
|
"version": "17.0.15",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.10.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.15.tgz",
|
||||||
"integrity": "sha512-S/3xB4KzyFxYGCppyDt68yzBU9ysL88lSdIah4D6cptdcltc4NCPCAMc0+PCpg/lLIyC7IPvj2Z52OJWeIUkog=="
|
"integrity": "sha512-zWt4SDDv1S9WRBNxLFxFRHxdD9tvH8f5/kg5/IaLFdnSNXsDY4eL3Q3XXN+VxUnWIhyVFDwcsmAprvwXoM/ClA=="
|
||||||
},
|
},
|
||||||
"@types/parse-json": {
|
"@types/parse-json": {
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
@@ -19937,9 +19937,9 @@
|
|||||||
"integrity": "sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw=="
|
"integrity": "sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw=="
|
||||||
},
|
},
|
||||||
"@types/react": {
|
"@types/react": {
|
||||||
"version": "17.0.38",
|
"version": "17.0.39",
|
||||||
"resolved": "https://registry.npmjs.org/@types/react/-/react-17.0.38.tgz",
|
"resolved": "https://registry.npmjs.org/@types/react/-/react-17.0.39.tgz",
|
||||||
"integrity": "sha512-SI92X1IA+FMnP3qM5m4QReluXzhcmovhZnLNm3pyeQlooi02qI7sLiepEYqT678uNiyc25XfCqxREFpy3W7YhQ==",
|
"integrity": "sha512-UVavlfAxDd/AgAacMa60Azl7ygyQNRwC/DsHZmKgNvPmRR5p70AJ5Q9EAmL2NWOJmeV+vVUI4IAP7GZrN8h8Ug==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@types/prop-types": "*",
|
"@types/prop-types": "*",
|
||||||
"@types/scheduler": "*",
|
"@types/scheduler": "*",
|
||||||
@@ -23086,9 +23086,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"file-selector": {
|
"file-selector": {
|
||||||
"version": "0.2.4",
|
"version": "0.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/file-selector/-/file-selector-0.2.4.tgz",
|
"resolved": "https://registry.npmjs.org/file-selector/-/file-selector-0.4.0.tgz",
|
||||||
"integrity": "sha512-ZDsQNbrv6qRi1YTDOEWzf5J2KjZ9KMI1Q2SGeTkCJmNNW25Jg4TW4UMcmoqcg4WrAyKRcpBXdbWRxkfrOzVRbA==",
|
"integrity": "sha512-iACCiXeMYOvZqlF1kTiYINzgepRBymz1wwjiuup9u9nayhb6g4fSwiyJ/6adli+EPwrWtpgQAh2PoS7HukEGEg==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"tslib": "^2.0.3"
|
"tslib": "^2.0.3"
|
||||||
}
|
}
|
||||||
@@ -27560,13 +27560,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"react-dropzone": {
|
"react-dropzone": {
|
||||||
"version": "11.5.1",
|
"version": "12.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/react-dropzone/-/react-dropzone-11.5.1.tgz",
|
"resolved": "https://registry.npmjs.org/react-dropzone/-/react-dropzone-12.0.0.tgz",
|
||||||
"integrity": "sha512-eNhttdq4ZDe3eKbXAe54Opt+sbtqmNK5NWTHf/l5d+1TdZqShJ8gMjBrya00qx5zkI//TYxRhu1d9pemTgaWwg==",
|
"integrity": "sha512-xGZr9YFTLqLkYDSx7CMRhjW4rIEqE9w2DhJB0CIEslPzUj3OQQcg7fK8uW85exB+UaJoPfk74lnKi0kv7q6rDw==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"attr-accept": "^2.2.1",
|
"attr-accept": "^2.2.2",
|
||||||
"file-selector": "^0.2.2",
|
"file-selector": "^0.4.0",
|
||||||
"prop-types": "^15.7.2"
|
"prop-types": "^15.8.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"react-error-overlay": {
|
"react-error-overlay": {
|
||||||
|
|||||||
@@ -8,10 +8,10 @@
|
|||||||
"@emotion/styled": "^11.6.0",
|
"@emotion/styled": "^11.6.0",
|
||||||
"@msgpack/msgpack": "^2.7.1",
|
"@msgpack/msgpack": "^2.7.1",
|
||||||
"@mui/icons-material": "^5.3.1",
|
"@mui/icons-material": "^5.3.1",
|
||||||
"@mui/material": "^5.3.1",
|
"@mui/material": "^5.4.0",
|
||||||
"@types/lodash": "^4.14.178",
|
"@types/lodash": "^4.14.178",
|
||||||
"@types/node": "^17.0.10",
|
"@types/node": "^17.0.15",
|
||||||
"@types/react": "^17.0.38",
|
"@types/react": "^17.0.39",
|
||||||
"@types/react-dom": "^17.0.11",
|
"@types/react-dom": "^17.0.11",
|
||||||
"@types/react-router-dom": "^5.3.3",
|
"@types/react-router-dom": "^5.3.3",
|
||||||
"async-validator": "^4.0.7",
|
"async-validator": "^4.0.7",
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
"react": "^17.0.2",
|
"react": "^17.0.2",
|
||||||
"react-app-rewired": "^2.1.11",
|
"react-app-rewired": "^2.1.11",
|
||||||
"react-dom": "^17.0.2",
|
"react-dom": "^17.0.2",
|
||||||
"react-dropzone": "^11.5.1",
|
"react-dropzone": "^12.0.0",
|
||||||
"react-icons": "^4.3.1",
|
"react-icons": "^4.3.1",
|
||||||
"react-router-dom": "^6.2.1",
|
"react-router-dom": "^6.2.1",
|
||||||
"react-scripts": "5.0.0",
|
"react-scripts": "5.0.0",
|
||||||
|
|||||||
@@ -23,13 +23,12 @@ import AccessTimeIcon from '@mui/icons-material/AccessTime';
|
|||||||
import SwapVerticalCircleIcon from '@mui/icons-material/SwapVerticalCircle';
|
import SwapVerticalCircleIcon from '@mui/icons-material/SwapVerticalCircle';
|
||||||
import UpdateIcon from '@mui/icons-material/Update';
|
import UpdateIcon from '@mui/icons-material/Update';
|
||||||
import DnsIcon from '@mui/icons-material/Dns';
|
import DnsIcon from '@mui/icons-material/Dns';
|
||||||
import AvTimerIcon from '@mui/icons-material/AvTimer';
|
|
||||||
import CancelIcon from '@mui/icons-material/Cancel';
|
import CancelIcon from '@mui/icons-material/Cancel';
|
||||||
|
|
||||||
import * as NTPApi from '../../api/ntp';
|
import * as NTPApi from '../../api/ntp';
|
||||||
import { NTPStatus, NTPSyncStatus } from '../../types';
|
import { NTPStatus, NTPSyncStatus } from '../../types';
|
||||||
import { ButtonRow, FormLoader, SectionContent } from '../../components';
|
import { ButtonRow, FormLoader, SectionContent } from '../../components';
|
||||||
import { extractErrorMessage, formatDateTime, formatDuration, formatLocalDateTime, useRest } from '../../utils';
|
import { extractErrorMessage, formatDateTime, formatLocalDateTime, useRest } from '../../utils';
|
||||||
import { AuthenticatedContext } from '../../contexts/authentication';
|
import { AuthenticatedContext } from '../../contexts/authentication';
|
||||||
|
|
||||||
export const isNtpActive = ({ status }: NTPStatus) => status === NTPSyncStatus.NTP_ACTIVE;
|
export const isNtpActive = ({ status }: NTPStatus) => status === NTPSyncStatus.NTP_ACTIVE;
|
||||||
@@ -175,15 +174,6 @@ const NTPStatusForm: FC = () => {
|
|||||||
<ListItemText primary="UTC Time" secondary={formatDateTime(data.utc_time)} />
|
<ListItemText primary="UTC Time" secondary={formatDateTime(data.utc_time)} />
|
||||||
</ListItem>
|
</ListItem>
|
||||||
<Divider variant="inset" component="li" />
|
<Divider variant="inset" component="li" />
|
||||||
<ListItem>
|
|
||||||
<ListItemAvatar>
|
|
||||||
<Avatar>
|
|
||||||
<AvTimerIcon />
|
|
||||||
</Avatar>
|
|
||||||
</ListItemAvatar>
|
|
||||||
<ListItemText primary="Uptime" secondary={formatDuration(data.uptime)} />
|
|
||||||
</ListItem>
|
|
||||||
<Divider variant="inset" component="li" />
|
|
||||||
</List>
|
</List>
|
||||||
<Box display="flex" flexWrap="wrap">
|
<Box display="flex" flexWrap="wrap">
|
||||||
<Box flexGrow={1}>
|
<Box flexGrow={1}>
|
||||||
|
|||||||
@@ -19,7 +19,8 @@ const FirmwareFileUpload: FC<UploadFirmwareProps> = ({ uploadFirmware }) => {
|
|||||||
my={2}
|
my={2}
|
||||||
/>
|
/>
|
||||||
<SingleUpload
|
<SingleUpload
|
||||||
accept="application/octet-stream"
|
// accept="application/octet-stream"
|
||||||
|
accept=".bin"
|
||||||
onDrop={uploadFile}
|
onDrop={uploadFile}
|
||||||
onCancel={cancelUpload}
|
onCancel={cancelUpload}
|
||||||
uploading={uploading}
|
uploading={uploading}
|
||||||
|
|||||||
@@ -27,8 +27,6 @@ import TableCell, { tableCellClasses } from '@mui/material/TableCell';
|
|||||||
|
|
||||||
import { styled } from '@mui/material/styles';
|
import { styled } from '@mui/material/styles';
|
||||||
|
|
||||||
import parseMilliseconds from 'parse-ms';
|
|
||||||
|
|
||||||
import { useSnackbar } from 'notistack';
|
import { useSnackbar } from 'notistack';
|
||||||
|
|
||||||
import RefreshIcon from '@mui/icons-material/Refresh';
|
import RefreshIcon from '@mui/icons-material/Refresh';
|
||||||
@@ -44,6 +42,8 @@ import DeviceIcon from './DeviceIcon';
|
|||||||
|
|
||||||
import { IconContext } from 'react-icons';
|
import { IconContext } from 'react-icons';
|
||||||
|
|
||||||
|
import { formatDurationMin, pluralize } from '../utils';
|
||||||
|
|
||||||
import { AuthenticatedContext } from '../contexts/authentication';
|
import { AuthenticatedContext } from '../contexts/authentication';
|
||||||
|
|
||||||
import { ButtonRow, FormLoader, ValidatedTextField, SectionContent, MessageBox } from '../components';
|
import { ButtonRow, FormLoader, ValidatedTextField, SectionContent, MessageBox } from '../components';
|
||||||
@@ -98,12 +98,11 @@ const DashboardData: FC = () => {
|
|||||||
|
|
||||||
const desktopWindow = useMediaQuery('(min-width:600px)');
|
const desktopWindow = useMediaQuery('(min-width:600px)');
|
||||||
|
|
||||||
const refreshData = () => {
|
const refreshAllData = () => {
|
||||||
if (analog || sensor || deviceValue) {
|
if (analog || sensor || deviceValue) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
loadData();
|
loadData();
|
||||||
|
|
||||||
if (sensorData) {
|
if (sensorData) {
|
||||||
fetchSensorData();
|
fetchSensorData();
|
||||||
} else if (selectedDevice) {
|
} else if (selectedDevice) {
|
||||||
@@ -111,6 +110,19 @@ const DashboardData: FC = () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const refreshData = () => {
|
||||||
|
if (analog || sensor || deviceValue) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (sensorData) {
|
||||||
|
fetchSensorData();
|
||||||
|
} else if (selectedDevice) {
|
||||||
|
fetchDeviceData(selectedDevice);
|
||||||
|
} else {
|
||||||
|
loadData();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const timer = setInterval(() => refreshData(), 60000);
|
const timer = setInterval(() => refreshData(), 60000);
|
||||||
return () => {
|
return () => {
|
||||||
@@ -140,33 +152,15 @@ const DashboardData: FC = () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const pluralize = (count: number, noun: string, suffix = 's') =>
|
|
||||||
` ${Intl.NumberFormat().format(count)} ${noun}${count !== 1 ? suffix : ''} `;
|
|
||||||
|
|
||||||
const formatDuration = (duration_min: number) => {
|
|
||||||
const { days, hours, minutes } = parseMilliseconds(duration_min * 60000);
|
|
||||||
let formatted = '';
|
|
||||||
if (days) {
|
|
||||||
formatted += pluralize(days, 'day');
|
|
||||||
}
|
|
||||||
if (hours) {
|
|
||||||
formatted += pluralize(hours, 'hour');
|
|
||||||
}
|
|
||||||
if (minutes) {
|
|
||||||
formatted += pluralize(minutes, 'minute');
|
|
||||||
}
|
|
||||||
return formatted;
|
|
||||||
};
|
|
||||||
|
|
||||||
function formatValue(value: any, uom: number) {
|
function formatValue(value: any, uom: number) {
|
||||||
if (value === undefined) {
|
if (value === undefined) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
switch (uom) {
|
switch (uom) {
|
||||||
case DeviceValueUOM.HOURS:
|
case DeviceValueUOM.HOURS:
|
||||||
return value ? formatDuration(value * 60) : '0 hours';
|
return value ? formatDurationMin(value * 60) : '0 hours';
|
||||||
case DeviceValueUOM.MINUTES:
|
case DeviceValueUOM.MINUTES:
|
||||||
return value ? formatDuration(value) : '0 minutes';
|
return value ? formatDurationMin(value) : '0 minutes';
|
||||||
case DeviceValueUOM.NONE:
|
case DeviceValueUOM.NONE:
|
||||||
if (typeof value === 'number') {
|
if (typeof value === 'number') {
|
||||||
return new Intl.NumberFormat().format(value);
|
return new Intl.NumberFormat().format(value);
|
||||||
@@ -239,7 +233,7 @@ const DashboardData: FC = () => {
|
|||||||
<ValidatedTextField
|
<ValidatedTextField
|
||||||
name="v"
|
name="v"
|
||||||
label={deviceValue.n}
|
label={deviceValue.n}
|
||||||
value={deviceValue.u ? Intl.NumberFormat().format(deviceValue.v) : deviceValue.v}
|
value={deviceValue.u ? numberValue(deviceValue.v) : deviceValue.v}
|
||||||
autoFocus
|
autoFocus
|
||||||
sx={{ width: '30ch' }}
|
sx={{ width: '30ch' }}
|
||||||
type={deviceValue.u ? 'number' : 'text'}
|
type={deviceValue.u ? 'number' : 'text'}
|
||||||
@@ -407,6 +401,7 @@ const DashboardData: FC = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const toggleDeviceData = (index: number) => {
|
const toggleDeviceData = (index: number) => {
|
||||||
|
loadData();
|
||||||
if (selectedDevice === index) {
|
if (selectedDevice === index) {
|
||||||
setSelectedDevice(undefined);
|
setSelectedDevice(undefined);
|
||||||
} else {
|
} else {
|
||||||
@@ -415,6 +410,7 @@ const DashboardData: FC = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const toggleSensorData = () => {
|
const toggleSensorData = () => {
|
||||||
|
loadData();
|
||||||
if (sensorData) {
|
if (sensorData) {
|
||||||
setSensorData(undefined);
|
setSensorData(undefined);
|
||||||
} else {
|
} else {
|
||||||
@@ -810,7 +806,7 @@ const DashboardData: FC = () => {
|
|||||||
{renderSensorDialog()}
|
{renderSensorDialog()}
|
||||||
{renderAnalogDialog()}
|
{renderAnalogDialog()}
|
||||||
<ButtonRow>
|
<ButtonRow>
|
||||||
<Button startIcon={<RefreshIcon />} variant="outlined" color="secondary" onClick={refreshData}>
|
<Button startIcon={<RefreshIcon />} variant="outlined" color="secondary" onClick={refreshAllData}>
|
||||||
Refresh
|
Refresh
|
||||||
</Button>
|
</Button>
|
||||||
</ButtonRow>
|
</ButtonRow>
|
||||||
|
|||||||
@@ -34,6 +34,8 @@ import { ButtonRow, FormLoader, SectionContent } from '../components';
|
|||||||
|
|
||||||
import { Status, busConnectionStatus } from './types';
|
import { Status, busConnectionStatus } from './types';
|
||||||
|
|
||||||
|
import { formatDurationSec, pluralize } from '../utils';
|
||||||
|
|
||||||
import * as EMSESP from './api';
|
import * as EMSESP from './api';
|
||||||
|
|
||||||
import { extractErrorMessage, useRest } from '../utils';
|
import { extractErrorMessage, useRest } from '../utils';
|
||||||
@@ -66,27 +68,6 @@ const busStatus = ({ status }: Status) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const pluralize = (count: number, noun: string) =>
|
|
||||||
`${Intl.NumberFormat().format(count)} ${noun}${count !== 1 ? 's' : ''}`;
|
|
||||||
|
|
||||||
const formatDuration = (duration_sec: number) => {
|
|
||||||
if (duration_sec === 0) {
|
|
||||||
return ' ';
|
|
||||||
}
|
|
||||||
const roundTowardsZero = duration_sec > 0 ? Math.floor : Math.ceil;
|
|
||||||
return (
|
|
||||||
', ' +
|
|
||||||
roundTowardsZero(duration_sec / 86400) +
|
|
||||||
'd ' +
|
|
||||||
(roundTowardsZero(duration_sec / 3600) % 24) +
|
|
||||||
'h ' +
|
|
||||||
(roundTowardsZero(duration_sec / 60) % 60) +
|
|
||||||
'm ' +
|
|
||||||
(roundTowardsZero(duration_sec) % 60) +
|
|
||||||
's'
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
const formatRow = (name: string, success: number, fail: number, quality: number) => {
|
const formatRow = (name: string, success: number, fail: number, quality: number) => {
|
||||||
if (success === 0 && fail === 0) {
|
if (success === 0 && fail === 0) {
|
||||||
return (
|
return (
|
||||||
@@ -182,7 +163,7 @@ const DashboardStatus: FC = () => {
|
|||||||
<DirectionsBusIcon />
|
<DirectionsBusIcon />
|
||||||
</Avatar>
|
</Avatar>
|
||||||
</ListItemAvatar>
|
</ListItemAvatar>
|
||||||
<ListItemText primary="EMS Bus Status" secondary={busStatus(data) + formatDuration(data.uptime)} />
|
<ListItemText primary="EMS Bus Status" secondary={busStatus(data) + formatDurationSec(data.uptime)} />
|
||||||
</ListItem>
|
</ListItem>
|
||||||
<ListItem>
|
<ListItem>
|
||||||
<ListItemAvatar>
|
<ListItemAvatar>
|
||||||
|
|||||||
@@ -292,7 +292,6 @@ const SettingsApplication: FC = () => {
|
|||||||
margin="normal"
|
margin="normal"
|
||||||
select
|
select
|
||||||
>
|
>
|
||||||
<MenuItem value={0}>Off</MenuItem>
|
|
||||||
<MenuItem value={1}>EMS</MenuItem>
|
<MenuItem value={1}>EMS</MenuItem>
|
||||||
<MenuItem value={2}>EMS+</MenuItem>
|
<MenuItem value={2}>EMS+</MenuItem>
|
||||||
<MenuItem value={3}>HT3</MenuItem>
|
<MenuItem value={3}>HT3</MenuItem>
|
||||||
|
|||||||
@@ -18,23 +18,38 @@ export const formatLocalDateTime = (date: Date) => {
|
|||||||
return new Date(date.getTime() - date.getTimezoneOffset() * 60000).toISOString().slice(0, -1).substr(0, 19);
|
return new Date(date.getTime() - date.getTimezoneOffset() * 60000).toISOString().slice(0, -1).substr(0, 19);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const formatDuration = (duration: number) => {
|
export const pluralize = (count: number, noun: string) =>
|
||||||
const { days, hours, minutes, seconds } = parseMilliseconds(duration * 1000);
|
`${Intl.NumberFormat().format(count)} ${noun}${count !== 1 ? 's' : ''}`;
|
||||||
var formatted = '';
|
|
||||||
|
export const formatDurationMin = (duration_min: number) => {
|
||||||
|
const { days, hours, minutes } = parseMilliseconds(duration_min * 60000);
|
||||||
|
let formatted = '';
|
||||||
if (days) {
|
if (days) {
|
||||||
formatted += pluralize(days, 'day');
|
formatted += pluralize(days, 'day') + ' ';
|
||||||
}
|
}
|
||||||
if (formatted || hours) {
|
if (hours) {
|
||||||
formatted += pluralize(hours, 'hour');
|
formatted += pluralize(hours, 'hour') + ' ';
|
||||||
}
|
}
|
||||||
if (formatted || minutes) {
|
if (minutes) {
|
||||||
formatted += pluralize(minutes, 'minute');
|
formatted += pluralize(minutes, 'minute') + ' ';
|
||||||
}
|
|
||||||
if (formatted || seconds) {
|
|
||||||
formatted += pluralize(seconds, 'second');
|
|
||||||
}
|
}
|
||||||
return formatted;
|
return formatted;
|
||||||
};
|
};
|
||||||
|
|
||||||
const pluralize = (count: number, noun: string, suffix: string = 's') =>
|
export const formatDurationSec = (duration_sec: number) => {
|
||||||
` ${count} ${noun}${count !== 1 ? suffix : ''} `;
|
if (duration_sec === 0) {
|
||||||
|
return ' ';
|
||||||
|
}
|
||||||
|
const roundTowardsZero = duration_sec > 0 ? Math.floor : Math.ceil;
|
||||||
|
return (
|
||||||
|
', ' +
|
||||||
|
roundTowardsZero(duration_sec / 86400) +
|
||||||
|
'd ' +
|
||||||
|
(roundTowardsZero(duration_sec / 3600) % 24) +
|
||||||
|
'h ' +
|
||||||
|
(roundTowardsZero(duration_sec / 60) % 60) +
|
||||||
|
'm ' +
|
||||||
|
(roundTowardsZero(duration_sec) % 60) +
|
||||||
|
's'
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ void NTPSettingsService::WiFiEvent(WiFiEvent_t event) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://werner.rothschopf.net/microcontroller/202103_arduino_esp32_ntp_en.htm
|
||||||
void NTPSettingsService::configureNTP() {
|
void NTPSettingsService::configureNTP() {
|
||||||
if (connected_ && _state.enabled) {
|
if (connected_ && _state.enabled) {
|
||||||
emsesp::EMSESP::logger().info(F("Starting NTP"));
|
emsesp::EMSESP::logger().info(F("Starting NTP"));
|
||||||
@@ -69,6 +70,7 @@ void NTPSettingsService::configureTime(AsyncWebServerRequest * request, JsonVari
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AsyncWebServerResponse * response = request->beginResponse(400);
|
AsyncWebServerResponse * response = request->beginResponse(400);
|
||||||
request->send(response);
|
request->send(response);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,9 +46,6 @@ void NTPStatus::ntpStatus(AsyncWebServerRequest * request) {
|
|||||||
// the sntp server name
|
// the sntp server name
|
||||||
root["server"] = sntp_getservername(0);
|
root["server"] = sntp_getservername(0);
|
||||||
|
|
||||||
// device uptime in seconds
|
|
||||||
root["uptime"] = millis() / 1000;
|
|
||||||
|
|
||||||
response->setLength();
|
response->setLength();
|
||||||
request->send(response);
|
request->send(response);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -335,9 +335,8 @@ void AnalogSensor::publish_values(const bool force) {
|
|||||||
doc[sensor.name()] = sensor.value();
|
doc[sensor.name()] = sensor.value();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Mqtt::publish(F("analogsensor_data"), doc.as<JsonObject>());
|
|
||||||
}
|
}
|
||||||
|
Mqtt::publish(F("analogsensor_data"), doc.as<JsonObject>());
|
||||||
}
|
}
|
||||||
|
|
||||||
// called from emsesp.cpp, similar to the emsdevice->get_value_info
|
// called from emsesp.cpp, similar to the emsdevice->get_value_info
|
||||||
@@ -369,7 +368,7 @@ bool AnalogSensor::command_info(const char * value, const int8_t id, JsonObject
|
|||||||
if (id == -1) { // show number and id
|
if (id == -1) { // show number and id
|
||||||
JsonObject dataSensor = output.createNestedObject(sensor.name());
|
JsonObject dataSensor = output.createNestedObject(sensor.name());
|
||||||
dataSensor["id"] = sensor.id();
|
dataSensor["id"] = sensor.id();
|
||||||
dataSensor["type"] = FL_(enum_sensortype)[sensor.type()];
|
dataSensor["type"] = FL_(enum_sensortype)[sensor.type()];
|
||||||
if (sensor.type() == AnalogType::ADC) {
|
if (sensor.type() == AnalogType::ADC) {
|
||||||
dataSensor["uom"] = EMSdevice::uom_to_string(sensor.uom());
|
dataSensor["uom"] = EMSdevice::uom_to_string(sensor.uom());
|
||||||
dataSensor["offset"] = sensor.offset();
|
dataSensor["offset"] = sensor.offset();
|
||||||
|
|||||||
@@ -54,10 +54,6 @@ void EMSESPShell::stopped() {
|
|||||||
logger().log(LogLevel::DEBUG, LogFacility::AUTH, F("su session closed on console %s"), console_name().c_str());
|
logger().log(LogLevel::DEBUG, LogFacility::AUTH, F("su session closed on console %s"), console_name().c_str());
|
||||||
}
|
}
|
||||||
logger().log(LogLevel::DEBUG, LogFacility::CONSOLE, F("User session closed on console %s"), console_name().c_str());
|
logger().log(LogLevel::DEBUG, LogFacility::CONSOLE, F("User session closed on console %s"), console_name().c_str());
|
||||||
|
|
||||||
// remove all custom contexts
|
|
||||||
// commands->remove_all_commands();
|
|
||||||
// console_commands_loaded_ = false; // make sure they get reloaded next time a console is opened
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// show welcome banner
|
// show welcome banner
|
||||||
@@ -77,8 +73,6 @@ void EMSESPShell::display_banner() {
|
|||||||
|
|
||||||
if (console_hostname_.empty()) {
|
if (console_hostname_.empty()) {
|
||||||
console_hostname_ = "ems-esp";
|
console_hostname_ = "ems-esp";
|
||||||
// console_hostname_.resize(16, '\0');
|
|
||||||
// snprintf(&console_hostname_[0], console_hostname_.capacity() + 1, "ems-esp");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// load the list of commands
|
// load the list of commands
|
||||||
@@ -465,31 +459,6 @@ std::string EMSESPShell::hostname_text() {
|
|||||||
return console_hostname_;
|
return console_hostname_;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
// remove commands from the current context to save memory before exiting
|
|
||||||
bool EMSESPShell::exit_context() {
|
|
||||||
unsigned int current_context = context();
|
|
||||||
|
|
||||||
if (current_context == ShellContext::MAIN) {
|
|
||||||
Shell::stop();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
// commands->remove_context_commands(current_context);
|
|
||||||
// return Shell::exit_context();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// enter a custom context (sub-menu)
|
|
||||||
void Console::enter_custom_context(Shell & shell, unsigned int context) {
|
|
||||||
// load_standard_commands(context);
|
|
||||||
|
|
||||||
// don't go into the new context if it's already the root (to prevent double loading)
|
|
||||||
if (context != ShellContext::MAIN) {
|
|
||||||
shell.enter_context(context);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
// each custom context has the common commands like log, help, exit, su etc
|
// each custom context has the common commands like log, help, exit, su etc
|
||||||
void Console::load_standard_commands(unsigned int context) {
|
void Console::load_standard_commands(unsigned int context) {
|
||||||
#if defined(EMSESP_DEBUG)
|
#if defined(EMSESP_DEBUG)
|
||||||
@@ -771,22 +740,6 @@ void Console::load_system_commands(unsigned int context) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
// prompt, change per context
|
|
||||||
std::string EMSESPShell::context_text() {
|
|
||||||
switch (static_cast<ShellContext>(context())) {
|
|
||||||
case ShellContext::MAIN:
|
|
||||||
return std::string{'/'};
|
|
||||||
|
|
||||||
case ShellContext::SYSTEM:
|
|
||||||
return std::string{"/system"};
|
|
||||||
|
|
||||||
default:
|
|
||||||
return std::string{};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
// when in su (admin) show # as the prompt suffix
|
// when in su (admin) show # as the prompt suffix
|
||||||
std::string EMSESPShell::prompt_suffix() {
|
std::string EMSESPShell::prompt_suffix() {
|
||||||
if (has_flags(CommandFlags::ADMIN)) {
|
if (has_flags(CommandFlags::ADMIN)) {
|
||||||
@@ -848,12 +801,11 @@ std::string EMSESPStreamConsole::console_name() {
|
|||||||
return name_;
|
return name_;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start up telnet and logging
|
// Start serial console
|
||||||
// Log order is off, err, warning, notice, info, debug, trace, all
|
void Console::start_serial() {
|
||||||
void Console::start(bool telnet_enabled) {
|
Serial.begin(115200);
|
||||||
telnet_enabled_ = telnet_enabled;
|
|
||||||
|
|
||||||
// Serial Console
|
// Serial Console - is always active
|
||||||
shell = std::make_shared<EMSESPStreamConsole>(Serial, true);
|
shell = std::make_shared<EMSESPStreamConsole>(Serial, true);
|
||||||
shell->maximum_log_messages(100);
|
shell->maximum_log_messages(100);
|
||||||
shell->start();
|
shell->start();
|
||||||
@@ -865,20 +817,20 @@ void Console::start(bool telnet_enabled) {
|
|||||||
#if defined(EMSESP_STANDALONE)
|
#if defined(EMSESP_STANDALONE)
|
||||||
shell->add_flags(CommandFlags::ADMIN); // always start in su/admin mode when running tests
|
shell->add_flags(CommandFlags::ADMIN); // always start in su/admin mode when running tests
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
// Start up telnet
|
||||||
|
void Console::start_telnet() {
|
||||||
|
telnet_enabled_ = true; // telnet is enabled when calling this function
|
||||||
|
|
||||||
// start the telnet service
|
// start the telnet service
|
||||||
// default idle is 10 minutes, default write timeout is 0 (automatic)
|
// default idle is 10 minutes, default write timeout is 0 (automatic)
|
||||||
// note, this must be started after the network/wifi for ESP32 otherwise it'll crash
|
// note, this must be started after the network/wifi for ESP32 otherwise it'll crash
|
||||||
#ifndef EMSESP_STANDALONE
|
#ifndef EMSESP_STANDALONE
|
||||||
if (telnet_enabled) {
|
telnet_.start();
|
||||||
telnet_.start();
|
telnet_.initial_idle_timeout(3600); // in sec, one hour idle timeout
|
||||||
telnet_.initial_idle_timeout(3600); // in sec, one hour idle timeout
|
telnet_.default_write_timeout(1000); // in ms, socket timeout 1 second
|
||||||
telnet_.default_write_timeout(1000); // in ms, socket timeout 1 second
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// turn watch off in case it was still set in the last session
|
|
||||||
// EMSESP::watch(EMSESP::WATCH_OFF);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// handles telnet sync and logging to console
|
// handles telnet sync and logging to console
|
||||||
|
|||||||
@@ -99,8 +99,6 @@ class EMSESPShell : virtual public uuid::console::Shell {
|
|||||||
std::string prompt_suffix() override;
|
std::string prompt_suffix() override;
|
||||||
void end_of_transmission() override;
|
void end_of_transmission() override;
|
||||||
|
|
||||||
// std::string context_text() override;
|
|
||||||
// bool exit_context() override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void add_console_commands();
|
void add_console_commands();
|
||||||
@@ -128,16 +126,16 @@ class EMSESPStreamConsole : public uuid::console::StreamConsole, public EMSESPSh
|
|||||||
class Console {
|
class Console {
|
||||||
public:
|
public:
|
||||||
void loop();
|
void loop();
|
||||||
void start(bool telnet_enabled = true);
|
void start_serial();
|
||||||
|
void start_telnet();
|
||||||
|
|
||||||
uuid::log::Level log_level();
|
uuid::log::Level log_level();
|
||||||
|
|
||||||
// static void enter_custom_context(Shell & shell, unsigned int context);
|
|
||||||
static void load_standard_commands(unsigned int context);
|
static void load_standard_commands(unsigned int context);
|
||||||
static void load_system_commands(unsigned int context);
|
static void load_system_commands(unsigned int context);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool telnet_enabled_;
|
bool telnet_enabled_ = false; // telnet is default off
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace emsesp
|
} // namespace emsesp
|
||||||
|
|||||||
@@ -93,7 +93,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef EMSESP_DEFAULT_BOARD_PROFILE
|
#ifndef EMSESP_DEFAULT_BOARD_PROFILE
|
||||||
#define EMSESP_DEFAULT_BOARD_PROFILE "S32" // Gateway S32
|
#define EMSESP_DEFAULT_BOARD_PROFILE "default"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Default GPIO PIN definitions
|
// Default GPIO PIN definitions
|
||||||
|
|||||||
@@ -101,6 +101,8 @@
|
|||||||
{106, DeviceType::THERMOSTAT, F("FW200"), DeviceFlags::EMS_DEVICE_FLAG_JUNKERS},
|
{106, DeviceType::THERMOSTAT, F("FW200"), DeviceFlags::EMS_DEVICE_FLAG_JUNKERS},
|
||||||
{107, DeviceType::THERMOSTAT, F("FR100"), DeviceFlags::EMS_DEVICE_FLAG_JUNKERS | DeviceFlags::EMS_DEVICE_FLAG_JUNKERS_OLD}, // older model
|
{107, DeviceType::THERMOSTAT, F("FR100"), DeviceFlags::EMS_DEVICE_FLAG_JUNKERS | DeviceFlags::EMS_DEVICE_FLAG_JUNKERS_OLD}, // older model
|
||||||
{108, DeviceType::THERMOSTAT, F("FR110"), DeviceFlags::EMS_DEVICE_FLAG_JUNKERS | DeviceFlags::EMS_DEVICE_FLAG_JUNKERS_OLD}, // older model
|
{108, DeviceType::THERMOSTAT, F("FR110"), DeviceFlags::EMS_DEVICE_FLAG_JUNKERS | DeviceFlags::EMS_DEVICE_FLAG_JUNKERS_OLD}, // older model
|
||||||
|
{109, DeviceType::THERMOSTAT, F("FB10"), DeviceFlags::EMS_DEVICE_FLAG_JUNKERS},
|
||||||
|
{110, DeviceType::THERMOSTAT, F("FB100"), DeviceFlags::EMS_DEVICE_FLAG_JUNKERS},
|
||||||
{111, DeviceType::THERMOSTAT, F("FR10"), DeviceFlags::EMS_DEVICE_FLAG_JUNKERS | DeviceFlags::EMS_DEVICE_FLAG_JUNKERS_OLD}, // older model
|
{111, DeviceType::THERMOSTAT, F("FR10"), DeviceFlags::EMS_DEVICE_FLAG_JUNKERS | DeviceFlags::EMS_DEVICE_FLAG_JUNKERS_OLD}, // older model
|
||||||
{147, DeviceType::THERMOSTAT, F("FR50"), DeviceFlags::EMS_DEVICE_FLAG_JUNKERS | DeviceFlags::EMS_DEVICE_FLAG_JUNKERS_OLD},
|
{147, DeviceType::THERMOSTAT, F("FR50"), DeviceFlags::EMS_DEVICE_FLAG_JUNKERS | DeviceFlags::EMS_DEVICE_FLAG_JUNKERS_OLD},
|
||||||
{191, DeviceType::THERMOSTAT, F("FR120"), DeviceFlags::EMS_DEVICE_FLAG_JUNKERS | DeviceFlags::EMS_DEVICE_FLAG_JUNKERS_OLD}, // older model
|
{191, DeviceType::THERMOSTAT, F("FR120"), DeviceFlags::EMS_DEVICE_FLAG_JUNKERS | DeviceFlags::EMS_DEVICE_FLAG_JUNKERS_OLD}, // older model
|
||||||
|
|||||||
@@ -999,13 +999,17 @@ void Thermostat::process_RC300Set(std::shared_ptr<const Telegram> telegram) {
|
|||||||
// has_update(telegram, hc->mode, 0); // Auto = xFF, Manual = x00 eg. 10 00 FF 08 01 B9 FF
|
// has_update(telegram, hc->mode, 0); // Auto = xFF, Manual = x00 eg. 10 00 FF 08 01 B9 FF
|
||||||
has_update(telegram, hc->daytemp, 2); // is * 2
|
has_update(telegram, hc->daytemp, 2); // is * 2
|
||||||
has_update(telegram, hc->nighttemp, 4); // is * 2
|
has_update(telegram, hc->nighttemp, 4); // is * 2
|
||||||
has_update(telegram, hc->tempautotemp, 8);
|
|
||||||
// uint8_t tat = hc->tempautotemp;
|
// has_update(telegram, hc->tempautotemp, 8); // is * 2
|
||||||
// telegram->read_value(tat, 8);
|
// manipulate tempautotemp to show -1°C (with scale 0.5°C) if value is 0xFF
|
||||||
// if (tat == 0xFF) {
|
// see https://github.com/emsesp/EMS-ESP32/issues/321
|
||||||
// tat = 0;
|
int8_t tat = hc->tempautotemp;
|
||||||
// }
|
telegram->read_value(tat, 8);
|
||||||
// has_update(hc->tempautotemp, tat);
|
if ((uint8_t)tat == 0xFF) {
|
||||||
|
tat = -2;
|
||||||
|
}
|
||||||
|
has_update(hc->tempautotemp, tat);
|
||||||
|
|
||||||
has_update(telegram, hc->manualtemp, 10); // is * 2
|
has_update(telegram, hc->manualtemp, 10); // is * 2
|
||||||
has_enumupdate(telegram, hc->program, 11, 1); // timer program 1 or 2
|
has_enumupdate(telegram, hc->program, 11, 1); // timer program 1 or 2
|
||||||
}
|
}
|
||||||
@@ -3277,7 +3281,7 @@ void Thermostat::register_device_values_hc(std::shared_ptr<Thermostat::HeatingCi
|
|||||||
tag, &hc->controlmode, DeviceValueType::ENUM, FL_(enum_controlmode), FL_(controlmode), DeviceValueUOM::NONE, MAKE_CF_CB(set_controlmode));
|
tag, &hc->controlmode, DeviceValueType::ENUM, FL_(enum_controlmode), FL_(controlmode), DeviceValueUOM::NONE, MAKE_CF_CB(set_controlmode));
|
||||||
register_device_value(tag, &hc->program, DeviceValueType::ENUM, FL_(enum_progMode), FL_(program), DeviceValueUOM::NONE, MAKE_CF_CB(set_program));
|
register_device_value(tag, &hc->program, DeviceValueType::ENUM, FL_(enum_progMode), FL_(program), DeviceValueUOM::NONE, MAKE_CF_CB(set_program));
|
||||||
register_device_value(
|
register_device_value(
|
||||||
tag, &hc->tempautotemp, DeviceValueType::UINT, FL_(div2), FL_(tempautotemp), DeviceValueUOM::DEGREES, MAKE_CF_CB(set_tempautotemp), 5, 30);
|
tag, &hc->tempautotemp, DeviceValueType::INT, FL_(div2), FL_(tempautotemp), DeviceValueUOM::DEGREES, MAKE_CF_CB(set_tempautotemp), -1, 30);
|
||||||
register_device_value(tag, &hc->fastHeatup, DeviceValueType::UINT, nullptr, FL_(fastheatup), DeviceValueUOM::PERCENT, MAKE_CF_CB(set_fastheatup));
|
register_device_value(tag, &hc->fastHeatup, DeviceValueType::UINT, nullptr, FL_(fastheatup), DeviceValueUOM::PERCENT, MAKE_CF_CB(set_fastheatup));
|
||||||
break;
|
break;
|
||||||
case EMS_DEVICE_FLAG_CRF:
|
case EMS_DEVICE_FLAG_CRF:
|
||||||
|
|||||||
@@ -20,12 +20,6 @@
|
|||||||
|
|
||||||
namespace emsesp {
|
namespace emsesp {
|
||||||
|
|
||||||
#if defined(EMSESP_STANDALONE)
|
|
||||||
uint32_t heap_start = 0;
|
|
||||||
#else
|
|
||||||
uint32_t heap_start = ESP.getFreeHeap(); // get initial available heap memory
|
|
||||||
#endif
|
|
||||||
|
|
||||||
AsyncWebServer webServer(80);
|
AsyncWebServer webServer(80);
|
||||||
|
|
||||||
#if defined(EMSESP_STANDALONE)
|
#if defined(EMSESP_STANDALONE)
|
||||||
@@ -174,6 +168,9 @@ void EMSESP::scan_devices() {
|
|||||||
* we send to right device and match all reads to 0x18
|
* we send to right device and match all reads to 0x18
|
||||||
*/
|
*/
|
||||||
uint8_t EMSESP::check_master_device(const uint8_t device_id, const uint16_t type_id, const bool read) {
|
uint8_t EMSESP::check_master_device(const uint8_t device_id, const uint16_t type_id, const bool read) {
|
||||||
|
if (device_id != 0x10 && (device_id < 0x18 || device_id > 0x1F)) {
|
||||||
|
return device_id;
|
||||||
|
}
|
||||||
if (actual_master_thermostat_ == 0x18) {
|
if (actual_master_thermostat_ == 0x18) {
|
||||||
uint16_t mon_ids[] = {0x02A5, 0x02A6, 0x02A7, 0x02A8, 0x02A9, 0x02AA, 0x02AB, 0x02AC};
|
uint16_t mon_ids[] = {0x02A5, 0x02A6, 0x02A7, 0x02A8, 0x02A9, 0x02AA, 0x02AB, 0x02AC};
|
||||||
uint16_t set_ids[] = {0x02B9, 0x02BA, 0x02BB, 0x02BC, 0x02BD, 0x02BE, 0x02BF, 0x02C0};
|
uint16_t set_ids[] = {0x02B9, 0x02BA, 0x02BB, 0x02BC, 0x02BD, 0x02BE, 0x02BF, 0x02C0};
|
||||||
@@ -199,6 +196,17 @@ uint8_t EMSESP::check_master_device(const uint8_t device_id, const uint16_t type
|
|||||||
return 0x18;
|
return 0x18;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (actual_master_thermostat_ == 0x10) {
|
||||||
|
// Junkers FW200 supports hc1/hc2, hc3/hc4 handled by devices 0x1A...
|
||||||
|
// see https://github.com/emsesp/EMS-ESP32/issues/336
|
||||||
|
uint16_t mon_ids[] = {0x0171, 0x0172};
|
||||||
|
uint16_t set_ids[] = {0x0167, 0x0168};
|
||||||
|
for (uint8_t i = 0; i < sizeof(mon_ids) / 2; i++) {
|
||||||
|
if (type_id == mon_ids[i] || type_id == set_ids[i]) {
|
||||||
|
// reads to master thermostat, writes to remote thermostats
|
||||||
|
return (read ? actual_master_thermostat_ : 0x1A + i);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return device_id;
|
return device_id;
|
||||||
@@ -219,7 +227,7 @@ void EMSESP::watch_id(uint16_t watch_id) {
|
|||||||
|
|
||||||
// resets all counters and bumps the UART
|
// resets all counters and bumps the UART
|
||||||
// this is called when the tx_mode is persisted in the FS either via Web UI or the console
|
// this is called when the tx_mode is persisted in the FS either via Web UI or the console
|
||||||
void EMSESP::init_uart() {
|
void EMSESP::uart_init() {
|
||||||
uint8_t tx_mode;
|
uint8_t tx_mode;
|
||||||
uint8_t rx_gpio;
|
uint8_t rx_gpio;
|
||||||
uint8_t tx_gpio;
|
uint8_t tx_gpio;
|
||||||
@@ -1355,7 +1363,7 @@ void EMSESP::send_raw_telegram(const char * data) {
|
|||||||
// start all the core services
|
// start all the core services
|
||||||
// the services must be loaded in the correct order
|
// the services must be loaded in the correct order
|
||||||
void EMSESP::start() {
|
void EMSESP::start() {
|
||||||
Serial.begin(115200);
|
console_.start_serial();
|
||||||
|
|
||||||
// start the file system
|
// start the file system
|
||||||
#ifndef EMSESP_STANDALONE
|
#ifndef EMSESP_STANDALONE
|
||||||
@@ -1365,38 +1373,41 @@ void EMSESP::start() {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
esp8266React.begin(); // loads core system services settings (network, mqtt, ap, ntp etc)
|
esp8266React.begin(); // loads core system services settings (network, mqtt, ap, ntp etc)
|
||||||
system_.check_upgrade(); // do any system upgrades
|
webLogService.begin(); // start web log service. now we can start capturing logs to the web log
|
||||||
webSettingsService.begin(); // load EMS-ESP Application settings...
|
LOG_INFO(F("Starting EMS-ESP version %s (hostname: %s)"), EMSESP_APP_VERSION, system_.hostname().c_str()); // welcome message
|
||||||
system_.get_settings(); // ...and store some of the settings locally for future reference
|
|
||||||
console_.start(system_.telnet_enabled()); // telnet and serial console, from here we can start logging events
|
|
||||||
webLogService.start(); // start web log service
|
|
||||||
webCustomizationService.begin(); // load the customizations
|
|
||||||
|
|
||||||
// welcome message
|
|
||||||
LOG_INFO(F("Starting EMS-ESP version %s (hostname: %s)"), EMSESP_APP_VERSION, system_.hostname().c_str());
|
|
||||||
LOG_INFO(F("Configuring for interface board profile %s"), system_.board_profile().c_str());
|
|
||||||
|
|
||||||
// start all the EMS-ESP services
|
|
||||||
mqtt_.start(); // mqtt init
|
|
||||||
system_.start(heap_start); // starts commands, led, adc, button, network, syslog & uart
|
|
||||||
shower_.start(); // initialize shower timer and shower alert
|
|
||||||
dallassensor_.start(); // Dallas external sensors
|
|
||||||
analogsensor_.start(); // Analog external sensors
|
|
||||||
webServer.begin(); // start the web server
|
|
||||||
// emsdevices.reserve(5); // reserve space for initially 5 devices to avoid mem frag issues
|
|
||||||
|
|
||||||
LOG_INFO(F("Last system reset reason Core0: %s, Core1: %s"), system_.reset_reason(0).c_str(), system_.reset_reason(1).c_str());
|
LOG_INFO(F("Last system reset reason Core0: %s, Core1: %s"), system_.reset_reason(0).c_str(), system_.reset_reason(1).c_str());
|
||||||
|
|
||||||
// Load our library of known devices into stack mem. Names are stored in Flash memory (takes up about 1kb)
|
webSettingsService.begin(); // load EMS-ESP Application settings...
|
||||||
|
system_.reload_settings(); // ... and store some of the settings locally
|
||||||
|
webCustomizationService.begin(); // load the customizations
|
||||||
|
|
||||||
|
// start telnet service if it's enabled
|
||||||
|
if (system_.telnet_enabled()) {
|
||||||
|
console_.start_telnet();
|
||||||
|
}
|
||||||
|
|
||||||
|
system_.check_upgrade(); // do any system upgrades
|
||||||
|
|
||||||
|
// start all the EMS-ESP services
|
||||||
|
mqtt_.start(); // mqtt init
|
||||||
|
system_.start(); // starts commands, led, adc, button, network, syslog & uart
|
||||||
|
shower_.start(); // initialize shower timer and shower alert
|
||||||
|
dallassensor_.start(); // Dallas external sensors
|
||||||
|
analogsensor_.start(); // Analog external sensors
|
||||||
|
webLogService.start(); // apply settings to weblog service
|
||||||
|
|
||||||
|
// Load our library of known devices into stack mem. Names are stored in Flash memory
|
||||||
device_library_ = {
|
device_library_ = {
|
||||||
#include "device_library.h"
|
#include "device_library.h"
|
||||||
};
|
};
|
||||||
LOG_INFO(F("EMS device library loaded with %d records"), device_library_.size());
|
LOG_INFO(F("Loaded EMS device library (%d records)"), device_library_.size());
|
||||||
|
|
||||||
#if defined(EMSESP_STANDALONE)
|
#if defined(EMSESP_STANDALONE)
|
||||||
Mqtt::on_connect(); // simulate an MQTT connection
|
Mqtt::on_connect(); // simulate an MQTT connection
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
webServer.begin(); // start the web server
|
||||||
}
|
}
|
||||||
|
|
||||||
// main loop calling all services
|
// main loop calling all services
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ class EMSESP {
|
|||||||
static void show_devices(uuid::console::Shell & shell);
|
static void show_devices(uuid::console::Shell & shell);
|
||||||
static void show_ems(uuid::console::Shell & shell);
|
static void show_ems(uuid::console::Shell & shell);
|
||||||
|
|
||||||
static void init_uart();
|
static void uart_init();
|
||||||
|
|
||||||
static void incoming_telegram(uint8_t * data, const uint8_t length);
|
static void incoming_telegram(uint8_t * data, const uint8_t length);
|
||||||
|
|
||||||
|
|||||||
@@ -375,7 +375,7 @@ MAKE_PSTR_LIST(enum_controlmode, F_(off), F_(optimized), F_(simple), F_(mpc), F_
|
|||||||
MAKE_PSTR_LIST(enum_controlmode2, F_(outdoor), F_(room))
|
MAKE_PSTR_LIST(enum_controlmode2, F_(outdoor), F_(room))
|
||||||
// MAKE_PSTR_LIST(enum_controlmode3, F_(off), F_(room), F_(outdoor), F("room+outdoor"))
|
// MAKE_PSTR_LIST(enum_controlmode3, F_(off), F_(room), F_(outdoor), F("room+outdoor"))
|
||||||
MAKE_PSTR_LIST(enum_control, F_(off), F_(rc20), F_(rc3x))
|
MAKE_PSTR_LIST(enum_control, F_(off), F_(rc20), F_(rc3x))
|
||||||
MAKE_PSTR_LIST(enum_j_control, F_(off), F("fb10"), F("fb110"))
|
MAKE_PSTR_LIST(enum_j_control, F_(off), F("fb10"), F("fb100"))
|
||||||
|
|
||||||
MAKE_PSTR_LIST(enum_wwProgMode, F("std_prog"), F_(own_prog))
|
MAKE_PSTR_LIST(enum_wwProgMode, F("std_prog"), F_(own_prog))
|
||||||
MAKE_PSTR_LIST(enum_dayOfWeek, F("mo"), F("tu"), F("we"), F("th"), F("fr"), F("sa"), F("so"), F("all"))
|
MAKE_PSTR_LIST(enum_dayOfWeek, F("mo"), F("tu"), F("we"), F("th"), F("fr"), F("sa"), F("so"), F("all"))
|
||||||
|
|||||||
128
src/system.cpp
128
src/system.cpp
@@ -48,9 +48,8 @@ uuid::syslog::SyslogService System::syslog_;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// init statics
|
// init statics
|
||||||
uint32_t System::heap_start_ = 1; // avoid using 0 to divide-by-zero later
|
PButton System::myPButton_;
|
||||||
PButton System::myPButton_;
|
bool System::restart_requested_ = false;
|
||||||
bool System::restart_requested_ = false;
|
|
||||||
|
|
||||||
// send on/off to a gpio pin
|
// send on/off to a gpio pin
|
||||||
// value: true = HIGH, false = LOW
|
// value: true = HIGH, false = LOW
|
||||||
@@ -169,7 +168,7 @@ bool System::command_syslog_level(const char * value, const int8_t id) {
|
|||||||
return StateUpdateResult::CHANGED;
|
return StateUpdateResult::CHANGED;
|
||||||
},
|
},
|
||||||
"local");
|
"local");
|
||||||
EMSESP::system_.syslog_start();
|
EMSESP::system_.syslog_init();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -240,7 +239,7 @@ void System::format(uuid::console::Shell & shell) {
|
|||||||
System::system_restart();
|
System::system_restart();
|
||||||
}
|
}
|
||||||
|
|
||||||
void System::syslog_start() {
|
void System::syslog_init() {
|
||||||
bool was_enabled = syslog_enabled_;
|
bool was_enabled = syslog_enabled_;
|
||||||
EMSESP::webSettingsService.read([&](WebSettings & settings) {
|
EMSESP::webSettingsService.read([&](WebSettings & settings) {
|
||||||
syslog_enabled_ = settings.syslog_enabled;
|
syslog_enabled_ = settings.syslog_enabled;
|
||||||
@@ -287,7 +286,7 @@ void System::syslog_start() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// read some specific system settings to store locally for faster access
|
// read some specific system settings to store locally for faster access
|
||||||
void System::get_settings() {
|
void System::reload_settings() {
|
||||||
EMSESP::webSettingsService.read([&](WebSettings & settings) {
|
EMSESP::webSettingsService.read([&](WebSettings & settings) {
|
||||||
pbutton_gpio_ = settings.pbutton_gpio;
|
pbutton_gpio_ = settings.pbutton_gpio;
|
||||||
analog_enabled_ = settings.analog_enabled;
|
analog_enabled_ = settings.analog_enabled;
|
||||||
@@ -360,20 +359,8 @@ bool System::is_valid_gpio(uint8_t pin) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// first call. Sets memory and starts up the UART Serial bridge
|
// Starts up the UART Serial bridge
|
||||||
void System::start(uint32_t heap_start) {
|
void System::start() {
|
||||||
#if defined(EMSESP_DEBUG)
|
|
||||||
show_mem("Startup");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// set the inital free mem, only on first boot
|
|
||||||
if (heap_start_ < 2) {
|
|
||||||
heap_start_ = heap_start;
|
|
||||||
}
|
|
||||||
|
|
||||||
// load in all the settings first
|
|
||||||
get_settings();
|
|
||||||
|
|
||||||
#ifndef EMSESP_STANDALONE
|
#ifndef EMSESP_STANDALONE
|
||||||
// disable bluetooth module
|
// disable bluetooth module
|
||||||
// periph_module_disable(PERIPH_BT_MODULE);
|
// periph_module_disable(PERIPH_BT_MODULE);
|
||||||
@@ -390,9 +377,9 @@ void System::start(uint32_t heap_start) {
|
|||||||
led_init(false); // init LED
|
led_init(false); // init LED
|
||||||
button_init(false); // the special button
|
button_init(false); // the special button
|
||||||
network_init(false); // network
|
network_init(false); // network
|
||||||
syslog_start(); // start Syslog
|
syslog_init(); // start Syslog
|
||||||
|
|
||||||
EMSESP::init_uart(); // start UART
|
EMSESP::uart_init(); // start UART
|
||||||
}
|
}
|
||||||
|
|
||||||
// button single click
|
// button single click
|
||||||
@@ -429,7 +416,7 @@ void System::button_OnVLongPress(PButton & b) {
|
|||||||
// push button
|
// push button
|
||||||
void System::button_init(bool refresh) {
|
void System::button_init(bool refresh) {
|
||||||
if (refresh) {
|
if (refresh) {
|
||||||
get_settings();
|
reload_settings();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_valid_gpio(pbutton_gpio_)) {
|
if (is_valid_gpio(pbutton_gpio_)) {
|
||||||
@@ -451,7 +438,7 @@ void System::button_init(bool refresh) {
|
|||||||
// set the LED to on or off when in normal operating mode
|
// set the LED to on or off when in normal operating mode
|
||||||
void System::led_init(bool refresh) {
|
void System::led_init(bool refresh) {
|
||||||
if (refresh) {
|
if (refresh) {
|
||||||
get_settings();
|
reload_settings();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((led_gpio_ != 0) && is_valid_gpio(led_gpio_)) {
|
if ((led_gpio_ != 0) && is_valid_gpio(led_gpio_)) {
|
||||||
@@ -517,15 +504,6 @@ void System::loop() {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void System::show_mem(const char * note) {
|
|
||||||
#ifndef EMSESP_STANDALONE
|
|
||||||
static uint32_t old_free_heap = 0;
|
|
||||||
uint32_t free_heap = ESP.getFreeHeap();
|
|
||||||
LOG_INFO(F("(%s) Free heap: %lu (~%lu)"), note, free_heap, (uint32_t)Helpers::abs(free_heap - old_free_heap));
|
|
||||||
old_free_heap = free_heap;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
// create the json for heartbeat
|
// create the json for heartbeat
|
||||||
bool System::heartbeat_json(JsonObject & output) {
|
bool System::heartbeat_json(JsonObject & output) {
|
||||||
uint8_t bus_status = EMSESP::bus_status();
|
uint8_t bus_status = EMSESP::bus_status();
|
||||||
@@ -590,7 +568,7 @@ void System::send_heartbeat() {
|
|||||||
// initializes network
|
// initializes network
|
||||||
void System::network_init(bool refresh) {
|
void System::network_init(bool refresh) {
|
||||||
if (refresh) {
|
if (refresh) {
|
||||||
get_settings();
|
reload_settings();
|
||||||
}
|
}
|
||||||
|
|
||||||
last_system_check_ = 0; // force the LED to go from fast flash to pulse
|
last_system_check_ = 0; // force the LED to go from fast flash to pulse
|
||||||
@@ -785,80 +763,82 @@ void System::show_users(uuid::console::Shell & shell) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void System::show_system(uuid::console::Shell & shell) {
|
void System::show_system(uuid::console::Shell & shell) {
|
||||||
shell.printfln(F("Uptime: %s"), uuid::log::format_timestamp_ms(uuid::get_uptime_ms(), 3).c_str());
|
shell.println("System:");
|
||||||
|
shell.printfln(F(" Board profile: %s"), board_profile().c_str());
|
||||||
|
shell.printfln(F(" Uptime: %s"), uuid::log::format_timestamp_ms(uuid::get_uptime_ms(), 3).c_str());
|
||||||
#ifndef EMSESP_STANDALONE
|
#ifndef EMSESP_STANDALONE
|
||||||
shell.printfln(F("SDK version: %s"), ESP.getSdkVersion());
|
shell.printfln(F(" SDK version: %s"), ESP.getSdkVersion());
|
||||||
shell.printfln(F("CPU frequency: %lu MHz"), ESP.getCpuFreqMHz());
|
shell.printfln(F(" CPU frequency: %lu MHz"), ESP.getCpuFreqMHz());
|
||||||
shell.printfln(F("Free heap: %lu bytes"), (uint32_t)ESP.getFreeHeap());
|
shell.printfln(F(" Free heap: %lu bytes"), (uint32_t)ESP.getFreeHeap());
|
||||||
shell.println();
|
shell.println();
|
||||||
|
|
||||||
|
shell.println("Network:");
|
||||||
switch (WiFi.status()) {
|
switch (WiFi.status()) {
|
||||||
case WL_IDLE_STATUS:
|
case WL_IDLE_STATUS:
|
||||||
shell.printfln(F("Network: Idle"));
|
shell.printfln(F(" Network: Idle"));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WL_NO_SSID_AVAIL:
|
case WL_NO_SSID_AVAIL:
|
||||||
shell.printfln(F("Network: Network not found"));
|
shell.printfln(F(" Network: Network not found"));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WL_SCAN_COMPLETED:
|
case WL_SCAN_COMPLETED:
|
||||||
shell.printfln(F("Network: Network scan complete"));
|
shell.printfln(F(" Network: Network scan complete"));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WL_CONNECTED:
|
case WL_CONNECTED:
|
||||||
shell.printfln(F("Network: connected"));
|
shell.printfln(F(" Network: connected"));
|
||||||
shell.printfln(F("SSID: %s"), WiFi.SSID().c_str());
|
shell.printfln(F(" SSID: %s"), WiFi.SSID().c_str());
|
||||||
shell.printfln(F("BSSID: %s"), WiFi.BSSIDstr().c_str());
|
shell.printfln(F(" BSSID: %s"), WiFi.BSSIDstr().c_str());
|
||||||
shell.printfln(F("RSSI: %d dBm (%d %%)"), WiFi.RSSI(), wifi_quality(WiFi.RSSI()));
|
shell.printfln(F(" RSSI: %d dBm (%d %%)"), WiFi.RSSI(), wifi_quality(WiFi.RSSI()));
|
||||||
shell.printfln(F("MAC address: %s"), WiFi.macAddress().c_str());
|
shell.printfln(F(" MAC address: %s"), WiFi.macAddress().c_str());
|
||||||
shell.printfln(F("Hostname: %s"), WiFi.getHostname());
|
shell.printfln(F(" Hostname: %s"), WiFi.getHostname());
|
||||||
shell.printfln(F("IPv4 address: %s/%s"), uuid::printable_to_string(WiFi.localIP()).c_str(), uuid::printable_to_string(WiFi.subnetMask()).c_str());
|
shell.printfln(F(" IPv4 address: %s/%s"), uuid::printable_to_string(WiFi.localIP()).c_str(), uuid::printable_to_string(WiFi.subnetMask()).c_str());
|
||||||
shell.printfln(F("IPv4 gateway: %s"), uuid::printable_to_string(WiFi.gatewayIP()).c_str());
|
shell.printfln(F(" IPv4 gateway: %s"), uuid::printable_to_string(WiFi.gatewayIP()).c_str());
|
||||||
shell.printfln(F("IPv4 nameserver: %s"), uuid::printable_to_string(WiFi.dnsIP()).c_str());
|
shell.printfln(F(" IPv4 nameserver: %s"), uuid::printable_to_string(WiFi.dnsIP()).c_str());
|
||||||
if (WiFi.localIPv6().toString() != "0000:0000:0000:0000:0000:0000:0000:0000") {
|
if (WiFi.localIPv6().toString() != "0000:0000:0000:0000:0000:0000:0000:0000") {
|
||||||
shell.printfln(F("IPv6 address: %s"), uuid::printable_to_string(WiFi.localIPv6()).c_str());
|
shell.printfln(F(" IPv6 address: %s"), uuid::printable_to_string(WiFi.localIPv6()).c_str());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WL_CONNECT_FAILED:
|
case WL_CONNECT_FAILED:
|
||||||
shell.printfln(F("WiFi Network: Connection failed"));
|
shell.printfln(F(" WiFi Network: Connection failed"));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WL_CONNECTION_LOST:
|
case WL_CONNECTION_LOST:
|
||||||
shell.printfln(F("WiFi Network: Connection lost"));
|
shell.printfln(F(" WiFi Network: Connection lost"));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WL_DISCONNECTED:
|
case WL_DISCONNECTED:
|
||||||
shell.printfln(F("WiFi Network: Disconnected"));
|
shell.printfln(F(" WiFi Network: Disconnected"));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WL_NO_SHIELD:
|
case WL_NO_SHIELD:
|
||||||
default:
|
default:
|
||||||
shell.printfln(F("WiFi Network: Unknown"));
|
shell.printfln(F(" WiFi Network: Unknown"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
shell.println();
|
|
||||||
|
|
||||||
// show Ethernet if connected
|
// show Ethernet if connected
|
||||||
if (ethernet_connected_) {
|
if (ethernet_connected_) {
|
||||||
shell.printfln(F("Wired Network: connected"));
|
shell.println();
|
||||||
shell.printfln(F("MAC address: %s"), ETH.macAddress().c_str());
|
shell.printfln(F(" Wired Network: connected"));
|
||||||
shell.printfln(F("Hostname: %s"), ETH.getHostname());
|
shell.printfln(F(" MAC address: %s"), ETH.macAddress().c_str());
|
||||||
shell.printfln(F("IPv4 address: %s/%s"), uuid::printable_to_string(ETH.localIP()).c_str(), uuid::printable_to_string(ETH.subnetMask()).c_str());
|
shell.printfln(F(" Hostname: %s"), ETH.getHostname());
|
||||||
shell.printfln(F("IPv4 gateway: %s"), uuid::printable_to_string(ETH.gatewayIP()).c_str());
|
shell.printfln(F(" IPv4 address: %s/%s"), uuid::printable_to_string(ETH.localIP()).c_str(), uuid::printable_to_string(ETH.subnetMask()).c_str());
|
||||||
shell.printfln(F("IPv4 nameserver: %s"), uuid::printable_to_string(ETH.dnsIP()).c_str());
|
shell.printfln(F(" IPv4 gateway: %s"), uuid::printable_to_string(ETH.gatewayIP()).c_str());
|
||||||
|
shell.printfln(F(" IPv4 nameserver: %s"), uuid::printable_to_string(ETH.dnsIP()).c_str());
|
||||||
if (ETH.localIPv6().toString() != "0000:0000:0000:0000:0000:0000:0000:0000") {
|
if (ETH.localIPv6().toString() != "0000:0000:0000:0000:0000:0000:0000:0000") {
|
||||||
shell.printfln(F("IPv6 address: %s"), uuid::printable_to_string(ETH.localIPv6()).c_str());
|
shell.printfln(F(" IPv6 address: %s"), uuid::printable_to_string(ETH.localIPv6()).c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
shell.println();
|
shell.println();
|
||||||
|
|
||||||
|
shell.println("Syslog:");
|
||||||
if (!syslog_enabled_) {
|
if (!syslog_enabled_) {
|
||||||
shell.printfln(F("Syslog: disabled"));
|
shell.printfln(F(" Syslog: disabled"));
|
||||||
} else {
|
} else {
|
||||||
shell.printfln(F("Syslog: %s"), syslog_.started() ? "started" : "stopped");
|
shell.printfln(F(" Syslog: %s"), syslog_.started() ? "started" : "stopped");
|
||||||
shell.print(F(" "));
|
shell.print(F(" "));
|
||||||
shell.printfln(F_(host_fmt), !syslog_host_.isEmpty() ? syslog_host_.c_str() : read_flash_string(F_(unset)).c_str());
|
shell.printfln(F_(host_fmt), !syslog_host_.isEmpty() ? syslog_host_.c_str() : read_flash_string(F_(unset)).c_str());
|
||||||
shell.printfln(F(" IP: %s"), uuid::printable_to_string(syslog_.ip()).c_str());
|
shell.printfln(F(" IP: %s"), uuid::printable_to_string(syslog_.ip()).c_str());
|
||||||
@@ -1207,15 +1187,15 @@ bool System::command_test(const char * value, const int8_t id) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// takes a board profile and populates a data array with GPIO configurations
|
// takes a board profile and populates a data array with GPIO configurations
|
||||||
// returns false if profile is not found
|
// returns false if profile is unknown
|
||||||
//
|
//
|
||||||
// data = led, dallas, rx, tx, button, phy_type, eth_power, eth_phy_addr, eth_clock_mode
|
// data = led, dallas, rx, tx, button, phy_type, eth_power, eth_phy_addr, eth_clock_mode
|
||||||
//
|
//
|
||||||
// clock modes:
|
// clock modes:
|
||||||
// ETH_CLOCK_GPIO0_IN = 0 RMII clock input to GPIO0
|
// 0 = RMII clock input to GPIO0
|
||||||
// ETH_CLOCK_GPIO0_OUT = 1 RMII clock output from GPIO0
|
// 1 = RMII clock output from GPIO0
|
||||||
// ETH_CLOCK_GPIO16_OUT = 2 RMII clock output from GPIO16
|
// 2 = RMII clock output from GPIO16
|
||||||
// ETH_CLOCK_GPIO17_OUT = 3 RMII clock output from GPIO17, for 50hz inverted cloc
|
// 3 = RMII clock output from GPIO17, for 50hz inverted clock
|
||||||
bool System::load_board_profile(std::vector<int8_t> & data, const std::string & board_profile) {
|
bool System::load_board_profile(std::vector<int8_t> & data, const std::string & board_profile) {
|
||||||
if (board_profile == "S32") {
|
if (board_profile == "S32") {
|
||||||
data = {2, 18, 23, 5, 0, PHY_type::PHY_TYPE_NONE, 0, 0, 0}; // BBQKees Gateway S32
|
data = {2, 18, 23, 5, 0, PHY_type::PHY_TYPE_NONE, 0, 0, 0}; // BBQKees Gateway S32
|
||||||
@@ -1243,7 +1223,7 @@ bool System::load_board_profile(std::vector<int8_t> & data, const std::string &
|
|||||||
(int8_t)EMSESP::system_.eth_phy_addr_,
|
(int8_t)EMSESP::system_.eth_phy_addr_,
|
||||||
(int8_t)EMSESP::system_.eth_clock_mode_};
|
(int8_t)EMSESP::system_.eth_clock_mode_};
|
||||||
} else {
|
} else {
|
||||||
// unknown, use defaults
|
// unknown, use defaults and return false
|
||||||
data = {
|
data = {
|
||||||
EMSESP_DEFAULT_LED_GPIO,
|
EMSESP_DEFAULT_LED_GPIO,
|
||||||
EMSESP_DEFAULT_DALLAS_GPIO,
|
EMSESP_DEFAULT_DALLAS_GPIO,
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ enum PHY_type : uint8_t { PHY_TYPE_NONE = 0, PHY_TYPE_LAN8720, PHY_TYPE_TLK110 }
|
|||||||
|
|
||||||
class System {
|
class System {
|
||||||
public:
|
public:
|
||||||
void start(uint32_t heap_start);
|
void start();
|
||||||
void loop();
|
void loop();
|
||||||
|
|
||||||
// commands
|
// commands
|
||||||
@@ -72,9 +72,9 @@ class System {
|
|||||||
void upload_status(bool in_progress);
|
void upload_status(bool in_progress);
|
||||||
bool upload_status();
|
bool upload_status();
|
||||||
void show_mem(const char * note);
|
void show_mem(const char * note);
|
||||||
void get_settings();
|
void reload_settings();
|
||||||
void wifi_tweak();
|
void wifi_tweak();
|
||||||
void syslog_start();
|
void syslog_init();
|
||||||
bool check_upgrade();
|
bool check_upgrade();
|
||||||
bool heartbeat_json(JsonObject & output);
|
bool heartbeat_json(JsonObject & output);
|
||||||
void send_heartbeat();
|
void send_heartbeat();
|
||||||
@@ -180,7 +180,6 @@ class System {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
static uuid::log::Logger logger_;
|
static uuid::log::Logger logger_;
|
||||||
static uint32_t heap_start_;
|
|
||||||
static bool restart_requested_;
|
static bool restart_requested_;
|
||||||
|
|
||||||
// button
|
// button
|
||||||
@@ -220,7 +219,7 @@ class System {
|
|||||||
bool ethernet_connected_ = false;
|
bool ethernet_connected_ = false;
|
||||||
|
|
||||||
// EMS-ESP settings
|
// EMS-ESP settings
|
||||||
// copies from WebSettings class in WebSettingsService.h
|
// copies from WebSettings class in WebSettingsService.h and loaded with reload_settings()
|
||||||
std::string hostname_ = FACTORY_WIFI_HOSTNAME;
|
std::string hostname_ = FACTORY_WIFI_HOSTNAME;
|
||||||
bool hide_led_;
|
bool hide_led_;
|
||||||
uint8_t led_gpio_;
|
uint8_t led_gpio_;
|
||||||
|
|||||||
@@ -359,8 +359,9 @@ void TxService::send_telegram(const QueuedTxTelegram & tx_telegram) {
|
|||||||
telegram_raw[message_p++] = telegram->message_data[i];
|
telegram_raw[message_p++] = telegram->message_data[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// make a copy of the telegram with new dest (without read-flag)
|
||||||
telegram_last_ = std::make_shared<Telegram>(*telegram); // make a copy of the telegram
|
telegram_last_ = std::make_shared<Telegram>(
|
||||||
|
telegram->operation, telegram->src, dest & 0x7F, telegram->type_id, telegram->offset, telegram->message_data, telegram->message_length);
|
||||||
|
|
||||||
uint8_t length = message_p;
|
uint8_t length = message_p;
|
||||||
telegram_raw[length] = calculate_crc(telegram_raw, length); // generate and append CRC to the end
|
telegram_raw[length] = calculate_crc(telegram_raw, length); // generate and append CRC to the end
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
#define EMSESP_APP_VERSION "3.4.0b2"
|
#define EMSESP_APP_VERSION "3.4.0b4"
|
||||||
|
|||||||
@@ -45,7 +45,12 @@ void WebLogService::forbidden(AsyncWebServerRequest * request) {
|
|||||||
request->send(403);
|
request->send(403);
|
||||||
}
|
}
|
||||||
|
|
||||||
// start event source service
|
// start the log service with INFO level
|
||||||
|
void WebLogService::begin() {
|
||||||
|
uuid::log::Logger::register_handler(this, uuid::log::Level::INFO);
|
||||||
|
}
|
||||||
|
|
||||||
|
// apply the user settings
|
||||||
void WebLogService::start() {
|
void WebLogService::start() {
|
||||||
EMSESP::webSettingsService.read([&](WebSettings & settings) {
|
EMSESP::webSettingsService.read([&](WebSettings & settings) {
|
||||||
maximum_log_messages_ = settings.weblog_buffer;
|
maximum_log_messages_ = settings.weblog_buffer;
|
||||||
@@ -105,14 +110,6 @@ WebLogService::QueuedLogMessage::QueuedLogMessage(unsigned long id, std::shared_
|
|||||||
}
|
}
|
||||||
|
|
||||||
void WebLogService::operator<<(std::shared_ptr<uuid::log::Message> message) {
|
void WebLogService::operator<<(std::shared_ptr<uuid::log::Message> message) {
|
||||||
/*
|
|
||||||
// special case for trace, show trace and notice messages only
|
|
||||||
// added by mvdp
|
|
||||||
if (log_level() == uuid::log::Level::TRACE && message->level != uuid::log::Level::TRACE && message->level != uuid::log::Level::NOTICE) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (log_messages_.size() >= maximum_log_messages_) {
|
if (log_messages_.size() >= maximum_log_messages_) {
|
||||||
log_messages_.pop_front();
|
log_messages_.pop_front();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ class WebLogService : public uuid::log::Handler {
|
|||||||
|
|
||||||
WebLogService(AsyncWebServer * server, SecurityManager * securityManager);
|
WebLogService(AsyncWebServer * server, SecurityManager * securityManager);
|
||||||
|
|
||||||
|
void begin();
|
||||||
void start();
|
void start();
|
||||||
uuid::log::Level log_level() const;
|
uuid::log::Level log_level() const;
|
||||||
void log_level(uuid::log::Level level);
|
void log_level(uuid::log::Level level);
|
||||||
|
|||||||
@@ -78,10 +78,12 @@ void WebSettings::read(WebSettings & settings, JsonObject & root) {
|
|||||||
StateUpdateResult WebSettings::update(JsonObject & root, WebSettings & settings) {
|
StateUpdateResult WebSettings::update(JsonObject & root, WebSettings & settings) {
|
||||||
// load default GPIO configuration based on board profile
|
// load default GPIO configuration based on board profile
|
||||||
std::vector<int8_t> data; // // led, dallas, rx, tx, button, phy_type, eth_power, eth_phy_addr, eth_clock_mode
|
std::vector<int8_t> data; // // led, dallas, rx, tx, button, phy_type, eth_power, eth_phy_addr, eth_clock_mode
|
||||||
|
|
||||||
settings.board_profile = root["board_profile"] | EMSESP_DEFAULT_BOARD_PROFILE;
|
settings.board_profile = root["board_profile"] | EMSESP_DEFAULT_BOARD_PROFILE;
|
||||||
if (!System::load_board_profile(data, settings.board_profile.c_str())) {
|
if (!System::load_board_profile(data, settings.board_profile.c_str())) {
|
||||||
settings.board_profile = EMSESP_DEFAULT_BOARD_PROFILE; // invalid board configuration, override the default in case it has been misspelled
|
settings.board_profile = "CUSTOM";
|
||||||
|
EMSESP::logger().info("No board profile found. Re-setting to %s", settings.board_profile.c_str());
|
||||||
|
} else {
|
||||||
|
EMSESP::logger().info("Loading board profile %s", settings.board_profile.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t default_led_gpio = data[0];
|
uint8_t default_led_gpio = data[0];
|
||||||
@@ -112,15 +114,12 @@ StateUpdateResult WebSettings::update(JsonObject & root, WebSettings & settings)
|
|||||||
prev = settings.syslog_enabled;
|
prev = settings.syslog_enabled;
|
||||||
settings.syslog_enabled = root["syslog_enabled"] | EMSESP_DEFAULT_SYSLOG_ENABLED;
|
settings.syslog_enabled = root["syslog_enabled"] | EMSESP_DEFAULT_SYSLOG_ENABLED;
|
||||||
check_flag(prev, settings.syslog_enabled, ChangeFlags::SYSLOG);
|
check_flag(prev, settings.syslog_enabled, ChangeFlags::SYSLOG);
|
||||||
|
|
||||||
prev = settings.syslog_level;
|
prev = settings.syslog_level;
|
||||||
settings.syslog_level = root["syslog_level"] | EMSESP_DEFAULT_SYSLOG_LEVEL;
|
settings.syslog_level = root["syslog_level"] | EMSESP_DEFAULT_SYSLOG_LEVEL;
|
||||||
check_flag(prev, settings.syslog_level, ChangeFlags::SYSLOG);
|
check_flag(prev, settings.syslog_level, ChangeFlags::SYSLOG);
|
||||||
|
|
||||||
prev = settings.syslog_mark_interval;
|
prev = settings.syslog_mark_interval;
|
||||||
settings.syslog_mark_interval = root["syslog_mark_interval"] | EMSESP_DEFAULT_SYSLOG_MARK_INTERVAL;
|
settings.syslog_mark_interval = root["syslog_mark_interval"] | EMSESP_DEFAULT_SYSLOG_MARK_INTERVAL;
|
||||||
check_flag(prev, settings.syslog_mark_interval, ChangeFlags::SYSLOG);
|
check_flag(prev, settings.syslog_mark_interval, ChangeFlags::SYSLOG);
|
||||||
|
|
||||||
prev = settings.syslog_port;
|
prev = settings.syslog_port;
|
||||||
settings.syslog_port = root["syslog_port"] | EMSESP_DEFAULT_SYSLOG_PORT;
|
settings.syslog_port = root["syslog_port"] | EMSESP_DEFAULT_SYSLOG_PORT;
|
||||||
check_flag(prev, settings.syslog_port, ChangeFlags::SYSLOG);
|
check_flag(prev, settings.syslog_port, ChangeFlags::SYSLOG);
|
||||||
@@ -167,8 +166,22 @@ StateUpdateResult WebSettings::update(JsonObject & root, WebSettings & settings)
|
|||||||
settings.analog_enabled = root["analog_enabled"] | EMSESP_DEFAULT_ANALOG_ENABLED;
|
settings.analog_enabled = root["analog_enabled"] | EMSESP_DEFAULT_ANALOG_ENABLED;
|
||||||
check_flag(prev, settings.analog_enabled, ChangeFlags::ADC);
|
check_flag(prev, settings.analog_enabled, ChangeFlags::ADC);
|
||||||
|
|
||||||
|
// ethernet
|
||||||
|
prev = settings.phy_type;
|
||||||
|
settings.phy_type = root["phy_type"] | default_phy_type;
|
||||||
|
check_flag(prev, settings.phy_type, ChangeFlags::RESTART);
|
||||||
|
prev = settings.eth_power;
|
||||||
|
settings.eth_power = root["eth_power"] | default_eth_power;
|
||||||
|
check_flag(prev, settings.eth_power, ChangeFlags::RESTART);
|
||||||
|
prev = settings.eth_phy_addr;
|
||||||
|
settings.eth_phy_addr = root["eth_phy_addr"] | default_eth_phy_addr;
|
||||||
|
check_flag(prev, settings.eth_phy_addr, ChangeFlags::RESTART);
|
||||||
|
prev = settings.eth_clock_mode;
|
||||||
|
settings.eth_clock_mode = root["eth_clock_mode"] | default_eth_clock_mode;
|
||||||
|
check_flag(prev, settings.eth_clock_mode, ChangeFlags::RESTART);
|
||||||
|
|
||||||
//
|
//
|
||||||
// these need reboots to be applied...
|
// these need system restarts first before settings are activated...
|
||||||
//
|
//
|
||||||
prev = settings.telnet_enabled;
|
prev = settings.telnet_enabled;
|
||||||
settings.telnet_enabled = root["telnet_enabled"] | EMSESP_DEFAULT_TELNET_ENABLED;
|
settings.telnet_enabled = root["telnet_enabled"] | EMSESP_DEFAULT_TELNET_ENABLED;
|
||||||
@@ -186,25 +199,9 @@ StateUpdateResult WebSettings::update(JsonObject & root, WebSettings & settings)
|
|||||||
settings.master_thermostat = root["master_thermostat"] | EMSESP_DEFAULT_MASTER_THERMOSTAT;
|
settings.master_thermostat = root["master_thermostat"] | EMSESP_DEFAULT_MASTER_THERMOSTAT;
|
||||||
check_flag(prev, settings.master_thermostat, ChangeFlags::RESTART);
|
check_flag(prev, settings.master_thermostat, ChangeFlags::RESTART);
|
||||||
|
|
||||||
// use whatever came from the board profile
|
//
|
||||||
prev = settings.phy_type;
|
|
||||||
settings.phy_type = root["phy_type"] | default_phy_type;
|
|
||||||
check_flag(prev, settings.phy_type, ChangeFlags::RESTART);
|
|
||||||
|
|
||||||
prev = settings.eth_power;
|
|
||||||
settings.eth_power = root["eth_power"] | default_eth_power;
|
|
||||||
check_flag(prev, settings.eth_power, ChangeFlags::RESTART);
|
|
||||||
|
|
||||||
prev = settings.eth_phy_addr;
|
|
||||||
settings.eth_phy_addr = root["eth_phy_addr"] | default_eth_phy_addr;
|
|
||||||
check_flag(prev, settings.eth_phy_addr, ChangeFlags::RESTART);
|
|
||||||
|
|
||||||
prev = settings.eth_clock_mode;
|
|
||||||
settings.eth_clock_mode = root["eth_clock_mode"] | default_eth_clock_mode;
|
|
||||||
check_flag(prev, settings.eth_clock_mode, ChangeFlags::RESTART);
|
|
||||||
|
|
||||||
// without checks...
|
// without checks...
|
||||||
|
//
|
||||||
settings.trace_raw = root["trace_raw"] | EMSESP_DEFAULT_TRACELOG_RAW;
|
settings.trace_raw = root["trace_raw"] | EMSESP_DEFAULT_TRACELOG_RAW;
|
||||||
EMSESP::trace_raw(settings.trace_raw);
|
EMSESP::trace_raw(settings.trace_raw);
|
||||||
|
|
||||||
@@ -231,7 +228,6 @@ StateUpdateResult WebSettings::update(JsonObject & root, WebSettings & settings)
|
|||||||
if (flags_ == WebSettings::ChangeFlags::RESTART) {
|
if (flags_ == WebSettings::ChangeFlags::RESTART) {
|
||||||
return StateUpdateResult::CHANGED_RESTART; // tell WebUI that a restart is needed
|
return StateUpdateResult::CHANGED_RESTART; // tell WebUI that a restart is needed
|
||||||
}
|
}
|
||||||
|
|
||||||
return StateUpdateResult::CHANGED;
|
return StateUpdateResult::CHANGED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -247,11 +243,11 @@ void WebSettingsService::onUpdate() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (WebSettings::has_flags(WebSettings::ChangeFlags::UART)) {
|
if (WebSettings::has_flags(WebSettings::ChangeFlags::UART)) {
|
||||||
EMSESP::init_uart();
|
EMSESP::uart_init();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (WebSettings::has_flags(WebSettings::ChangeFlags::SYSLOG)) {
|
if (WebSettings::has_flags(WebSettings::ChangeFlags::SYSLOG)) {
|
||||||
EMSESP::system_.syslog_start(); // re-start (or stop)
|
EMSESP::system_.syslog_init(); // re-start (or stop)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (WebSettings::has_flags(WebSettings::ChangeFlags::ADC)) {
|
if (WebSettings::has_flags(WebSettings::ChangeFlags::ADC)) {
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ void WebStatusService::WiFiEvent(WiFiEvent_t event, WiFiEventInfo_t info) {
|
|||||||
EMSESP::esp8266React.getNetworkSettingsService()->read([&](NetworkSettings & networkSettings) {
|
EMSESP::esp8266React.getNetworkSettingsService()->read([&](NetworkSettings & networkSettings) {
|
||||||
if (!networkSettings.enableIPv6) {
|
if (!networkSettings.enableIPv6) {
|
||||||
EMSESP::system_.send_heartbeat();
|
EMSESP::system_.send_heartbeat();
|
||||||
EMSESP::system_.syslog_start();
|
EMSESP::system_.syslog_init();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
mDNS_start();
|
mDNS_start();
|
||||||
@@ -73,7 +73,7 @@ void WebStatusService::WiFiEvent(WiFiEvent_t event, WiFiEventInfo_t info) {
|
|||||||
EMSESP::esp8266React.getNetworkSettingsService()->read([&](NetworkSettings & networkSettings) {
|
EMSESP::esp8266React.getNetworkSettingsService()->read([&](NetworkSettings & networkSettings) {
|
||||||
if (!networkSettings.enableIPv6) {
|
if (!networkSettings.enableIPv6) {
|
||||||
EMSESP::system_.send_heartbeat();
|
EMSESP::system_.send_heartbeat();
|
||||||
EMSESP::system_.syslog_start();
|
EMSESP::system_.syslog_init();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
EMSESP::system_.ethernet_connected(true);
|
EMSESP::system_.ethernet_connected(true);
|
||||||
@@ -115,7 +115,7 @@ void WebStatusService::WiFiEvent(WiFiEvent_t event, WiFiEventInfo_t info) {
|
|||||||
EMSESP::logger().info(F("WiFi connected with IP=%s, hostname=%s"), WiFi.localIPv6().toString().c_str(), WiFi.getHostname());
|
EMSESP::logger().info(F("WiFi connected with IP=%s, hostname=%s"), WiFi.localIPv6().toString().c_str(), WiFi.getHostname());
|
||||||
}
|
}
|
||||||
EMSESP::system_.send_heartbeat();
|
EMSESP::system_.send_heartbeat();
|
||||||
EMSESP::system_.syslog_start();
|
EMSESP::system_.syslog_init();
|
||||||
mDNS_start();
|
mDNS_start();
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user