Fix code style in Huawei files
This commit is contained in:
parent
c7ef661db7
commit
c86c5133f0
@ -89,7 +89,6 @@ private:
|
|||||||
MCP_CAN *CAN;
|
MCP_CAN *CAN;
|
||||||
uint8_t _huawei_irq;
|
uint8_t _huawei_irq;
|
||||||
uint8_t _huawei_power;
|
uint8_t _huawei_power;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern HuaweiCanClass HuaweiCan;
|
extern HuaweiCanClass HuaweiCan;
|
||||||
|
|||||||
@ -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)
|
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();
|
const CONFIG_T& config = Configuration.get();
|
||||||
|
|
||||||
if (!config.Huawei_Enabled) {
|
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...");
|
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);
|
pinMode(huawei_power, OUTPUT);
|
||||||
digitalWrite(huawei_power, HIGH);
|
digitalWrite(huawei_power, HIGH);
|
||||||
_huawei_power = huawei_power;
|
_huawei_power = huawei_power;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RectifierParameters_t * HuaweiCanClass::get()
|
RectifierParameters_t * HuaweiCanClass::get()
|
||||||
@ -60,7 +59,6 @@ uint8_t data[8] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
|||||||
void HuaweiCanClass::sendRequest()
|
void HuaweiCanClass::sendRequest()
|
||||||
{
|
{
|
||||||
if (previousMillis < millis()) {
|
if (previousMillis < millis()) {
|
||||||
|
|
||||||
// Send extended message
|
// Send extended message
|
||||||
byte sndStat = CAN->sendMsgBuf(0x108040FE, 1, 8, data);
|
byte sndStat = CAN->sendMsgBuf(0x108040FE, 1, 8, data);
|
||||||
if(sndStat == CAN_OK) {
|
if(sndStat == CAN_OK) {
|
||||||
@ -96,7 +94,8 @@ void HuaweiCanClass::onReceive(uint8_t* frame, uint8_t len)
|
|||||||
|
|
||||||
case R48xx_DATA_OUTPUT_POWER:
|
case R48xx_DATA_OUTPUT_POWER:
|
||||||
_rp.output_power = value / 1024.0;
|
_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;
|
break;
|
||||||
|
|
||||||
case R48xx_DATA_EFFICIENCY:
|
case R48xx_DATA_EFFICIENCY:
|
||||||
@ -159,8 +158,8 @@ void HuaweiCanClass::loop()
|
|||||||
return;
|
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)
|
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)
|
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) {
|
void HuaweiCanClass::setPower(bool power) {
|
||||||
digitalWrite(_huawei_power, !power);
|
digitalWrite(_huawei_power, !power);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user