fixed overflow bug for voltage bigger than 32V (new limit is 65V)
Added CSS file to make display bigger for smartphones
This commit is contained in:
parent
c2ccafbcde
commit
05b8759bbb
@ -22,8 +22,8 @@ const float wheelDiameterInches = 20;
|
|||||||
const int numImpulsesPerTurn = 2;
|
const int numImpulsesPerTurn = 2;
|
||||||
const float wheelCircumferenceMeters = wheelDiameterInches * 0.0254f * 3.1415f / (float)numImpulsesPerTurn;
|
const float wheelCircumferenceMeters = wheelDiameterInches * 0.0254f * 3.1415f / (float)numImpulsesPerTurn;
|
||||||
|
|
||||||
int16_t batteryVoltage = -1; // in mV
|
uint16_t batteryVoltage = 0; // in mV
|
||||||
int16_t batteryCurrent = -1; // in mV
|
uint16_t batteryCurrent = 0; // in mV
|
||||||
|
|
||||||
WiFiMulti wifiMulti;
|
WiFiMulti wifiMulti;
|
||||||
wl_status_t wifi_STA_status = WL_NO_SHIELD;
|
wl_status_t wifi_STA_status = WL_NO_SHIELD;
|
||||||
@ -224,8 +224,8 @@ void loop()
|
|||||||
averageC = max(0.0f, averageC - 2.5f) / 0.0238f; // convert voltage to current, according to the sensor linear relation
|
averageC = max(0.0f, averageC - 2.5f) / 0.0238f; // convert voltage to current, according to the sensor linear relation
|
||||||
|
|
||||||
// TODO: mutex ?
|
// TODO: mutex ?
|
||||||
batteryVoltage = (int16_t)(averageV * 1000.0f + 0.5f);
|
batteryVoltage = (uint16_t)(averageV * 1000.0f + 0.5f);
|
||||||
batteryCurrent = (int16_t)(averageC * 1000.0f + 0.5f);
|
batteryCurrent = (uint16_t)(averageC * 1000.0f + 0.5f);
|
||||||
|
|
||||||
delay(10);
|
delay(10);
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,9 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/mithril": "^2.0.9",
|
"@types/mithril": "^2.0.9",
|
||||||
|
"css-loader": "^6.7.1",
|
||||||
"html-webpack-plugin": "^5.5.0",
|
"html-webpack-plugin": "^5.5.0",
|
||||||
|
"style-loader": "^3.3.1",
|
||||||
"ts-loader": "^9.2.8",
|
"ts-loader": "^9.2.8",
|
||||||
"typescript": "^4.6.2",
|
"typescript": "^4.6.2",
|
||||||
"webpack": "^5.70.0",
|
"webpack": "^5.70.0",
|
||||||
|
3
WebApp/src/main-page.css
Normal file
3
WebApp/src/main-page.css
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
.main-page p {
|
||||||
|
font-size: 4rem;
|
||||||
|
}
|
@ -1,6 +1,8 @@
|
|||||||
import m from 'mithril';
|
import m from 'mithril';
|
||||||
import { MonitorApi, Status } from './monitor-api';
|
import { MonitorApi, Status } from './monitor-api';
|
||||||
|
|
||||||
|
require("./main-page.css");
|
||||||
|
|
||||||
export default class MainPage {
|
export default class MainPage {
|
||||||
api = new MonitorApi(false);
|
api = new MonitorApi(false);
|
||||||
status?: Status;
|
status?: Status;
|
||||||
@ -22,7 +24,7 @@ export default class MainPage {
|
|||||||
|
|
||||||
view() {
|
view() {
|
||||||
return this.status
|
return this.status
|
||||||
? <div>
|
? <div class="main-page">
|
||||||
<p>Tension batterie : {this.status.batteryVoltage.toFixed(3)}V</p>
|
<p>Tension batterie : {this.status.batteryVoltage.toFixed(3)}V</p>
|
||||||
<p>Courant : {this.status.motorCurrent.toFixed(3)}A</p>
|
<p>Courant : {this.status.motorCurrent.toFixed(3)}A</p>
|
||||||
<p>Puissance : {(this.status.batteryVoltage * this.status.motorCurrent).toFixed(1)}W</p>
|
<p>Puissance : {(this.status.batteryVoltage * this.status.motorCurrent).toFixed(1)}W</p>
|
||||||
|
@ -10,6 +10,10 @@ module.exports = {
|
|||||||
use: 'ts-loader',
|
use: 'ts-loader',
|
||||||
exclude: /node_modules/,
|
exclude: /node_modules/,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
test: /\.css$/i,
|
||||||
|
use: ["style-loader", "css-loader"],
|
||||||
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
resolve: {
|
resolve: {
|
||||||
|
Loading…
Reference in New Issue
Block a user