ENC28j60 i arduino mega 2560

nikusv13
Posts: 13
Joined: Fri Apr 14, 2023 7:51 pm

Post

Dobry wieczór, szukam pomocy związanej z uruchomieniem modułu ENC28j60 i mega 2560. Mam problem z kompilacją choćby przykładu rolet, czy może ktoś podpowiedzieć co robię nie tak ?
kod błędu:

Code: Select all

In file included from C:\Users\hp\AppData\Local\Temp\.arduinoIDE-unsaved2023314-24328-1ma63t7.luetj\RollerShutter\RollerShutter.ino:39:0:
c:\Users\hp\Documents\Arduino\libraries\SuplaDevice\src/supla/network/ENC28J60.h: In constructor 'Supla::ENC28J60::ENC28J60(uint8_t*, IPAddress*)':
c:\Users\hp\Documents\Arduino\libraries\SuplaDevice\src/supla/network/ENC28J60.h:35:71: error: no matching function for call to 'Supla::Network::Network(IPAddress*&)'
   explicit ENC28J60(uint8_t mac[6], IPAddress *ip = NULL) : Network(ip) {
                                                                       ^
In file included from c:\Users\hp\Documents\Arduino\libraries\SuplaDevice\src/SuplaDevice.h:21:0,
                 from C:\Users\hp\AppData\Local\Temp\.arduinoIDE-unsaved2023314-24328-1ma63t7.luetj\RollerShutter\RollerShutter.ino:17:
c:\Users\hp\Documents\Arduino\libraries\SuplaDevice\src/supla/network/network.h:49:12: note: candidate: Supla::Network::Network(uint8_t*)
   explicit Network(uint8_t ip[4]);
            ^~~~~~~
c:\Users\hp\Documents\Arduino\libraries\SuplaDevice\src/supla/network/network.h:49:12: note:   no known conversion for argument 1 from 'IPAddress*' to 'uint8_t* {aka unsigned char*}'
c:\Users\hp\Documents\Arduino\libraries\SuplaDevice\src/supla/network/network.h:30:7: note: candidate: constexpr Supla::Network::Network(const Supla::Network&)
 class Network {
       ^~~~~~~
c:\Users\hp\Documents\Arduino\libraries\SuplaDevice\src/supla/network/network.h:30:7: note:   no known conversion for argument 1 from 'IPAddress*' to 'const Supla::Network&'

exit status 1

Compilation error: exit status 1
Przykład:

Code: Select all

/*
  Copyright (C) AC SOFTWARE SP. Z O.O.
  
  This program is free software; you can redistribute it and/or
  modify it under the terms of the GNU General Public License
  as published by the Free Software Foundation; either version 2
  of the License, or (at your option) any later version.
  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.
  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*/

#include <SuplaDevice.h>
#include <supla/control/roller_shutter.h>
#include <supla/control/button.h>
#include <supla/control/pin_status_led.h>

// Choose where Supla should store roller shutter data in persistant memory
// We recommend to use external FRAM memory 
#define STORAGE_OFFSET 100
#include <supla/storage/eeprom.h>
Supla::Eeprom eeprom(STORAGE_OFFSET);
// #include <supla/storage/fram_spi.h>
// Supla::FramSpi fram(STORAGE_OFFSET);

// Choose proper network interface for your card:
#ifdef ARDUINO_ARCH_AVR
  // Arduino Mega with EthernetShield W5100:
  //#include <supla/network/ethernet_shield.h>
  // Ethernet MAC address
  uint8_t mac[6] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05};
  //Supla::EthernetShield ethernet(mac);

  // Arduino Mega with ENC28J60:
   #include <supla/network/ENC28J60.h>
   Supla::ENC28J60 ethernet(mac);
#elif defined(ARDUINO_ARCH_ESP8266) || defined(ARDUINO_ARCH_ESP32)
  // ESP8266 and ESP32 based board:
  #include <supla/network/esp_wifi.h>
  Supla::ESPWifi wifi("your_wifi_ssid", "your_wifi_password");
#endif

void setup() {

  Serial.begin(115200);

  // Replace the falowing GUID with value that you can retrieve from https://www.supla.org/arduino/get-guid
  char GUID[SUPLA_GUID_SIZE] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};

  // Replace the following AUTHKEY with value that you can retrieve from: https://www.supla.org/arduino/get-authkey
  char AUTHKEY[SUPLA_AUTHKEY_SIZE] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
 
  /*
   * Having your device already registered at cloud.supla.org,
   * you want to change CHANNEL sequence or remove any of them,
   * then you must also remove the device itself from cloud.supla.org.
   * Otherwise you will get "Channel conflict!" error.
   */
    
  Supla::Control::RollerShutter *rs = new Supla::Control::RollerShutter(30, 31, false);
  Supla::Control::Button *buttonOpen = new Supla::Control::Button(28, true, true);
  Supla::Control::Button *buttonClose = new Supla::Control::Button(29, true, true);

  // Add two LEDs to inform about roller shutter relay status
  // If inverted value is required, please add third parameter with true value
  new Supla::Control::PinStatusLed(30, 24); // pin 30 status to be informed on pin 24
  new Supla::Control::PinStatusLed(31, 25); // pin 31 status to be informed on pin 25
  

  buttonOpen->addAction(Supla::OPEN_OR_STOP, *rs, Supla::ON_PRESS);
  buttonClose->addAction(Supla::CLOSE_OR_STOP, *rs, Supla::ON_PRESS);
 
  /*
   * SuplaDevice Initialization.
   * Server address is available at https://cloud.supla.org 
   * If you do not have an account, you can create it at https://cloud.supla.org/account/create
   * SUPLA and SUPLA CLOUD are free of charge
   * 
   */
 
  SuplaDevice.begin(GUID,              // Global Unique Identifier 
                    "svr1.supla.org",  // SUPLA server address
                    "email@address",   // Email address used to login to Supla Cloud
                    AUTHKEY);          // Authorization key
    
}

void loop() {
  SuplaDevice.iterate();
}
User avatar
SOYER
Posts: 1623
Joined: Wed Aug 10, 2022 12:29 pm
Location: Kryry
Been thanked: 2 times

Post

Na początek przyglądnij się jakie biblioteki dołączasz, a jakie nie bo masz je zakomentowane(//).
https://youtube.com/@tomaszhamer8134?si=_J1cT_QWsXxgt1Fm
https://kryry01.aqi.eco/pl
https://app.weathercloud.net/d4311785603
https://github.com/Soyer79
nikusv13
Posts: 13
Joined: Fri Apr 14, 2023 7:51 pm

Post

SOYER wrote: Sat Apr 15, 2023 5:54 am Na początek przyglądnij się jakie biblioteki dołączasz, a jakie nie bo masz je zakomentowane(//).
Wydaje mi się że dobrze są skonfigurowane
#include <supla/network/ENC28J60.h>
Supla::ENC28J60 ethernet(mac);
User avatar
SOYER
Posts: 1623
Joined: Wed Aug 10, 2022 12:29 pm
Location: Kryry
Been thanked: 2 times

Post

W jaki sposób MEGA łączy się z siecią? Pokaż mi też linijki w kodzie które za to odpowiadają.
https://youtube.com/@tomaszhamer8134?si=_J1cT_QWsXxgt1Fm
https://kryry01.aqi.eco/pl
https://app.weathercloud.net/d4311785603
https://github.com/Soyer79
nikusv13
Posts: 13
Joined: Fri Apr 14, 2023 7:51 pm

Post

SOYER wrote: Sat Apr 15, 2023 10:33 am W jaki sposób MEGA łączy się z siecią? Pokaż mi też linijki w kodzie które za to odpowiadają.
Wydaje mi się że mega łączy się za pomocą biblioteki UIPEthernet.h
Ten kod który wkleiłem to jest gotowy przykład z biblioteki SuplaDevice. Każda próba kompilacji z odkomentowanymi #include <supla/network/ENC28J60.h>
Supla::ENC28J60 ethernet(mac); kończy się błędem
User avatar
klew
Posts: 13908
Joined: Thu Jun 27, 2019 12:16 pm
Location: Wrocław
Has thanked: 134 times
Been thanked: 137 times

Post

Przy okazji widać, jak często ten sprzęt jest używany ;).

Wrzuciłem na https://github.com/SUPLA/supla-device (branch main) poprawki na błędy kompilacji. Zmieniłem też bibliotekę do obsługi tego interfejsu sieciowego na "EthernetENC" (trzeba ją samemu doinstalować w Arduino).

SuplaDevice z tą zmianą nie jest jeszcze opublikowana do Arduino, więc musisz ręcznie pobrać najnowszą wersję z github i wgrać ją do folderu z bibliotekami w Arduino.
Najlepsze suple dla Twojego domu :mrgreen:
User avatar
klew
Posts: 13908
Joined: Thu Jun 27, 2019 12:16 pm
Location: Wrocław
Has thanked: 134 times
Been thanked: 137 times

Post

Dodam jeszcze, że biblioteki do ENC zjadają dodatkowe 500 B pamięci RAM, co może powodować problemy z odpaleniem Supli. Ogólnie nawet z tymi dodatkowymi 500 B RAM-u na Ethernet Shield (W5100) było ciasno, gdy chciało się dodać więcej rolet i przycisków, ale możesz poeksperymentować. Tylko zacznij od np. 1 rolety i sprawdź czy działa, zanim dodasz kolejne.
Najlepsze suple dla Twojego domu :mrgreen:
User avatar
SOYER
Posts: 1623
Joined: Wed Aug 10, 2022 12:29 pm
Location: Kryry
Been thanked: 2 times

Post

klew wrote: Mon Apr 17, 2023 10:17 am Przy okazji widać, jak często ten sprzęt jest używany ;).

Wrzuciłem na https://github.com/SUPLA/supla-device (branch main) poprawki na błędy kompilacji. Zmieniłem też bibliotekę do obsługi tego interfejsu sieciowego na "EthernetENC" (trzeba ją samemu doinstalować w Arduino).

SuplaDevice z tą zmianą nie jest jeszcze opublikowana do Arduino, więc musisz ręcznie pobrać najnowszą wersję z github i wgrać ją do folderu z bibliotekami w Arduino.
Racja, nawet nie byłem świadom, że jest taki shield do neta😁
https://youtube.com/@tomaszhamer8134?si=_J1cT_QWsXxgt1Fm
https://kryry01.aqi.eco/pl
https://app.weathercloud.net/d4311785603
https://github.com/Soyer79
nikusv13
Posts: 13
Joined: Fri Apr 14, 2023 7:51 pm

Post

klew wrote: Mon Apr 17, 2023 10:19 am Dodam jeszcze, że biblioteki do ENC zjadają dodatkowe 500 B pamięci RAM, co może powodować problemy z odpaleniem Supli. Ogólnie nawet z tymi dodatkowymi 500 B RAM-u na Ethernet Shield (W5100) było ciasno, gdy chciało się dodać więcej rolet i przycisków, ale możesz poeksperymentować. Tylko zacznij od np. 1 rolety i sprawdź czy działa, zanim dodasz kolejne.
Cześć, dziękuję za pomoc, moduł i megę miałem a niestety esp32 mi wyszły więc postanowiłem z nich skorzystać. Po zmianie biblioteki kompiluje się normalnie ale nie łączy się z serwerem. Myślę że jednak szkoda zachodu z tym zestawem.
You do not have the required permissions to view the files attached to this post.

Return to “Pomoc”