BUG REPORT: Z-Uno doesn't wake by pressing keypad while sleeping.

Discussion about Z-Uno product. Visit http://z-uno.z-wave.me for more details.
Post Reply
MartinN
Posts: 3
Joined: 13 Oct 2018 21:25

BUG REPORT: Z-Uno doesn't wake by pressing keypad while sleeping.

Post by MartinN »

Z-Uno doesn't wake by pressing keypad while sleeping.
Keypad working fine when Zuno is awake, but keypad can't wake up it during sleeping mode.
Zuno also wakes up itself in an interval of 240 seconds.

Same issue at version 2.1.3, 2.1.4, 2.1.5 beta

Same issue for example:
https://z-uno.z-wave.me/examples/secure ... door-lock/

Using library <ZMEKeypad.h> and ZUNO_SETUP_SLEEPING_MODE(ZUNO_SLEEPING_MODE_SLEEPING)
zunoSetWUOptions(ZUNO_WUPFLAGS_INT1_KEYSCAN);
--------------------------------------------------------------------------------
Z-Uno bootloader version: 2.1.3, 2.1.4, 2.1.5 beta
Security: none (not relevant for this issue)
Frequency: EU
Device included: yes (but not relevant for this issue)
Device included securely by controller: no
Controller: FHEM with ZWave-USB-Stick (ZMEEUZB1)
Connected peripherals:
4x4 matrix Keypad (see example)


Compiler Output:
----------------------------------------------------------
FIRMWARE DATA
----------------------------------------------------------
REVISION:02.14
Z-WAVE FREQUENCY:EU
ORIGINAL FW. CRC32: 59 CA 3B 60
MAXIMUM CODE SIZE: 30 KB
CURRENT FW. CRC16: FE A1
RADIO CHANNELS: 02
----------------------------------------------------------
HARDWARE DATA
----------------------------------------------------------
CALIBRATION
MAIN:06 TX: 17 0E
DEVICE PUBLIC KEY:
HEX: AA 21 EB BF 90 04 55 83 33 CD FF 71 D3 3E FE 57 BC 08 5E DA 62 9C EA 04 9D CF 40 7C 47 C3 9F 60
DEC: 43553-60351-36868-21891-13261-65393-54078-65111-48136-24282-25244-59908-40399-16508-18371-40800
----------------------------------------------------------
PRODUCTION DATA
----------------------------------------------------------
YOUR ZUNO S/N: 18 10 05 E6 00 E6 01 00 01
----------------------------------------------------------
PRODUCTION TIME:
WEEK:24 YEAR:2016
WORKSTATION:
NUMBER:1 SEQUENCE:230
HARDWARE:
CHIP:1510 REVISION:1
----------------------------------------------------------



Source Code for testing:
----------------------------------------------
#include <ZMEKeypad.h>

#define ROWS 4
#define COLS 4
#define ON_BATTERY 1
#define ZUNO_CHANNEL_NUMBER_ONE 1

ZUNO_SETUP_SLEEPING_MODE(ZUNO_SLEEPING_MODE_SLEEPING);
ZUNO_SETUP_CHANNELS(ZUNO_SENSOR_MULTILEVEL_GENERAL_PURPOSE(getter));

// Define pins numbers that we use for rows
BYTE rowPins[4] = {20, 19, 18, 17};
// Define pins numbers that we use for volumns
BYTE columnPins[4] = {12, 11, 10, 9};

// Titlse for all buttons in one string
char keys[] = "123A456B789CE0FD";

ZMEKeypad kpd = ZMEKeypad(columnPins, 4, rowPins, 4);

byte lastValue;
int timeout=0;

void setup()
{
Serial.begin();

kpd.begin();
Serial.println("Sketch is starting...");

// turn wakeup from sleep by key scanner with four columns: pins 9-12
zunoSetWUOptions(ZUNO_WUPFLAGS_INT1_KEYSCAN);

pinMode(13,OUTPUT);
digitalWrite(13,LOW);

}

void loop()
{
byte actions[4];
byte num_touched_keys = kpd.scanKeys(actions);

// We can process a number of buttons during one scan
if(num_touched_keys>0)
{
digitalWrite(13,HIGH);
Serial.print("PRESSED ");

lastValue = 255;

zunoSendReport(ZUNO_CHANNEL_NUMBER_ONE);
digitalWrite(13,HIGH);

}

if(timeout>2000)
{
//Serial.println("RESET");
timeout=0;


digitalWrite(13,LOW);
lastValue=0;
// go to sleep
zunoSendDeviceToSleep();

}
timeout=timeout+10;
delay(10);
}

byte getter(void)
{
return lastValue;
}
p0lyg0n1
Posts: 242
Joined: 04 Aug 2016 07:14

Re: BUG REPORT: Z-Uno doesn't wake by pressing keypad while sleeping.

Post by p0lyg0n1 »

Accepted. The problem is in the ZMEKeypad.h library. I get a "stack overflow" event in the kpd.scanKeys() functions. It uses too much stack.
If you enable logging you will see in UART0 something like this:

Code: Select all

0000:00 00
0000:10 00
0000:00 03
0000:A0 00
0000:A0 00
0000:A0 00
0000:A0 00
...
0000:10 00
0000:00 03
0000:A0 00
0000:A0 00
0000:A0 00
0000:A0 00
0000:A0 00
0000:A0 00
0000:A0 00
0000:A0 00
0000:A0 00
Seems we have to rework the library.
User avatar
PoltoS
Posts: 7565
Joined: 26 Jan 2011 19:36

Re: BUG REPORT: Z-Uno doesn't wake by pressing keypad while sleeping.

Post by PoltoS »

We have made a major rework of the library. It will become part of 2.1.5 soon
Post Reply