로드 부하 추가
This commit is contained in:
@@ -2960,6 +2960,27 @@ void webUpdateTask(void *parameter) {
|
||||
doc["sdReady"] = sdCardReady;
|
||||
doc["totalMsg"] = totalMsgCount;
|
||||
doc["msgPerSec"] = msgPerSecond;
|
||||
|
||||
// 🆕 CAN 버스 부하율 계산
|
||||
// CAN 속도별 이론적 최대 메시지/초 (8바이트 데이터 기준)
|
||||
// 125 Kbps: ~1,000 msg/s
|
||||
// 250 Kbps: ~2,000 msg/s
|
||||
// 500 Kbps: ~4,000 msg/s
|
||||
// 1 Mbps: ~8,000 msg/s
|
||||
uint32_t maxMsgPerSec;
|
||||
switch(currentCanSpeed) {
|
||||
case CAN_125KBPS: maxMsgPerSec = 1000; break;
|
||||
case CAN_250KBPS: maxMsgPerSec = 2000; break;
|
||||
case CAN_500KBPS: maxMsgPerSec = 4000; break;
|
||||
case CAN_1000KBPS:
|
||||
default: maxMsgPerSec = 8000; break;
|
||||
}
|
||||
|
||||
// 부하율 계산 (0~100%)
|
||||
float busLoad = (msgPerSecond * 100.0) / maxMsgPerSec;
|
||||
if (busLoad > 100.0) busLoad = 100.0;
|
||||
doc["busLoad"] = (int)busLoad; // 정수로 전송
|
||||
|
||||
doc["totalTx"] = totalTxCount;
|
||||
doc["totalSerialRx"] = totalSerialRxCount;
|
||||
doc["totalSerialTx"] = totalSerialTxCount;
|
||||
|
||||
Reference in New Issue
Block a user