Arduino Mega i pamięć FRAM

Maniek913
Posts: 593
Joined: Thu Feb 22, 2018 9:46 pm

Post

Maniek913 wrote: Thu Sep 10, 2020 6:19 am Super, jesteś Wielki :D
Zrobiłem jak pisałeś i działa płynnie 15 rolet z 30 przyciskami. Męczę ten układ na wszystkie sposoby i nie zauważyłem jak na razie problemów.
Nareszcie powstał jakiś działający układ zcentralizowanego sterowania bez WiFi - tego brakowało w supli. Układ naprawdę działa szybko - od startu do gotowości do sterowania mija max 6s - nie do pomyślenia przy połączeniu przez WiFi. Responsywność też zaskakuje. Może wieczorem nagram filmik jak to śmiga, bo naprawdę na tle wcześniejszych rozwiązań jestem mega zadowolony.

Pozostał problem z grupą kanałów - od strony cloud - pomimo zwiększonego limitu kanałów w grupie i stworzeniu grupy 15 kanałów uruchomiają się tylko pierwsze 10. Pisałem w tej sprawie swojego czasu do Zygmunta., ale to ma mniejsze znaczenie dopóki (głównie w przypadku grupy rolet), nie ma możliwości zwłoki w uruchamianiu kolejnych rolet w grupie - żaden "normalny" bezpiecznik nie wytrzyma prądu rozruchowego z 15 rolet :lol: , zwłaszcza że teraz tak jak wcześniej zaznaczyłem wszystko się dzieje błyskawicznie.
Jeszcze raz szacun za twój wkład pracy.
Witam ponownie, usiłuję skompilować powtórnie w/w soft na najnowszych źródłach, ale nie mogę sobie poradzić - w przykładach nie ma RollerShutter_FRAM ,a przepisując przykład RollerShutter wg mojej mizernej wiedzy :? soft się kompiluje, ale nie wykrywa pamięci FRAM,( swoją drogą gdzie są zdefiniowane piny do których podłączamy pamięć ? - w poprzedniej wersji definiowałem jedynie pin CS)i nie łączy się z serwerem supli. Na poprzedniej bibliotece i szkicu płytka oczywiście działa - Najlepiej jakby znowu pojawił się przykład z użyciem pamięci FRAM w bibliotece - Czy obecna wersja już tego nie wspiera?

Logi:

Code: Select all

20:21:41.673 -> Supla - starting initialization
20:21:41.720 -> Unexpected Manufacturer ID: 0xFF
20:21:41.720 -> Storage: FRAM not found
20:21:41.720 -> Storage initialization
20:21:41.774 -> readStorage: 8; Read: [FF FF FF FF FF FF FF FF ]
20:21:41.821 -> Storage: missing Supla tag. Rewriting...
20:21:41.874 -> Wrote 8 bytes to storage at 0
20:21:41.921 -> Validating storage state section with current device configuration
20:21:41.974 -> Element state section size doesn't match current device configuration
20:21:42.021 -> Initializing network layer
20:21:42.074 -> Connecting to network...
20:21:43.225 -> DHCP connection result: 1
20:21:43.225 -> localIP: 192.168.1.131
20:21:43.225 -> subnetMask: 255.255.255.0
20:21:43.278 -> gatewayIP: 192.168.1.1
20:21:43.325 -> dnsServerIP: 91.192.144.15
20:21:43.325 -> Using Supla protocol version 12
20:21:43.378 -> Current status: [7] SuplaDevice initialized
20:21:43.425 -> Initialization of elementStateOffset: 8
20:21:43.425 -> Update Storage preamble
20:21:43.478 -> Wrote 8 bytes to storage at 0
20:21:43.525 -> Wrote 9 bytes to storage at 15
20:21:43.525 -> Wrote 9 bytes to storage at 24
20:21:43.579 -> Wrote 9 bytes to storage at 33
20:21:43.626 -> Wrote 9 bytes to storage at 42
20:21:43.626 -> Wrote 7 bytes to storage at 8
20:21:43.679 -> Current status: [9] Not connected to Supla server
20:21:43.726 -> Establishing connection with: svr9.supla.org (port: 2015)
20:21:43.779 -> Connected to Supla Server
20:21:43.826 -> Current status: [10] Register in progress
20:21:43.880 -> Sending: [53 55 50 4C 41 C 1 0 0 0 45 0 0 0 AC 2 0 0 64 61 6D 69 61 6E 32 30 33 40 30 32 2E 70 6C 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0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0 0 0 1 0 0 0 0 0 0 0 0 0 3 54 B 0 0 10 0 0 0 6E 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 ]
20:21:45.484 -> Sending: [53 55 50 4C 41 ]
20:21:45.484 -> Wrote 9 bytes to storage at 15
20:21:45.531 -> Wrote 9 bytes to storage at 24
20:21:45.585 -> Wrote 9 bytes to storage at 33
20:21:45.585 -> Wrote 9 bytes to storage at 42
20:21:45.631 -> Wrote 7 bytes to storage at 8
20:21:46.434 -> Wrote 9 bytes to storage at 15
20:21:46.487 -> Wrote 9 bytes to storage at 24
20:21:46.534 -> Wrote 9 bytes to storage at 33
20:21:46.534 -> Wrote 9 bytes to storage at 42
20:21:46.587 -> Wrote 7 bytes to storage at 8
20:21:47.437 -> Received: [53 55 50 4C 41 C 1 0 0 0 46 0 0 0 7 0 0 0 5 0 0 0 78 D 1 53 55 50 4C 41 ]
20:21:47.537 -> Current status: [13] Bad credentials!
20:21:47.537 -> Wrote 9 bytes to storage at 15
20:21:47.590 -> Wrote 9 bytes to storage at 24
20:21:47.637 -> Wrote 9 bytes to storage at 33
20:21:47.637 -> Wrote 9 bytes to storage at 42
20:21:47.690 -> Wrote 7 bytes to storage at 8
20:21:48.540 -> Wrote 9 bytes to storage at 15
20:21:48.593 -> Wrote 9 bytes to storage at 24
20:21:48.593 -> Wrote 9 bytes to storage at 33
20:21:48.640 -> Wrote 9 bytes to storage at 42
20:21:48.693 -> Wrote 7 bytes to storage at 8
20:21:49.544 -> Wrote 9 bytes to storage at 15
20:21:49.579 -> Wrote 9 bytes to storage at 24
20:21:49.626 -> Wrote 9 bytes to storage at 33
20:21:49.626 -> Wrote 9 bytes to storage at 42
20:21:49.675 -> Wrote 7 bytes to storage at 8
20:21:50.545 -> Wrote 9 bytes to storage at 15
20:21:50.599 -> Wrote 9 bytes to storage at 24
20:21:50.646 -> Wrote 9 bytes to storage at 33
20:21:50.646 -> Wrote 9 bytes to storage at 42
20:21:50.699 -> Wrote 7 bytes to storage at 8
20:21:51.548 -> Wrote 9 bytes to storage at 15
20:21:51.602 -> Wrote 9 bytes to storage at 24
20:21:51.648 -> Wrote 9 bytes to storage at 33
20:21:51.648 -> Wrote 9 bytes to storage at 42
20:21:51.702 -> Wrote 7 bytes to storage at 8
20:21:52.551 -> Current status: [9] Not connected to Supla server
20:21:52.604 -> Establishing connection with: svr9.supla.org (port: 2015)
20:21:52.651 -> Connected to Supla Server
20:21:52.705 -> Current status: [10] Register in progress
20:21:52.752 -> Sending: [53 55 50 4C 41 C 2 0 0 0 45 0 0 0 AC 2 0 0 64 61 6D 69 61 6E 32 30 33 40 30 32 2E 70 6C 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 44 C8 4E A2 2D 58 BE 25 4 35 1D 58 D9 FE E6 9B 10 2C C6 BF 41 A3 F2 F0 FD 59 23 E5 66 D5 B7 FC 41 52 44 55 49 4E 4F 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 55 73 65 72 20 53 57 2C 20 6C 69 62 20 32 2E 33 2E 32 0 0 0 73 76 72 39 2E 73 75 70 6C 61 2E 6F 72 67 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 0 54 B 0 0 10 0 0 0 6E 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 54 B 0 0 10 0 0 0 6E 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 2 54 B 0 0 10 0 0 0 6E 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 3 54 B 0 0 10 0 0 0 6E 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 ]
20:21:54.356 -> Sending: [53 55 50 4C 41 ]
20:21:54.356 -> Wrote 9 bytes to storage at 15
20:21:54.410 -> Wrote 9 bytes to storage at 24
20:21:54.456 -> Wrote 9 bytes to storage at 33
20:21:54.510 -> Wrote 9 bytes to storage at 42
20:21:54.510 -> Wrote 7 bytes to storage at 8
20:21:55.312 -> Wrote 9 bytes to storage at 15
20:21:55.359 -> Wrote 9 bytes to storage at 24
20:21:55.412 -> Wrote 9 bytes to storage at 33
20:21:55.412 -> Wrote 9 bytes to storage at 42
20:21:55.459 -> Wrote 7 bytes to storage at 8
20:21:56.315 -> Received: [53 55 50 4C 41 C 1 0 0 0 46 0 0 0 7 0 0 0 5 0 0 0 78 D 1 53 55 50 4C 41 ]
20:21:56.415 -> Current status: [13] Bad credentials!
Szkic:

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 <SPI.h>
#include <SuplaDevice.h>
#include <supla/control/roller_shutter.h>
#include <supla/control/button.h>

// Choose where Supla should store roller shutter data in persistant memory
// We recommend to use external FRAM memory 
#define STORAGE_OFFSET 0
#define FRAM_CS 53    // pin for FRAM CS
//#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:
// Arduino Mega with EthernetShield W5100:
#include <supla/network/ethernet_shield.h>
// Ethernet MAC address
uint8_t mac[6] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x06};
Supla::EthernetShield ethernet(mac);
//
// Arduino Mega with ENC28J60:
// #include <supla/network/ENC28J60.h>
// Supla::ENC28J60 ethernet(mac);
//
// ESP8266 based board:
// #include <supla/network/esp_wifi.h>
// Supla::ESPWifi wifi("your_wifi_ssid", "your_wifi_password");
//
// ESP32 based board:
// #include <supla/network/esp32_wifi.h>
// Supla::ESP32Wifi wifi("your_wifi_ssid", "your_wifi_password");


void setup() {

  Serial.begin(9600);

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

  // Replace the following AUTHKEY with value that you can retrieve from: https://www.supla.org/arduino/get-authkey
  char AUTHKEY[SUPLA_AUTHKEY_SIZE] = {xxxxxxxxxxx};
 
  /*
   * 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_0 = new Supla::Control::RollerShutter(22, 23, false);
  Supla::Control::Button *buttonOpen_0 = new Supla::Control::Button(11, true, true);
  Supla::Control::Button *buttonClose_0 = new Supla::Control::Button(12, true, true);

  buttonOpen_0->addAction(Supla::OPEN_OR_STOP, *rs_0, Supla::ON_PRESS);
  buttonClose_0->addAction(Supla::CLOSE_OR_STOP, *rs_0, Supla::ON_PRESS);

  Supla::Control::RollerShutter *rs_1 = new Supla::Control::RollerShutter(24, 25, false);
  Supla::Control::Button *buttonOpen_1 = new Supla::Control::Button(8, true, true);
  Supla::Control::Button *buttonClose_1 = new Supla::Control::Button(9, true, true);

  buttonOpen_1->addAction(Supla::OPEN_OR_STOP, *rs_1, Supla::ON_PRESS);
  buttonClose_1->addAction(Supla::CLOSE_OR_STOP, *rs_1, Supla::ON_PRESS);

    Supla::Control::RollerShutter *rs_2 = new Supla::Control::RollerShutter(26, 27, false);
  Supla::Control::Button *buttonOpen_2 = new Supla::Control::Button(6, true, true);
  Supla::Control::Button *buttonClose_2 = new Supla::Control::Button(7, true, true);

  buttonOpen_2->addAction(Supla::OPEN_OR_STOP, *rs_2, Supla::ON_PRESS);
  buttonClose_2->addAction(Supla::CLOSE_OR_STOP, *rs_2, Supla::ON_PRESS);

  Supla::Control::RollerShutter *rs_3 = new Supla::Control::RollerShutter(28, 29, false);
  Supla::Control::Button *buttonOpen_3 = new Supla::Control::Button(3, true, true);
  Supla::Control::Button *buttonClose_3 = new Supla::Control::Button(5, true, true);

  buttonOpen_3->addAction(Supla::OPEN_OR_STOP, *rs_3, Supla::ON_PRESS);
  buttonClose_3->addAction(Supla::CLOSE_OR_STOP, *rs_3, 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 
                    "svrx.supla.org",  // SUPLA server address
                    "xxxx@xxxx",   // Email address used to login to Supla Cloud
                    AUTHKEY);          // Authorization key
    
}

void loop() {
  SuplaDevice.iterate();
}

Return to “Pomoc”