Fix code style in Huawei files

This commit is contained in:
Bernhard Kaszt 2023-04-02 10:42:36 +02:00
parent c7ef661db7
commit c86c5133f0
3 changed files with 41 additions and 45 deletions

View File

@ -89,7 +89,6 @@ private:
MCP_CAN *CAN;
uint8_t _huawei_irq;
uint8_t _huawei_power;
};
extern HuaweiCanClass HuaweiCan;

View File

@ -14,7 +14,6 @@ HuaweiCanClass HuaweiCan;
void HuaweiCanClass::init(uint8_t huawei_miso, uint8_t huawei_mosi, uint8_t huawei_clk, uint8_t huawei_irq, uint8_t huawei_cs, uint8_t huawei_power)
{
const CONFIG_T& config = Configuration.get();
if (!config.Huawei_Enabled) {
@ -37,12 +36,12 @@ void HuaweiCanClass::init(uint8_t huawei_miso, uint8_t huawei_mosi, uint8_t huaw
MessageOutput.println("Error Initializing MCP2515...");
}
CAN->setMode(MCP_NORMAL); // Change to normal mode to allow messages to be transmitted
// Change to normal mode to allow messages to be transmitted
CAN->setMode(MCP_NORMAL);
pinMode(huawei_power, OUTPUT);
digitalWrite(huawei_power, HIGH);
_huawei_power = huawei_power;
}
RectifierParameters_t * HuaweiCanClass::get()
@ -60,7 +59,6 @@ uint8_t data[8] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
void HuaweiCanClass::sendRequest()
{
if (previousMillis < millis()) {
// Send extended message
byte sndStat = CAN->sendMsgBuf(0x108040FE, 1, 8, data);
if(sndStat == CAN_OK) {
@ -96,7 +94,8 @@ void HuaweiCanClass::onReceive(uint8_t* frame, uint8_t len)
case R48xx_DATA_OUTPUT_POWER:
_rp.output_power = value / 1024.0;
lastUpdate = millis(); // We'll only update last update on the important params
// We'll only update last update on the important params
lastUpdate = millis();
break;
case R48xx_DATA_EFFICIENCY:
@ -159,8 +158,8 @@ void HuaweiCanClass::loop()
return;
}
if(!digitalRead(_huawei_irq)) // If CAN_INT pin is low, read receive buffer
{
if (!digitalRead(_huawei_irq)) {
// If CAN_INT pin is low, read receive buffer
CAN->readMsgBuf(&rxId, &len, rxBuf); // Read data: len = data length, buf = data byte(s)
if((rxId & 0x80000000) == 0x80000000) { // Determine if ID is standard (11 bits) or extended (29 bits)
@ -201,5 +200,3 @@ void HuaweiCanClass::setValue(float in, uint8_t parameterType)
void HuaweiCanClass::setPower(bool power) {
digitalWrite(_huawei_power, !power);
}