Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "New feature: Double LilyGo!" #106

Merged
merged 1 commit into from
Nov 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,7 @@ This video explains all the above mentioned steps:
https://youtu.be/_mH2AjnAjDk

## Dependencies 📖
This code uses the following libraries, already located in the lib folder for an easy start:
- ESP32-Arduino-CAN (https://github.com/miwagner/ESP32-Arduino-CAN/) slightly modified for this usecase
- eModbus library (https://github.com/eModbus/eModbus)
- Adafruit Neopixel (https://github.com/adafruit/Adafruit_NeoPixel)
- mackelec SerialDataLink (https://github.com/mackelec/SerialDataLink)
- pierremolinaro acan2515 (https://github.com/pierremolinaro/acan2515)
This code uses two libraries, ESP32-Arduino-CAN (https://github.com/miwagner/ESP32-Arduino-CAN/) slightly modified for this usecase, and the eModbus library (https://github.com/eModbus/eModbus). Both these are already located in the Software folder for an easy start.

It is also based on the info found in the following excellent repositories/websites:
- https://gitlab.com/pelle8/gen24
Expand Down
36 changes: 0 additions & 36 deletions Software/Software.ino
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,12 @@
#include "src/lib/eModbus-eModbus/Logging.h"
#include "src/lib/eModbus-eModbus/ModbusServerRTU.h"
#include "src/lib/eModbus-eModbus/scripts/mbServerFCs.h"
#include "src/lib/mackelec-SerialDataLink/SerialDataLink.h"
#include "src/lib/miwagner-ESP32-Arduino-CAN/CAN_config.h"
#include "src/lib/miwagner-ESP32-Arduino-CAN/ESP32CAN.h"

// Interval settings
int intervalUpdateValues = 4800; // Interval at which to update inverter values / Modbus registers
const int interval1 = 1; // Interval for 1ms tasks
const int interval10 = 10; // Interval for 10ms tasks
unsigned long previousMillis1ms = 0;
unsigned long previousMillis10ms = 50;
unsigned long previousMillisUpdateVal = 0;

Expand Down Expand Up @@ -131,9 +128,6 @@ void loop() {
#ifdef DUAL_CAN
receive_can2();
#endif
#ifdef SERIAL_LINK_TRANSMITTER_INVERTER
receive_serial();
#endif

// Process
if (millis() - previousMillis10ms >= interval10) // Every 10ms
Expand All @@ -156,9 +150,6 @@ void loop() {
#ifdef DUAL_CAN
send_can2();
#endif
#ifdef SERIAL_LINK_RECEIVER_FROM_BATTERY
send_serial();
#endif
}

// Initialization functions
Expand Down Expand Up @@ -226,13 +217,6 @@ void init_modbus() {
pinMode(PIN_5V_EN, OUTPUT);
digitalWrite(PIN_5V_EN, HIGH);

#if defined(SERIAL_LINK_RECEIVER_FROM_BATTERY) || defined(SERIAL_LINK_TRANSMITTER_INVERTER)
Serial2.begin(9600); // If the Modbus RTU port will be used for serial link
#if defined(BYD_MODBUS) || defined(LUNA2000_MODBUS)
#error Modbus pins cannot be used for Serial and Modbus at the same time!
#endif
#endif

#ifdef BYD_MODBUS
// Init Static data to the RTU Modbus
handle_static_data_modbus_byd();
Expand Down Expand Up @@ -402,26 +386,6 @@ void send_can() {
#endif
}

#ifdef SERIAL_LINK_RECEIVER_FROM_BATTERY
void send_serial() {
static unsigned long currentMillis = millis();
if (currentMillis - previousMillis1ms >= interval1) {
previousMillis1ms = currentMillis;
manageSerialLinkReceiver();
}
}
#endif

#ifdef SERIAL_LINK_TRANSMITTER_INVERTER
void receive_serial() {
static unsigned long currentMillis = millis();
if (currentMillis - previousMillis1ms >= interval1) {
previousMillis1ms = currentMillis;
manageSerialLinkTransmitter();
}
}
#endif

#ifdef DUAL_CAN
void receive_can2() { // This function is similar to receive_can, but just takes care of inverters in the 2nd bus.
// Depending on which inverter is selected, we forward this to their respective CAN routines
Expand Down
2 changes: 0 additions & 2 deletions Software/USER_SETTINGS.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,5 @@
//#define CONTACTOR_CONTROL //Enable this line to have pins 25,32,33 handle automatic precharge/contactor+/contactor- closing sequence
//#define PWM_CONTACTOR_CONTROL //Enable this line to use PWM logic for contactors, which lower power consumption and heat generation
//#define DUAL_CAN //Enable this line to activate an isolated secondary CAN Bus using add-on MCP2515 controller (Needed for FoxESS inverters)
//#define SERIAL_LINK_RECEIVER_FROM_BATTERY //Enable this line to send battery data over Modbus pins to another Lilygo (This LilyGo interfaces with battery)
//#define SERIAL_LINK_TRANSMITTER_INVERTER //Enable this line to receive battery data over Modbus pins from another Lilygo (This LilyGo interfaces with inverter)

#endif
5 changes: 0 additions & 5 deletions Software/src/battery/BATTERIES.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,4 @@
#ifdef TEST_FAKE_BATTERY
#include "TEST-FAKE-BATTERY.h" //See this file for more Fake battery settings
#endif

#ifdef SERIAL_LINK_RECEIVER_FROM_BATTERY
#include "SERIAL-LINK-RECEIVER-FROM-BATTERY.h"
#endif

#endif
115 changes: 0 additions & 115 deletions Software/src/battery/SERIAL-LINK-RECEIVER-FROM-BATTERY.cpp

This file was deleted.

38 changes: 0 additions & 38 deletions Software/src/battery/SERIAL-LINK-RECEIVER-FROM-BATTERY.h

This file was deleted.

4 changes: 0 additions & 4 deletions Software/src/inverter/INVERTERS.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,4 @@
#include "SOLAX-CAN.h"
#endif

#ifdef SERIAL_LINK_TRANSMITTER_INVERTER
#include "SERIAL-LINK-TRANSMITTER-INVERTER.h"
#endif

#endif
85 changes: 0 additions & 85 deletions Software/src/inverter/SERIAL-LINK-TRANSMITTER-INVERTER.cpp

This file was deleted.

32 changes: 0 additions & 32 deletions Software/src/inverter/SERIAL-LINK-TRANSMITTER-INVERTER.h

This file was deleted.

Loading