Compare commits

...

3 Commits

@ -77,7 +77,6 @@ ATM90E26_IC eic;
ATM90E36 ic; ATM90E36 ic;
ATM90E36_IC eic(ctLine, ic); ATM90E36_IC eic(ctLine, ic);
ATM90E36_IC SetupEic(ctLine, ic);
#endif #endif
@ -156,6 +155,15 @@ hw_timer_t *readEICTimer = NULL;
void IRAM_ATTR ReadData(); void IRAM_ATTR ReadData();
// End timer variable and function // End timer variable and function
// LED pins
#define PIN_RED 23 // GPIO23
#define PIN_GREEN 22 // GPIO22
#define PIN_BLUE 21 // GPIO21
// LED color Function
void setColor(int R, int G, int B);
struct xformerMonConfigData { struct xformerMonConfigData {
char *wifiSsid; char *wifiSsid;
char *wifiPass; char *wifiPass;

@ -78,6 +78,23 @@ lib_deps =
milesburton/DallasTemperature@^3.11.0 milesburton/DallasTemperature@^3.11.0
build_src_filter = -<*> -<.git/> -<.svn/> +<tests/AT90E36.cpp> build_src_filter = -<*> -<.git/> -<.svn/> +<tests/AT90E36.cpp>
[env:TestTemps]
build_flags = -D DEV ${env.build_flags}
lib_deps =
SPI
knolleary/pubsubclient
https://github.com/CircuitSetup/ATM90E36
bblanchon/ArduinoJson @ ^6.21.3
paulstoffregen/OneWire@^2.3.8
milesburton/DallasTemperature@^3.11.0
build_src_filter = -<*> -<.git/> -<.svn/> +<tests/temps.cpp>
[env:TestSPI]
build_flags = -D DEV ${env.build_flags}
lib_deps =
SPI
build_src_filter = -<*> -<.git/> -<.svn/> +<tests/spi.cpp>
[env:TestEncryption] [env:TestEncryption]
build_flags = -D DEV ${env.build_flags} build_flags = -D DEV ${env.build_flags}
lib_deps = lib_deps =

@ -17,6 +17,13 @@ void setupEnergyMonitor();
// const char* test_client_cert = ""; //to verify the client // const char* test_client_cert = ""; //to verify the client
void setup() void setup()
{ {
pinMode(PIN_RED, OUTPUT);
pinMode(PIN_GREEN, OUTPUT);
pinMode(PIN_BLUE, OUTPUT);
// set LED to Red - FF0000
setColor(255, 0, 0);
delay(10000);
Serial.begin(9600); Serial.begin(9600);
eicDataQueue = xQueueCreate( 50, sizeof( xformerMonitorData ) ); eicDataQueue = xQueueCreate( 50, sizeof( xformerMonitorData ) );
@ -44,14 +51,18 @@ void setup()
// monitorTempSensors.oil.getAddress(oilTempSensorAddr, 0); // monitorTempSensors.oil.getAddress(oilTempSensorAddr, 0);
// monitorTempSensors.cabinet.getAddress(cabinetTempSensorAddr, 0); // monitorTempSensors.cabinet.getAddress(cabinetTempSensorAddr, 0);
setupMQTTClient(); setupMQTTClient();
setupEnergyMonitor(); setupEnergyMonitor();
// set LED color
setColor(0, 0, 255);
xTaskCreatePinnedToCore( xTaskCreatePinnedToCore(
readEICData, /* Function to implement the task */ readEICData, /* Function to implement the task */
"Read EIC data", /* Name of the task */ "Read EIC data", /* Name of the task */
10000, /* Stack size in words */ 100000, /* Stack size in words */
NULL, /* Task input parameter */ NULL, /* Task input parameter */
0, /* Priority of the task */ 0, /* Priority of the task */
&taskReadEIC, /* Task handle. */ &taskReadEIC, /* Task handle. */
@ -60,7 +71,7 @@ void setup()
xTaskCreatePinnedToCore( xTaskCreatePinnedToCore(
sendSensorDataOverMQTT, /* Function to implement the task */ sendSensorDataOverMQTT, /* Function to implement the task */
"Send sensor data over MQTT", /* Name of the task */ "Send sensor data over MQTT", /* Name of the task */
10000, /* Stack size in words */ 100000, /* Stack size in words */
NULL, /* Task input parameter */ NULL, /* Task input parameter */
0, /* Priority of the task */ 0, /* Priority of the task */
&taskSendData, /* Task handle. */ &taskSendData, /* Task handle. */
@ -119,10 +130,13 @@ void messageReceived(String &topic, String &payload)
void loop() void loop()
{ {
// publish a message roughly every second.
// // mqttClient.publish("xfmormermon", "buffer"); // // mqttClient.publish("xfmormermon", "buffer");
// // publish a message roughly every second. // // publish a message roughly every second.
// Serial.println("Sleeping 10s"); // Serial.println("Sleeping 10s");
// delay(10000); // delay(10000);
} }
@ -268,5 +282,11 @@ void IRAM_ATTR ReadData(){
// sensorData.energy.exp = // sensorData.energy.exp =
xQueueSend(eicDataQueue, &sensorData, portMAX_DELAY); xQueueSend(eicDataQueue, &sensorData, portMAX_DELAY);
}
void setColor(int R, int G, int B) {
analogWrite(PIN_RED, R);
analogWrite(PIN_GREEN, G);
analogWrite(PIN_BLUE, B);
Serial.println("hello from ISR"); Serial.println("hello from ISR");
} }
Loading…
Cancel
Save