[bug] 去掉锁定状态日志,加入是否有货物日志

This commit is contained in:
xu 2025-05-14 20:34:00 +08:00
parent fb94645d9f
commit 7767ddd84e
4 changed files with 64 additions and 5 deletions

View File

@ -14,12 +14,10 @@ board = esp32doit-devkit-v1
framework = arduino
build_flags = -DCORE_DEBUG_LEVEL=4
monitor_speed = 57600
;upload_port = COM[14]
lib_deps =
bogde/HX711@^0.7.5
mathertel/OneButton@^2.0.3
robtillaart/CRC@^0.3.3
sandeepmistry/CAN@^0.3.1
fastled/FastLED@^3.5.0
madhephaestus/ESP32Servo@^0.13.0
sandeepmistry/CAN@^0.3.1

36
src/can_control.cpp Normal file
View File

@ -0,0 +1,36 @@
#include "can_control.h"
#include "Arduino.h"
#include "config.h"
static const char* MOUDLENAME = "CAN_C";
can_control::can_control()
{
}
bool can_control::init()
{
return true;
}
can_control::~can_control()
{
}
void can_control::update()
{
}
void can_control::send_data(int16_t iq1,byte *candata)
{
}
void can_control::onReceive(int packetSize)
{
}

18
src/can_control.h Normal file
View File

@ -0,0 +1,18 @@
#pragma once
#include <Arduino.h>
//#include <CAN.h>
//#include <ESP32SJA1000.h>
class can_control
{
private:
static void onReceive(int packetSize);
public:
can_control(); // 构造函数
~can_control(); // 析构函数
bool init();
void update();
void send_data(int16_t iq1,byte* candata);
};

View File

@ -106,8 +106,7 @@ void Motocontrol::checkgoods() // 检测是否超重
// 到顶部锁定状态,有向上的压力,重量不准,不能检测
if (_controlstatus.is_toplocked)
{
addLogMessage("is_toplocked");
return;
return;
}
// 检查是否超重
@ -132,11 +131,19 @@ void Motocontrol::checkgoods() // 检测是否超重
if (_notweightcount > 40)
{
// printf("goods weight<min 40 times :%d \n", _pullweight);
if (_controlstatus.is_havegoods)
{
addLogMessage("goods no: " + String(_pullweight));
}
_controlstatus.is_havegoods = false;
}
}
else
{
if (!_controlstatus.is_havegoods)
{
addLogMessage("goods ok: " + String(_pullweight));
}
_controlstatus.is_havegoods = true;
_notweightcount = 0;
}