Remove all stall detection logic, add 100ms current logging
- Removed all STALL_* configuration parameters from config.h - Simplified motor.h: removed stall-related methods and member variables - Simplified motor.cpp: deleted checkStall(), resetStallDetection() - Added frequent current logging (100ms) for data collection - Removed stall callback system from main.cpp - Simplified pingpong mode: time-based only, removed stall-return option - Updated webserver: removed stall warning UI, removed stallReturn checkbox - Updated status JSON: removed stalled and ppStallReturn fields This version is for testing with new beefy PSU to collect current data before designing new stall detection algorithm.
This commit is contained in:
@@ -58,15 +58,6 @@ const char index_html[] PROGMEM = R"rawliteral(
|
||||
font-size: 12px;
|
||||
color: #888;
|
||||
}
|
||||
.stall-warning {
|
||||
background: #ff5252;
|
||||
color: white;
|
||||
padding: 10px;
|
||||
border-radius: 5px;
|
||||
margin-bottom: 20px;
|
||||
display: none;
|
||||
}
|
||||
.stall-warning.active { display: block; }
|
||||
.slider-container {
|
||||
background: #16213e;
|
||||
padding: 20px;
|
||||
@@ -178,18 +169,14 @@ const char index_html[] PROGMEM = R"rawliteral(
|
||||
<div class="container">
|
||||
<h1>Motor Control</h1>
|
||||
|
||||
<div class="stall-warning" id="stallWarning">
|
||||
⚠️ STALL DETECTED - Motor Stopped
|
||||
</div>
|
||||
|
||||
<div class="current-display">
|
||||
<div>
|
||||
<div class="current-label">CURRENT (Active)</div>
|
||||
<div class="current-value"><span id="currentActive">0.00</span>A</div>
|
||||
<div class="current-label">CURRENT R</div>
|
||||
<div class="current-value"><span id="currentR">0.00</span>A</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="current-label">THRESHOLD</div>
|
||||
<div class="current-value" style="color:#ff9100;">4.0A</div>
|
||||
<div class="current-label">CURRENT L</div>
|
||||
<div class="current-value"><span id="currentL">0.00</span>A</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -239,12 +226,6 @@ const char index_html[] PROGMEM = R"rawliteral(
|
||||
<span class="value"><span id="ppTimeRandVal">0</span>%</span>
|
||||
</div>
|
||||
<input type="range" class="setting-slider" id="ppTimeRand" min="0" max="50" value="0">
|
||||
|
||||
<div class="setting-row" style="margin-top:15px;">
|
||||
<label for="ppStallReturn">Return on stall only</label>
|
||||
<input type="checkbox" id="ppStallReturn" style="width:25px;height:25px;">
|
||||
</div>
|
||||
<small style="color:#888;display:block;margin-top:5px;">When enabled, direction switches only after stall detection (time randomness disabled)</small>
|
||||
</div>
|
||||
|
||||
<div class="buttons">
|
||||
@@ -269,16 +250,6 @@ const char index_html[] PROGMEM = R"rawliteral(
|
||||
const ppSpeedRandVal = document.getElementById('ppSpeedRandVal');
|
||||
const ppTimeRandVal = document.getElementById('ppTimeRandVal');
|
||||
const ppStatus = document.getElementById('pingpongStatus');
|
||||
const ppStallReturn = document.getElementById('ppStallReturn');
|
||||
|
||||
// Disable time randomness when stall return is checked
|
||||
ppStallReturn.onchange = function() {
|
||||
ppTimeRand.disabled = this.checked;
|
||||
if (this.checked) {
|
||||
ppTimeRand.value = 0;
|
||||
ppTimeRandVal.textContent = '0';
|
||||
}
|
||||
};
|
||||
|
||||
slider.oninput = function() {
|
||||
speedVal.textContent = this.value;
|
||||
@@ -316,8 +287,7 @@ const char index_html[] PROGMEM = R"rawliteral(
|
||||
speed: ppSpeed.value,
|
||||
time: ppTime.value,
|
||||
speedRand: ppSpeedRand.value,
|
||||
timeRand: ppStallReturn.checked ? 0 : ppTimeRand.value,
|
||||
stallReturn: ppStallReturn.checked ? 1 : 0
|
||||
timeRand: ppTimeRand.value
|
||||
});
|
||||
fetch('/pingpong/start?' + params)
|
||||
.then(r => r.text())
|
||||
@@ -350,17 +320,8 @@ const char index_html[] PROGMEM = R"rawliteral(
|
||||
updateStatus();
|
||||
|
||||
// Update current display
|
||||
const active = data.direction > 0 ? data.currentR :
|
||||
data.direction < 0 ? data.currentL : 0;
|
||||
document.getElementById('currentActive').textContent = active.toFixed(2);
|
||||
|
||||
// Show/hide stall warning
|
||||
const stallWarning = document.getElementById('stallWarning');
|
||||
if (data.stalled) {
|
||||
stallWarning.classList.add('active');
|
||||
} else {
|
||||
stallWarning.classList.remove('active');
|
||||
}
|
||||
document.getElementById('currentR').textContent = data.currentR.toFixed(2);
|
||||
document.getElementById('currentL').textContent = data.currentL.toFixed(2);
|
||||
|
||||
// Update pingpong status
|
||||
if (data.pingpong) {
|
||||
@@ -376,8 +337,6 @@ const char index_html[] PROGMEM = R"rawliteral(
|
||||
ppSpeedRandVal.textContent = data.ppSpeedRand;
|
||||
ppTimeRand.value = data.ppTimeRand;
|
||||
ppTimeRandVal.textContent = data.ppTimeRand;
|
||||
ppStallReturn.checked = data.ppStallReturn;
|
||||
ppTimeRand.disabled = data.ppStallReturn;
|
||||
} else {
|
||||
ppStatus.textContent = 'INACTIVE';
|
||||
ppStatus.classList.remove('active');
|
||||
@@ -428,13 +387,11 @@ void handleStatus() {
|
||||
",\"direction\":" + String(motor.getDirection()) +
|
||||
",\"currentR\":" + String(motor.getCurrentRight(), 2) +
|
||||
",\"currentL\":" + String(motor.getCurrentLeft(), 2) +
|
||||
",\"stalled\":" + (motor.isStalled() ? "true" : "false") +
|
||||
",\"pingpong\":" + (motor.isPingpongActive() ? "true" : "false") +
|
||||
",\"ppSpeed\":" + String(motor.getPingpongSpeed()) +
|
||||
",\"ppTime\":" + String(motor.getPingpongTime()) +
|
||||
",\"ppSpeedRand\":" + String(motor.getPingpongSpeedRandom()) +
|
||||
",\"ppTimeRand\":" + String(motor.getPingpongTimeRandom()) +
|
||||
",\"ppStallReturn\":" + (motor.getPingpongStallReturn() ? "true" : "false") + "}";
|
||||
",\"ppTimeRand\":" + String(motor.getPingpongTimeRandom()) + "}";
|
||||
server.send(200, "application/json", json);
|
||||
}
|
||||
|
||||
@@ -443,7 +400,6 @@ void handlePingpongStart() {
|
||||
int time = 2000;
|
||||
int speedRand = 0;
|
||||
int timeRand = 0;
|
||||
bool stallReturn = false;
|
||||
|
||||
if (server.hasArg("speed")) {
|
||||
speed = server.arg("speed").toInt();
|
||||
@@ -457,11 +413,8 @@ void handlePingpongStart() {
|
||||
if (server.hasArg("timeRand")) {
|
||||
timeRand = server.arg("timeRand").toInt();
|
||||
}
|
||||
if (server.hasArg("stallReturn")) {
|
||||
stallReturn = server.arg("stallReturn").toInt() != 0;
|
||||
}
|
||||
|
||||
motor.startPingpong(speed, time, speedRand, timeRand, stallReturn);
|
||||
motor.startPingpong(speed, time, speedRand, timeRand);
|
||||
server.send(200, "text/plain", "OK");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user