Licznik impulsów (impulse counter) - Arduino IDE

bigthomas
Posty: 234
Rejestracja: pn sie 12, 2019 3:35 pm

klew pisze: śr paź 07, 2020 10:17 am Pokaż logi z Seriala.

Kod: Zaznacz cały

Creating Impulse Counter: impulsePin(12), delay(10 ms)
Creating Impulse Counter: impulsePin(13), delay(50 ms)
Supla - starting initialization
Storage initialization
readStorage: 8; Read: [53 55 50 4C 41 1 0 1 ]
Storage: Number of sections 1
Reading section: 0
readStorage: 7; Read: [3 10 0 0 0 0 0 ]
Section type: 3; size: 16
Validating storage state section with current device configuration
Storage state section validation completed. Loading elements state...
readStorage: 8; Read: [0 0 0 0 0 0 0 0 ]
ImpulseCounter[0] - set counter to 0
readStorage: 8; Read: [0 0 0 0 0 0 0 0 ]
ImpulseCounter[1] - set counter to 0
Initializing network layer
WIFI: establishing connection with SSID: "XXXXX"
Using Supla protocol version 12
Current status: [7] SuplaDevice initialized
Current status: [21] No connection to network
local IP: XXX.XXX.XXX.XXX
subnetMask: XXX.XXX.XXX.XXX
gatewayIP: XXX.XXX.XXX.XXX
Signal Strength (RSSI): -76 dBm
Pin 12 status: 0
Pin 13 status: 1
Pin 14 status: 0
Current status: [9] Not connected to Supla server
Establishing connection with: svr26.supla.org (port: 2015)
Connected to Supla Server
Current status: [10] Register in progress
Sending: [53 55 50 4C 41 C 1 0 0 0 45 0 0 0 7A 2 0 0 62 69 67 74 68 6F 6D 61 73 36 36 36 40 67 6D 61 69 6C 2E 63 6F 6D 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3C EC 4C DB CC BF FF 2F A3 5E 14 79 98 79 4E FE 9B A1 43 E7 34 1A 87 F1 CF 3C E6 B 19 CA 17 E 41 20 49 6D 70 75 6C 73 20 43 6F 75 74 65 72 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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 32 36 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 2 0 92 13 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 92 13 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 ]
Sending: [53 55 50 4C 41 ]
Pin 12 status: 0
Pin 13 status: 1
Pin 14 status: 0
Pin 12 status: 0
Pin 13 status: 1
Pin 14 status: 0
Received: [53 55 50 4C 41 C 1 0 0 0 46 0 0 0 7 0 0 0 3 0 0 0 78 D 1 53 55 50 4C 41 ]
Device registered (activity timeout 120 s, server version: 13, server min version: 1)
Current status: [17] Registered and ready.
Changing activity timeout to 30
Sending: [53 55 50 4C 41 C 2 0 0 0 D2 0 0 0 1 0 0 0 1E ]
Sending: [53 55 50 4C 41 ]
Pin 12 status: 0
Pin 13 status: 1
Pin 14 status: 0
Received: [53 55 50 4C 41 C 2 0 0 0 DC 0 0 0 3 0 0 0 1E A F0 53 55 50 4C 41 ]
Activity timeout set to 30 s
Pin 12 status: 0
Pin 13 status: 1
Pin 14 status: 0
Pin 12 status: 0
Pin 13 status: 1
Pin 14 status: 0
Pin 12 status: 0
Pin 13 status: 1
Pin 14 status: 0
Pin 12 status: 0
Pin 13 status: 1
Pin 14 status: 0
Pin 12 status: 0
Pin 13 status: 1
Pin 14 status: 0
Pin 12 status: 0
Pin 13 status: 1
Pin 14 status: 0
Pin 12 status: 1
Pin 13 status: 1
Pin 14 status: 0
Pin 12 status: 0
Pin 13 status: 1
Pin 14 status: 0
Pin 12 status: 0
Pin 13 status: 1
Pin 14 status: 0
Pin 12 status: 0
Pin 13 status: 1
Pin 14 status: 0
Pin 12 status: 0
Pin 13 status: 1
Pin 14 status: 0
Pin 12 status: 0
Pin 13 status: 1
Pin 14 status: 0
Pin 12 status: 0
Pin 13 status: 1
Pin 14 status: 0
Pin 12 status: 0
Pin 13 status: 1
Pin 14 status: 0
Pin 12 status: 0
Pin 13 status: 1
Pin 14 status: 0
Pin 12 status: 1
Pin 13 status: 1
Pin 14 status: 0
Sending: [53 55 50 4C 41 C 3 0 0 0 28 0 0 0 10 0 0 0 1E 0 0 0 0 0 0 0 46 FE A 0 0 0 0 0 ]
Sending: [53 55 50 4C 41 ]
Pin 12 status: 1
Pin 13 status: 1
Pin 14 status: 0
Received: [53 55 50 4C 41 C 3 0 0 0 32 0 0 0 10 0 0 0 4E A4 7D 5F 0 0 0 0 6A 84 2 0 0 0 0 0 53 55 50 4C 41 ]
Pin 12 status: 1
Pin 13 status: 1
Pin 14 status: 0
Pin 12 status: 1
Pin 13 status: 1
Pin 14 status: 0
Pin 12 status: 1
Pin 13 status: 1
Pin 14 status: 0
Pin 12 status: 0
Pin 13 status: 1
Pin 14 status: 0
Pin 12 status: 0
Pin 13 status: 1
Pin 14 status: 0
Pin 12 status: 0
Pin 13 status: 0
Pin 14 status: 0
Pin 12 status: 0
Pin 13 status: 0
Pin 14 status: 0
Pin 12 status: 0
Pin 13 status: 0
Pin 14 status: 0
Pin 12 status: 0
Pin 13 status: 1
Pin 14 status: 0
Pin 12 status: 0
Pin 13 status: 1
Pin 14 status: 0
Pin 12 status: 0
Pin 13 status: 1
Pin 14 status: 0
Pin 12 status: 0
Pin 13 status: 1
Pin 14 status: 0
Pin 12 status: 0
Pin 13 status: 1
Pin 14 status: 0
Pin 12 status: 0
Pin 13 status: 1
Pin 14 status: 0
Pin 12 status: 0
Pin 13 status: 1
Pin 14 status: 0
Pin 12 status: 0
Pin 13 status: 1
Pin 14 status: 0
Sending: [53 55 50 4C 41 C 4 0 0 0 28 0 0 0 10 0 0 0 38 0 0 0 0 0 0 0 C2 6C 3 0 0 0 0 0 ]
Sending: [53 55 50 4C 41 ]
Pin 12 status: 0
Pin 13 status: 1
Pin 14 status: 0
Received: [53 55 50 4C 41 C 4 0 0 0 32 0 0 0 10 0 0 0 67 A4 7D 5F 0 0 0 0 97 D9 9 0 0 0 0 0 53 55 50 4C 41 ]
Pin 12 status: 0
Pin 13 status: 1
Pin 14 status: 1
Pin 12 status: 0
Pin 13 status: 1
Pin 14 status: 1
Pin 12 status: 0
Pin 13 status: 1
Pin 14 status: 1
Pin 12 status: 0
Pin 13 status: 1
Pin 14 status: 0
Awatar użytkownika
klew
Posty: 8184
Rejestracja: czw cze 27, 2019 12:16 pm
Lokalizacja: Wrocław

bigthomas pisze: śr paź 07, 2020 11:23 am
klew pisze: śr paź 07, 2020 10:17 am Pokaż logi z Seriala.
Dzięki. Może timer nie działa na ESP32?
Spróbuj wrzucić tutaj jakiegoś "Serial.println("dzialam");"
https://github.com/klew/arduino/blob/0f ... er.cpp#L91

Spróbuję wieczorem odkopać moje ESP32 i sprawdzę o co chodzi. Samo ESP32 nie było zbyt intensywnie testowane (programy sprwadzam głównie na Arduino Mega i ESP8266), więc możliwe że niektóre rzeczy nie działają.
Widzimy się na Supla Offline Party vol. 2 :!:
bigthomas
Posty: 234
Rejestracja: pn sie 12, 2019 3:35 pm

klew pisze: śr paź 07, 2020 11:32 am
bigthomas pisze: śr paź 07, 2020 11:23 am
klew pisze: śr paź 07, 2020 10:17 am Pokaż logi z Seriala.
Dzięki. Może timer nie działa na ESP32?
Spróbuj wrzucić tutaj jakiegoś "Serial.println("dzialam");"
https://github.com/klew/arduino/blob/0f ... er.cpp#L91

Spróbuję wieczorem odkopać moje ESP32 i sprawdzę o co chodzi. Samo ESP32 nie było zbyt intensywnie testowane (programy sprwadzam głównie na Arduino Mega i ESP8266), więc możliwe że niektóre rzeczy nie działają.
Po dodaniu:

Kod: Zaznacz cały

void ImpulseCounter::onFastTimer() {
  int currentState = digitalRead(impulsePin);
  Serial.println("dzialam");
  if (prevState == (detectLowToHigh == true ? LOW : HIGH)) {
ESP resetuje się w kółko:

Kod: Zaznacz cały

15:33:18.173 -> Creating Impulse Counter: impulsePin(12), delay(10 ms)
15:33:18.173 -> Creating Impulse Counter: impulsePin(13), delay(50 ms)
15:33:18.173 -> Supla - starting initialization
15:33:18.173 -> Storage initialization
15:33:18.213 -> readStorage: 8; Read: [53 55 50 4C 41 1 0 1 ]
15:33:18.213 -> Storage: Number of sections 1
15:33:18.213 -> Reading section: 0
15:33:18.213 -> readStorage: 7; Read: [3 10 0 0 0 0 0 ]
15:33:18.213 -> Section type: 3; size: 16
15:33:18.213 -> Validating storage state section with current device configuration
15:33:18.213 -> Storage state section validation completed. Loading elements state...
15:33:18.213 -> readStorage: 8; Read: [0 0 0 0 0 0 0 0 ]
15:33:18.213 -> ImpulseCounter[0] - set counter to 0
15:33:18.213 -> readStorage: 8; Read: [0 0 0 0 0 0 0 0 ]
15:33:18.213 -> ImpulseCounter[1] - set counter to 0
15:33:18.213 -> Initializing Guru Meditation Error: Core  1 panic'ed (Interrupt wdt timeout on CPU1)
15:33:18.534 -> Core 1 register dump:
15:33:18.534 -> PC      : 0x4008b5c4  PS      : 0x00060234  A0      : 0x8008a79f  A1      : 0x3ffbe650  
15:33:18.534 -> A2      : 0x3ffb81f0  A3      : 0x3ffb8074  A4      : 0x00000001  A5      : 0x00000001  
15:33:18.534 -> A6      : 0x00060223  A7      : 0x00000000  A8      : 0x3ffb8074  A9      : 0x3ffb8074  
15:33:18.574 -> A10     : 0x00000018  A11     : 0x00000018  A12     : 0x00000001  A13     : 0x00000001  
15:33:18.574 -> A14     : 0x00060221  A15     : 0x00000000  SAR     : 0x0000000c  EXCCAUSE: 0x00000006  
15:33:18.574 -> EXCVADDR: 0x00000000  LBEG    : 0x400014fd  LEND    : 0x4000150d  LCOUNT  : 0xfffffffe  
15:33:18.574 -> Core 1 was running in ISR context:
15:33:18.574 -> EPC1    : 0x40089c26  EPC2    : 0x00000000  EPC3    : 0x00000000  EPC4    : 0x4008b5c4
15:33:18.574 -> 
15:33:18.574 -> Backtrace: 0x4008b5c4:0x3ffbe650 0x4008a79c:0x3ffbe670 0x40088a37:0x3ffbe690 0x400d61bd:0x3ffbe6d0 0x400d534d:0x3ffbe6f0 0x400d5546:0x3ffbe710 0x400d5595:0x3ffbe730 0x400d259a:0x3ffbe750 0x400d1704:0x3ffbe770 0x40080f55:0x3ffbe790 0x4008130d:0x3ffbe7b0 0x40084825:0x3ffbe7d0 0x400d61c9:0x3ffb1e50 0x400d534d:0x3ffb1e70 0x400d5546:0x3ffb1e90 0x400d5595:0x3ffb1eb0 0x400d55ad:0x3ffb1ed0 0x400d163a:0x3ffb1ef0 0x400d1b92:0x3ffb1f30 0x400d122d:0x3ffb1f50 0x400d5ac3:0x3ffb1fb0 0x40088c31:0x3ffb1fd0
15:33:18.614 -> 
15:33:18.614 -> Core 0 register dump:
15:33:18.654 -> PC      : 0x40089c26  PS      : 0x00060034  A0      : 0x8008a44d  A1      : 0x3ffbe150  
15:33:18.654 -> A2      : 0x3ffbf344  A3      : 0x0000cdcd  A4      : 0xb33fffff  A5      : 0x00000001  
15:33:18.654 -> A6      : 0x00060021  A7      : 0x0000abab  A8      : 0x0000abab  A9      : 0x3ffc254c  
15:33:18.654 -> A10     : 0x00000003  A11     : 0x00060023  A12     : 0x00060021  A13     : 0x00000001  
15:33:18.654 -> A14     : 0x00060520  A15     : 0x00000000  SAR     : 0x0000001d  EXCCAUSE: 0x00000006  
15:33:18.694 -> EXCVADDR: 0x00000000  LBEG    : 0x00000000  LEND    : 0x00000000  LCOUNT  : 0x00000000  
15:33:18.694 -> 
15:33:18.694 -> Backtrace: 0x40089c26:0x3ffbe150 0x4008a44a:0x3ffbe180 0x40088d1f:0x3ffbe1a0 0x4008b435:0x3ffbe1c0 0x4008482e:0x3ffbe1d0 0x4013f187:0x3ffbbff0 0x400d91b3:0x3ffbc010 0x4008a415:0x3ffbc030 0x40088c31:0x3ffbc050
15:33:18.694 -> 
15:33:18.694 -> Rebooting...
15:33:18.694 -> ets Jun  8 2016 00:22:57
15:33:18.694 -> 
15:33:18.694 -> rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
15:33:18.694 -> configsip: 0, SPIWP:0xee
15:33:18.694 -> clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
15:33:18.734 -> mode:DIO, clock div:1
15:33:18.734 -> load:0x3fff0018,len:4
15:33:18.734 -> load:0x3fff001c,len:1216
15:33:18.734 -> ho 0 tail 12 room 4
15:33:18.734 -> load:0x40078000,len:9720
15:33:18.734 -> ho 0 tail 12 room 4
15:33:18.734 -> load:0x40080400,len:6352
15:33:18.734 -> entry 0x400806b8
15:33:18.974 -> Creating Impulse Counter: impulsePin(12), delay(10 ms)
15:33:18.974 -> Creating Impulse Counter: impulsePin(13), delay(50 ms)
15:33:18.974 -> Supla - starting initialization
15:33:18.974 -> Storage initialization
15:33:18.974 -> readStorage: 8; Read: [53 55 50 4C 41 1 0 1 ]
15:33:18.974 -> Storage: Number of sections 1
15:33:19.014 -> Reading section: 0
15:33:19.014 -> readStorage: 7; Read: [3 10 0 0 0 0 0 ]
15:33:19.014 -> Section type: 3; size: 16
15:33:19.014 -> Validating storage state section with current device configuration
15:33:19.014 -> Storage state section validation completed. Loading elements state...
15:33:19.014 -> readStorage: 8; Read: [0 0 0 0 0 0 0 0 ]
15:33:19.014 -> ImpulseCounter[0] - set counter to 0
15:33:19.014 -> readStorage: 8; Read: [0 0 0 0 0 0 0 0 ]
15:33:19.014 -> ImpulseCounter[1] - set counter to 0
15:33:19.014 -> Initializing Guru Meditation Error: Core  1 panic'ed (Interrupt wdt timeout on CPU1)
15:33:19.334 -> Core 1 register dump:
15:33:19.334 -> PC      : 0x4008b5c4  PS      : 0x00060234  A0      : 0x8008a79f  A1      : 0x3ffbe650  
15:33:19.334 -> A2      : 0x3ffb81f0  A3      : 0x3ffb8074  A4      : 0x00000001  A5      : 0x00000001  
15:33:19.334 -> A6      : 0x00060223  A7      : 0x00000000  A8      : 0x3ffb8074  A9      : 0x3ffb8074  
15:33:19.334 -> A10     : 0x00000018  A11     : 0x00000018  A12     : 0x00000001  A13     : 0x00000001  
15:33:19.374 -> A14     : 0x00060221  A15     : 0x00000000  SAR     : 0x0000000c  EXCCAUSE: 0x00000006  
15:33:19.374 -> EXCVADDR: 0x00000000  LBEG    : 0x400014fd  LEND    : 0x4000150d  LCOUNT  : 0xfffffffe  
15:33:19.374 -> Core 1 was running in ISR context:
15:33:19.374 -> EPC1    : 0x40089c26  EPC2    : 0x00000000  EPC3    : 0x00000000  EPC4    : 0x4008b5c4
15:33:19.374 -> 
15:33:19.374 -> Backtrace: 0x4008b5c4:0x3ffbe650 0x4008a79c:0x3ffbe670 0x40088a37:0x3ffbe690 0x400d61bd:0x3ffbe6d0 0x400d534d:0x3ffbe6f0 0x400d5546:0x3ffbe710 0x400d5595:0x3ffbe730 0x400d259a:0x3ffbe750 0x400d1704:0x3ffbe770 0x40080f55:0x3ffbe790 0x4008130d:0x3ffbe7b0 0x40084825:0x3ffbe7d0 0x400d61c9:0x3ffb1e50 0x400d534d:0x3ffb1e70 0x400d5546:0x3ffb1e90 0x400d5595:0x3ffb1eb0 0x400d55ad:0x3ffb1ed0 0x400d163a:0x3ffb1ef0 0x400d1b92:0x3ffb1f30 0x400d122d:0x3ffb1f50 0x400d5ac3:0x3ffb1fb0 0x40088c31:0x3ffb1fd0
15:33:19.414 -> 
15:33:19.414 -> Core 0 register dump:
15:33:19.414 -> PC      : 0x40089c26  PS      : 0x00060034  A0      : 0x8008a44d  A1      : 0x3ffbe150  
15:33:19.454 -> A2      : 0x3ffbf344  A3      : 0x0000cdcd  A4      : 0xb33fffff  A5      : 0x00000001  
15:33:19.454 -> A6      : 0x00060021  A7      : 0x0000abab  A8      : 0x0000abab  A9      : 0x3ffc254c  
15:33:19.454 -> A10     : 0x00000003  A11     : 0x00060023  A12     : 0x00060021  A13     : 0x3ffbb580  
15:33:19.454 -> A14     : 0x00000000  A15     : 0x3ffbbce0  SAR     : 0x0000001d  EXCCAUSE: 0x00000006  
15:33:19.454 -> EXCVADDR: 0x00000000  LBEG    : 0x00000000  LEND    : 0x00000000  LCOUNT  : 0x00000000  
15:33:19.494 -> 
15:33:19.494 -> Backtrace: 0x40089c26:0x3ffbe150 0x4008a44a:0x3ffbe180 0x40088d1f:0x3ffbe1a0 0x4008b435:0x3ffbe1c0 0x4008482e:0x3ffbe1d0 0x4013f187:0x3ffbbff0 0x400d91b3:0x3ffbc010 0x4008a415:0x3ffbc030 0x40088c31:0x3ffbc050
15:33:19.494 -> 
15:33:19.494 -> Rebooting...
Awatar użytkownika
klew
Posty: 8184
Rejestracja: czw cze 27, 2019 12:16 pm
Lokalizacja: Wrocław

bigthomas pisze: śr paź 07, 2020 1:39 pm

Kod: Zaznacz cały

Guru Meditation Error
Hehe :)

Coś jest na rzeczy. Spróbuję to w najbliższym czasie uruchomić u siebie. Odezwę się wieczorem (dziś lub jutro)
Widzimy się na Supla Offline Party vol. 2 :!:
bigthomas
Posty: 234
Rejestracja: pn sie 12, 2019 3:35 pm

@klew skoro będziesz już tam grzebał to może uda Ci się zrealizować to o czym pisał PW do Ciebie, tj. aby móc zliczać przy pomocy licznika impulsów ilość załączeń relay'a?
Według mnie była by to przydatna informacja ile razy zostało uruchomione urządzenie.
bigthomas
Posty: 234
Rejestracja: pn sie 12, 2019 3:35 pm

klew pisze: śr paź 07, 2020 11:32 am Spróbuję wieczorem odkopać moje ESP32 i sprawdzę o co chodzi. Samo ESP32 nie było zbyt intensywnie testowane (programy sprwadzam głównie na Arduino Mega i ESP8266), więc możliwe że niektóre rzeczy nie działają.
Udało może Ci się zagospodarować trochę czasu na licznik impulsów na ESP32?
Awatar użytkownika
klew
Posty: 8184
Rejestracja: czw cze 27, 2019 12:16 pm
Lokalizacja: Wrocław

bigthomas pisze: pn paź 12, 2020 6:04 pm
klew pisze: śr paź 07, 2020 11:32 am Spróbuję wieczorem odkopać moje ESP32 i sprawdzę o co chodzi. Samo ESP32 nie było zbyt intensywnie testowane (programy sprwadzam głównie na Arduino Mega i ESP8266), więc możliwe że niektóre rzeczy nie działają.
Udało może Ci się zagospodarować trochę czasu na licznik impulsów na ESP32?
Niestety jeszcze nie. Myślę, że w ciągu tego tygodnia znajdę na to czas.
Widzimy się na Supla Offline Party vol. 2 :!:
bigthomas
Posty: 234
Rejestracja: pn sie 12, 2019 3:35 pm

Próbowałem to jakość obejść bezpośrednio z pętli podawać wartość IC

Kod: Zaznacz cały

ic->setCounter(nowa_wartosc);

Dodając do każdego wykonania + 1.
Wcześniej przy uruchomieniu programu zaczytuje zapisana wartość:

Kod: Zaznacz cały

nowa_wartosc= ic->getCounter();
I z tego co widzę w logach to wartość zapisana jest w pamięci, jednak moduł dalej resetuje się...

Kod: Zaznacz cały

0:14:54.209 -> ets Jun  8 2016 00:22:57
10:14:54.209 -> 
10:14:54.209 -> rst:0x3 (SW_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
10:14:54.209 -> configsip: 0, SPIWP:0xee
10:14:54.209 -> clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
10:14:54.209 -> mode:DIO, clock div:1
10:14:54.209 -> load:0x3fff0018,len:4
10:14:54.209 -> load:0x3fff001c,len:1216
10:14:54.209 -> ho 0 tail 12 room 4
10:14:54.209 -> load:0x40078000,len:9720
10:14:54.209 -> ho 0 tail 12 room 4
10:14:54.209 -> load:0x40080400,len:6352
10:14:54.209 -> entry 0x400806b8
10:14:54.490 -> Creating OneWire bus for pin: 23
10:14:54.490 -> Initializing OneWire bus at pin 23
10:14:54.490 -> OneWire(pin 23) Parasite power is OFF
10:14:54.490 -> OneWire(pin 23) Found 0 devices:
10:14:54.490 -> Channel(18) value changed to -1
10:14:54.490 -> Supla - starting initialization
10:14:54.537 -> Storage initialization
10:14:54.537 -> readStorage: 8; Read: [53 55 50 4C 41 1 0 1 ]
10:14:54.537 -> Storage: Number of sections 1
10:14:54.537 -> Reading section: 0
10:14:54.537 -> readStorage: 7; Read: [3 8 0 0 0 0 0 ]
10:14:54.537 -> Section type: 3; size: 8
10:14:54.537 -> Validating storage state section with current device configuration
10:14:54.537 -> Storage state section validation completed. Loading elements state...
10:14:54.537 -> readStorage: 8; Read: [3 0 0 0 0 0 0 0 ]
10:14:54.537 -> Channel(8) value changed to 3
10:14:54.537 -> ImpulseCounter[8] - set counter to 3
10:14:54.537 ->  **** Digital write[0], pin: 32; value: 1
10:14:54.537 ->  **** Digital write[1], pin: 33; value: 1
10:14:54.537 ->  **** Digital write[2], pin: 25; value: 1
10:14:54.584 ->  **** Digital write[3], pin: 26; value: 1
10:14:54.584 ->  **** Digital write[4], pin: 27; value: 1
10:14:54.584 ->  **** Digital write[5], pin: 14; value: 1
10:14:54.584 ->  **** Digital write[6], pin: 17; value: 1
10:14:54.584 ->  **** Digital write[7], pin: 5; value: 1
10:14:54.584 -> Channel(9) value changed to -275.000000
10:14:54.584 -> Channel(10) value changed to -275.000000
10:14:54.584 -> Channel(11) value changed to -275.000000
10:14:54.584 -> Channel(12) value changed to -275.000000
10:14:54.584 -> Channel(13) value changed to -275.000000
10:14:54.584 -> Channel(14) value changed to -275.000000
10:14:54.584 -> Channel(15) value changed to -275.000000
10:14:54.584 -> Channel(16) value changed to -275.000000
10:14:54.631 -> Channel(17) value changed to -275.000000
10:14:54.771 -> Channel(18) value changed to 0.500000
10:14:54.958 -> Channel(18) value changed to 1.500000
10:14:54.958 -> Channel(19) value changed to 1
10:14:54.958 -> Initializing network layer
10:14:54.958 -> WIFI: establishing connection with SSID: "XXXXX"
10:14:54.958 -> Guru Meditation Error: Core  1 panic'ed (Cache disabled but cached memory region accessed)
10:14:55.005 -> Core 1 register dump:
10:14:55.005 -> PC      : 0x400d3304  PS      : 0x00060034  A0      : 0x80081374  A1      : 0x3ffbe790  
10:14:55.005 -> A2      : 0x3ffbec60  A3      : 0x20000000  A4      : 0x00000400  A5      : 0x00000000  
10:14:55.005 -> A6      : 0x3ffc2930  A7      : 0xffffffff  A8      : 0x80080f68  A9      : 0x00000001  
10:14:55.005 -> A10     : 0x3ffc13a8  A11     : 0x00000000  A12     : 0x3ffba264  A13     : 0x0000abab  
10:14:55.005 -> A14     : 0x3ffc4590  A15     : 0x3ffba264  SAR     : 0x00000014  EXCCAUSE: 0x00000007  
10:14:55.005 -> EXCVADDR: 0x00000000  LBEG    : 0x00000000  LEND    : 0x00000000  LCOUNT  : 0x00000000  
10:14:55.052 -> Core 1 was running in ISR context:
10:14:55.052 -> EPC1    : 0x40086adb  EPC2    : 0x00000000  EPC3    : 0x00000000  EPC4    : 0x400d3304
10:14:55.052 -> 
10:14:55.052 -> Backtrace: 0x400d3304:0x3ffbe790 0x40081371:0x3ffbe7b0 0x40084825:0x3ffbe7d0 0x40086ad8:0x3ffba190 0x40082c3f:0x3ffba1b0 0x40088c31:0x3ffba1d0
10:14:55.052 -> 
10:14:55.052 -> Rebooting...
10:14:55.052 -> ets Jun  8 2016 00:22:57
10:14:55.052 -> 
10:14:55.052 -> rst:0x3 (SW_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
10:14:55.052 -> configsip: 0, SPIWP:0xee
10:14:55.052 -> clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
10:14:55.052 -> mode:DIO, clock div:1
10:14:55.099 -> load:0x3fff0018,len:4
10:14:55.099 -> load:0x3fff001c,len:1216
10:14:55.099 -> ho 0 tail 12 room 4
10:14:55.099 -> load:0x40078000,len:9720
10:14:55.099 -> ho 0 tail 12 room 4
10:14:55.099 -> load:0x40080400,len:6352
10:14:55.099 -> entry 0x400806b8
10:14:55.379 -> Creating OneWire bus for pin: 23
10:14:55.379 -> Initializing OneWire bus at pin 23
10:14:55.379 -> OneWire(pin 23) Parasite power is OFF
10:14:55.379 -> OneWire(pin 23) Found 0 devices:
10:14:55.379 -> Channel(18) value changed to -1
10:14:55.379 -> Supla - starting initialization
10:14:55.379 -> Storage initialization
10:14:55.379 -> readStorage: 8; Read: [53 55 50 4C 41 1 0 1 ]
10:14:55.379 -> Storage: Number of sections 1
10:14:55.379 -> Reading section: 0
10:14:55.379 -> readStorage: 7; Read: [3 8 0 0 0 0 0 ]
10:14:55.379 -> Section type: 3; size: 8
10:14:55.379 -> Validating storage state section with current device configuration
10:14:55.426 -> Storage state section validation completed. Loading elements state...
10:14:55.426 -> readStorage: 8; Read: [3 0 0 0 0 0 0 0 ]
10:14:55.426 -> Channel(8) value changed to 3
10:14:55.426 -> ImpulseCounter[8] - set counter to 3
10:14:55.426 ->  **** Digital write[0], pin: 32; value: 1
10:14:55.426 ->  **** Digital write[1], pin: 33; value: 1
10:14:55.426 ->  **** Digital write[2], pin: 25; value: 1
10:14:55.426 ->  **** Digital write[3], pin: 26; value: 1
10:14:55.426 ->  **** Digital write[4], pin: 27; value: 1
10:14:55.426 ->  **** Digital write[5], pin: 14; value: 1
10:14:55.426 ->  **** Digital write[6], pin: 17; value: 1
10:14:55.426 ->  **** Digital write[7], pin: 5; value: 1
10:14:55.473 -> Channel(9) value changed to -275.000000
10:14:55.473 -> Channel(10) value changed to -275.000000
10:14:55.473 -> Channel(11) value changed to -275.000000
10:14:55.473 -> Channel(12) value changed to -275.000000
10:14:55.473 -> Channel(13) value changed to -275.000000
10:14:55.473 -> Channel(14) value changed to -275.000000
10:14:55.473 -> Channel(15) value changed to -275.000000
10:14:55.473 -> Channel(16) value changed to -275.000000
10:14:55.473 -> Channel(17) value changed to -275.000000
10:14:55.660 -> Channel(18) value changed to 0.500000
10:14:55.847 -> Channel(18) value changed to 1.500000
10:14:55.847 -> Channel(19) value changed to 1
10:14:55.847 -> Initializing network layer
10:14:55.847 -> WIFI: establishing connection with SSID: "XXXXX"
10:14:55.847 -> Guru Meditation Error: Core  1 panic'ed (Cache disabled but cached memory region accessed)
10:14:55.847 -> Core 1 register dump:
10:14:55.847 -> PC      : 0x400d3304  PS      : 0x00060034  A0      : 0x80081374  A1      : 0x3ffbe790  
10:14:55.847 -> A2      : 0x3ffbec60  A3      : 0x20000000  A4      : 0x00000400  A5      : 0x00000000  
10:14:55.894 -> A6      : 0x3ffc2930  A7      : 0xffffffff  A8      : 0x80080f68  A9      : 0x00000001  
10:14:55.894 -> A10     : 0x3ffc13a8  A11     : 0x00000000  A12     : 0x3ffba264  A13     : 0x0000abab  
10:14:55.894 -> A14     : 0x3ffc4590  A15     : 0x3ffba264  SAR     : 0x00000014  EXCCAUSE: 0x00000007  
10:14:55.894 -> EXCVADDR: 0x00000000  LBEG    : 0x00000000  LEND    : 0x00000000  LCOUNT  : 0x00000000  
10:14:55.894 -> Core 1 was running in ISR context:
10:14:55.894 -> EPC1    : 0x40086ae6  EPC2    : 0x00000000  EPC3    : 0x00000000  EPC4    : 0x400d3304
10:14:55.894 -> 
10:14:55.894 -> Backtrace: 0x400d3304:0x3ffbe790 0x40081371:0x3ffbe7b0 0x40084825:0x3ffbe7d0 0x40086ae3:0x3ffba190 0x40082c3f:0x3ffba1b0 0x40088c31:0x3ffba1d0
10:14:55.941 -> 
10:14:55.941 -> Rebooting...
Awatar użytkownika
klew
Posty: 8184
Rejestracja: czw cze 27, 2019 12:16 pm
Lokalizacja: Wrocław

bigthomas pisze: ndz paź 18, 2020 8:27 am
Trochę to zajęło, ale w końcu odkopałem moje ESP32 i podłączyłem.
Niestety problem jest głębszy.
Timery w aktualnej implementacji wykonują się raz i się wyłączają ;), ale nie to jest powodem moich zmartwień.

Okazuje się, że przerwania timera na ESP32 mogą się wykonywać tylko w pamięci RAM. Oznacza to, że do funkcji, które są odpalane, musi być dodana "flaga" IRAM_ATTR, która powoduje, że dany fragment kodu będzie umieszczony w pamięci RAM, a nie we flashu. Taki kod może się wykonać na przerwaniu timera.
Wszystko by było jeszcze do ogarnięcia, gdyby nie to, że nie działa to poprawnie z metodami wirtualnymi.
Jeszcze będę grzebał i szukał jak to poprawić, ale możliwe, że wykonania "onTimer" i "onFastTimer" przerzucę na osobny core ESP32 jako osobny wątek. W tym wątku będzie zwykła pętla biegająca po metodach "onTimer"/"onFastTimer".

Także na chwilę obecną na ESP32 nie działają żadne elementy biblioteki oparte o timery:
- Liczniki impulsów
- RGBW, RGB, Dimmer
- clock
- Rolety

Jeśli ktoś zna się na ESP32 i może coś podpowiedzieć, to piszcie śmiało.
Widzimy się na Supla Offline Party vol. 2 :!:
bigthomas
Posty: 234
Rejestracja: pn sie 12, 2019 3:35 pm

@klew, udało Ci się coś pogrzebać dla liczniku impulsów w ESP32?
Szkoda mi trochę urządzenia bo ma dużo pinów do wykorzystania... a w planach miałem jeszcze kilka rzeczy tam podpiąć ;)
ODPOWIEDZ

Wróć do „Arduino IDE”