Changeset 11 for trunk/Arduino/projects


Ignore:
Timestamp:
Jul 4, 2019, 12:00:03 AM (7 years ago)
Author:
markus
Message:

Redesign: OT_V2R2_Slave -> OT_Slave

Location:
trunk/Arduino/projects
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Arduino/projects/OT_boiler/OT_boiler.ino

    r10 r11  
    11#include <SPI.h>
    22#include <Ethernet.h>
    3 #include <ot_slave_2.h>
     3#include <OT_Slave.h>
    44
    55#define CONSOLE(cmd)  do { if (Serial) Serial.cmd; } while (0)
    66
    7 void  Sent_OT_Data (const OpenthermData& data);
     7void  Sent_OT_Data (const OT_Action& data);
    88
    99byte  mac[] = { 0x02, 0xDE, 0xAD, 0xDE, 0xAD, 0x01 };
    … …  
    1313volatile bool  _connected = false;
    1414
    15 OT_V2R2_Slave boiler(Sent_OT_Data);
     15OT_Slave boiler;
    1616
    1717EthernetClient client;
    … …  
    2020{
    2121  // Console
    22   // Serial.begin(9600);
    2322  Serial.begin(19200);
    24 /*
    25   while (!Serial) {
    26     ; // wait for serial port to connect. Needed for native USB port only
    27   }
    28 */
    29 //  if (Serial) Serial.println("\nSystem starting...");
    3023  CONSOLE(println("\nSystem starting..."));
    3124  // Setup OT
    3225  CONSOLE(print("OpenTherm.setup..."));
    33   boiler.Setup();
     26  boiler.begin(Sent_OT_Data);
    3427  CONSOLE(println("done"));
    3528  // Setup Ethernet
    … …  
    3831  CONSOLE(println("done"));
    3932  // Check for Ethernet hardware present
     33/*  Not needed anymore
    4034  if (Ethernet.hardwareStatus() == EthernetNoHardware) {
    4135    CONSOLE(println("Ethernet shield was not found.  Sorry, can't run without hardware. :("));
    … …  
    4337      delay(1); // do nothing, no point running without Ethernet hardware
    4438    }
    45   }
    46 /*
    47   if (Ethernet.linkStatus() == LinkOFF) {
    48     Serial.println("Ethernet cable is not connected.");
    4939  }
    5040*/
    … …  
    6252*/
    6353  maintainEthernet();
    64   boiler.Loop();
     54  boiler.maintain();
    6555/*
    6656  delay(1000);
    … …  
    10292}
    10393
    104 void    Sent_OT_Data (const OpenthermData& data)
     94void    Sent_OT_Data (const OT_Action& data)
    10595{
    10696  state = OPENTHERM::getMode();
    … …  
    111101    client.print(state,HEX);
    112102    client.print("]\t");
     103/*
    113104    client.print(data.type,HEX);
    114105    client.print(":");
    … …  
    118109    client.print(":");
    119110    client.print(data.valueLB,HEX);
     111*/
     112    uint32_t request = *((uint32_t *)&data.request);
     113    client.print(request,HEX);
     114    client.print("\t");
     115    uint32_t response = *((uint32_t *)&data.response);
     116    client.print(response,HEX);
    120117    client.println("");
    121118  }
  • trunk/Arduino/projects/OT_slave/OT_slave.ino

    r7 r11  
    11#include <opentherm.h>
    2 #include <ot_slave_2.h>
     2#include <OT_Slave.h>
    33
    4 OT_V2R2_Slave boiler;
     4OT_Slave boiler;
    55
    66void setup()
    77{
    8   boiler.Setup();
     8  boiler.begin();
    99  Serial.begin(19200);
    1010}
    … …  
    1212void loop()
    1313{
    14   boiler.Loop();
     14  boiler.maintain();
    1515}
Note: See TracChangeset for help on using the changeset viewer.