Skip to content

Commit

Permalink
the implementation has used HSPI with the default VSPI pins for a lon…
Browse files Browse the repository at this point in the history
…g time. Change VSPI and HSPI to use the right pins in order to avoid confusing
  • Loading branch information
MalteSchm committed Mar 26, 2023
1 parent d80f62d commit 06d5da5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/Huawei_can.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ 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)
{

hspi = new SPIClass(VSPI);
hspi = new SPIClass(HSPI);
hspi->begin(huawei_clk, huawei_miso, huawei_mosi, huawei_cs);
pinMode(huawei_cs, OUTPUT);
digitalWrite(huawei_cs, HIGH);
Expand Down Expand Up @@ -89,6 +89,7 @@ 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
break;

case R48xx_DATA_EFFICIENCY:
Expand Down Expand Up @@ -124,7 +125,7 @@ void HuaweiCanClass::onReceive(uint8_t* frame, uint8_t len)
_rp.output_current = value / 1024.0;

/* This is normally the last parameter received. Print */
lastUpdate = millis();
lastUpdate = millis(); // We'll only update last update on the important params

MessageOutput.printf("In: %.02fV, %.02fA, %.02fW\n", _rp.input_voltage, _rp.input_current, _rp.input_power);
MessageOutput.printf("Out: %.02fV, %.02fA of %.02fA, %.02fW\n", _rp.output_voltage, _rp.output_current, _rp.max_output_current, _rp.output_power);
Expand Down
2 changes: 1 addition & 1 deletion src/InverterSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ void InverterSettingsClass::init()
// Initialize inverter communication
MessageOutput.print(F("Initialize Hoymiles interface... "));
if (PinMapping.isValidNrf24Config()) {
SPIClass* spiClass = new SPIClass(HSPI);
SPIClass* spiClass = new SPIClass(VSPI);
spiClass->begin(pin.nrf24_clk, pin.nrf24_miso, pin.nrf24_mosi, pin.nrf24_cs);
Hoymiles.setMessageOutput(&MessageOutput);
Hoymiles.init(spiClass, pin.nrf24_en, pin.nrf24_irq);
Expand Down

0 comments on commit 06d5da5

Please sign in to comment.