New 2.1.4 beta

Discussion about Z-Uno product. Visit http://z-uno.z-wave.me for more details.
vebryn
Posts: 18
Joined: 16 Dec 2017 02:38

Re: New 2.1.4 beta

Post by vebryn »

PoltoS wrote:
22 Jun 2018 01:53
  • SoftwareSerial - supports for slow UART. Valid speeds are 1200/2400/4800/9600 8-N-1
Great! 1200 baud, right what I needed! I succeed to parse 7n1 by using "& 0x7f". :D
Hopelessly there is reading errors :cry: (cf. Serial strange behaviour).
Riri
Posts: 25
Joined: 22 Jun 2018 10:08

Re: New 2.1.4 beta

Post by Riri »

Hi, i wrote this simple program that run perfectly with the version 2.1.3 and don't with 2.1.4.
It is the digitalRead that don't work and return always TRUE for all pins.
Do you know why.
Is there a difference like zunoSaveCFGParam ?
Thanks.


Code: Select all

#define MAX_CANAUX 10

byte          PinEntree[MAX_CANAUX+1];
byte          ValeurEntree[MAX_CANAUX+1];

void setup() 
{
  for (int i=0;i<=MAX_CANAUX;i++) {
    ValeurEntree[i]     = FALSE;
    PinEntree[i]        = 0;
  }
  
  PinEntree[1]  = 0;
  PinEntree[2]  = 1;
  PinEntree[3]  = 8;
  PinEntree[4]  = 7;
  PinEntree[5]  = 6;
  PinEntree[6]  = 5;
  PinEntree[7]  = 4;
  PinEntree[8]  = 3;
  PinEntree[9]  = 25;
  PinEntree[10] = 9;
   
  for (int i=1;i<=MAX_CANAUX;i++) pinMode(PinEntree[i], INPUT_PULLUP);
  
  Serial.begin();
}

void loop() 
{
  for (int i=1;i<=MAX_CANAUX;i++) {
    ValeurEntree[i] = digitalRead(PinEntree[i]);
    delay(2);
    Serial.print(ValeurEntree[i], DEC);
    Serial.print(" / ");
  }
  Serial.println("");
}
p0lyg0n1
Posts: 242
Joined: 04 Aug 2016 07:14

Re: New 2.1.4 beta

Post by p0lyg0n1 »

Eric,
thank you!
We have found both problems:
  • zunoSaveCFGParam in autogenerated code.
  • digitalRead(), when the parameter is a variable.
They will be fixed in beta3.
Riri
Posts: 25
Joined: 22 Jun 2018 10:08

Re: New 2.1.4 beta

Post by Riri »

Hi,
Very happy to be able to help and thank you for this ractivity :) .

I also noticed a detail, in version 2.1.3 it was mentioned:
Associations reworked - up to 32 groups are now supported (1 LifeLine + 31 control groups) with up to 8 nodes in each group.

But, in ZUNO_Definitions.h it was mentionned :

Code: Select all

#define ZUNO_MAX_ASSOC_NUMBER		5
#define ZUNO_ADD_ASSOCIATION(TYPE) zunoAddAssociation(TYPE)
And the function in HLCore.cpp :

Code: Select all

void zunoAddAssociation(byte t) {
   if(g_user_sketch.n_assocs > ZUNO_MAX_ASSOC_NUMBER)
      return;
   g_user_sketch.asociations[g_user_sketch.n_assocs] = t;
   g_user_sketch.n_assocs++;
}
In 2.1.4, it was the same definitions.
Do I look in the right place, I have never managed to associate more than 5 groups

Really, thank you
Eric.
User avatar
PoltoS
Posts: 7565
Joined: 26 Jan 2011 19:36

Re: New 2.1.4 beta

Post by PoltoS »

It is a typo. Change it to 31 (+LL). We will fix this typo
User avatar
PoltoS
Posts: 7565
Joined: 26 Jan 2011 19:36

Re: New 2.1.4 beta

Post by PoltoS »

p0lyg0n1 wrote:
24 Jun 2018 18:21
Eric,
thank you!
We have found both problems:
  • zunoSaveCFGParam in autogenerated code.
  • digitalRead(), when the parameter is a variable.
They will be fixed in beta3.
This new third beta is public now.

Please remove all from packages/Z-Uno & staging/packages and reload board from test-ucxx repository.
Riri
Posts: 25
Joined: 22 Jun 2018 10:08

Re: New 2.1.4 beta

Post by Riri »

Hi,
Thank you very much for this beta version.
I installed this version with the bootloader too (you never know). I forced it with downgrade 2.1.1 then 2.1.4 (It can also be done by changing the security S2->S0->S2)
digitalRead, zunoSaveCFGParam and zunoLoadCFGParam works fine ! Thanks !

Here are other small problems that I discovered after writing to you and it worked with version 2.1.3 (I use the eedomus box):

1)
function config_parameter_changed the function is no longer called, the program never goes in.
Here is the block that is never executed :

Code: Select all

ZUNO_SETUP_CFGPARAMETER_HANDLER(config_parameter_changed);
void config_parameter_changed(byte param, word * value)
{
  Serial.print("config_parameter_changed");
}
2)
When I write and read a configuration parameter from the box eedomus, I do not recover what I write (screenshot) :
I use COMMAND_CLASS_CONFIGURATION the CONFIGURATION_SET with for exemple the param 66
2018-06-26.png
2018-06-26.png (17.68 KiB) Viewed 7335 times
I write 1*256 + 5 and i read only 256

it seems as if the last byte was not written

3)
On the pin 3,4,5,6,7,8 (analog and TX RX), used in PULLUP, digitalRead works quickly when it goes low but they take about a second to give value by going to the up state.
to counteract this, i write digitalWrite(pin,HIGH), just after the read for these pines, and it's work fine. Is there an other solution ?
Note it was the same case in 2.1.3. It's not specially for the version 2.1.4

4)
Is there a possibility to access the green service led, I used all the pins, even the 13.

5)
Also, is there a possibility to reboot from programme. I see this instruction but it not works:

Code: Select all

  asm volatile ("  jmp 0");
Thank you again for this precious help and this reactivity
Eric
Riri
Posts: 25
Joined: 22 Jun 2018 10:08

Re: New 2.1.4 beta

Post by Riri »

I have tested the number of associations with 31 (+LL) on version 2.1.4 and it works perfectly !
Thanks
Eric.
p0lyg0n1
Posts: 242
Joined: 04 Aug 2016 07:14

Re: New 2.1.4 beta

Post by p0lyg0n1 »

Hi,
Riri wrote:
26 Jun 2018 17:00
Hi,
Thank you very much for this beta version.
I installed this version with the bootloader too (you never know). I forced it with downgrade 2.1.1 then 2.1.4 (It can also be done by changing the security S2->S0->S2)
digitalRead, zunoSaveCFGParam and zunoLoadCFGParam works fine ! Thanks !

Here are other small problems that I discovered after writing to you and it worked with version 2.1.3 (I use the eedomus box):

1)
function config_parameter_changed the function is no longer called, the program never goes in.
Here is the block that is never executed :

Code: Select all

ZUNO_SETUP_CFGPARAMETER_HANDLER(config_parameter_changed);
void config_parameter_changed(byte param, word * value)
{
  Serial.print("config_parameter_changed");
}
2)
When I write and read a configuration parameter from the box eedomus, I do not recover what I write (screenshot) :
I use COMMAND_CLASS_CONFIGURATION the CONFIGURATION_SET with for exemple the param 66
2018-06-26.png
I write 1*256 + 5 and i read only 256

it seems as if the last byte was not written

3)
On the pin 3,4,5,6,7,8 (analog and TX RX), used in PULLUP, digitalRead works quickly when it goes low but they take about a second to give value by going to the up state.
to counteract this, i write digitalWrite(pin,HIGH), just after the read for these pines, and it's work fine. Is there an other solution ?
Note it was the same case in 2.1.3. It's not specially for the version 2.1.4

4)
Is there a possibility to access the green service led, I used all the pins, even the 13.

5)
Also, is there a possibility to reboot from programme. I see this instruction but it not works:

Code: Select all

  asm volatile ("  jmp 0");
Thank you again for this precious help and this reactivity
Eric
1)-2) Works ok. I do it on Z-Way with my Razberry.
Try this code

Code: Select all

/*
  Blink
  Turns on an LED on for one second, then off for one second, repeatedly.

  Z-Uno has an on-board LED you can control. It is attached to digital pin 13.
  LED_BUILTIN is an internal Define which can be used to access this LED.
  This example demonstrates the simple blink programm, where the blink interval can be changed from the Z-Wave controller.
  More information on http://z-uno.z-wave.me/
  You can cofigure duration using parameter #64.

 */

//initial period of the blink is 1 second
byte dimmerValue=100;
word coef;
byte changed = FALSE;
byte count = 0;
byte type = 0;

//Next line sets up Z-Uno channels. In this case it adds the Switch Multilevel channel
ZUNO_SETUP_CHANNELS(ZUNO_SWITCH_MULTILEVEL(getSwitchMultilevelValue,setSwitchMultilevelValue));
// We have to define handler for configuration parameters
ZUNO_SETUP_CFGPARAMETER_HANDLER(config_parameter_changed);
// the setup function runs once, when you press reset or power the board
void setup() {
  // set digital pin 13 as an output.
  pinMode(LED_BUILTIN, OUTPUT);
  dimmerValue = 100;
  // load value of the first user-defined configuration parameter to variable coef
  // The first user defined parameter is #64, the second is #65 etc
  // We can use up to 32 user-defined parameters 
  zunoLoadCFGParam(64,&coef);
  Serial0.println(coef, HEX);
  // In case we don't have right value here
  if(coef > 20)
     coef = 20;
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
  delay(dimmerValue*byte(coef));           // wait for timeout
  digitalWrite(LED_BUILTIN, LOW);  // turn the LED off by making the voltage LOW
  delay(dimmerValue*byte(coef));           // wait for timeout

}
void config_parameter_changed(byte param, word * value)
{
    // Here we get the new vaue of our prameters
    if(param == 64) // The first user-defined parameter 
    {
      coef = *value;  
    }
    Serial0.println("HANDLER!");
    Serial0.println(coef, HEX);
}

//The setSwitchMultilevelValue runs only when a new value comes from the controller by Z-Wave
void setSwitchMultilevelValue(byte newValue) {
  //save new value in a variable
  dimmerValue = newValue;
}

//The setSwitchMultilevelValue runs only when the controller asks for the current blink rate by Z-Wave
byte getSwitchMultilevelValue(void) {
  //return previously saved value
  return dimmerValue;
}

3) Looks like it's a problem of inner capacity of your sensor. For me it works immediately. I try it with jumper cable connected to gnd. When you do digitalWrite(pin,HIGH) you make it INPUT without a PULLUP.
4) It used for inner memory, so we can't give control of this pin to user code. You can use port extender chip if you need more pins. We have built in library for MCP23017.

Code: Select all

// Connect SCL to #9, SDA to #10
#include <Wire.h>
#include <ZUNO_MCP23017.h>
ZUNO_MCP23017 mcp;
void setup() {  
  mcp.begin();      // use default address 
  mcp.pinMode(0, OUTPUT);
}
void loop() {
  delay(100);
  mcp.digitalWrite(0, HIGH);
  delay(100);
  mcp.digitalWrite(0, LOW);
}
5) use zunoReboot(). We have added it in beta3 and it's not documented yet.

Code: Select all


void setup() {
    Serial.begin(115200);
          
}
byte count = 0;
void loop() {
    count++;
    Serial.print("LOOP:");
    Serial.println(count);
    if(count>50){
        Serial.print("Rebooting...");
        zunoReboot();
    }
    delay(1000);
    
}
Thank you, for your reports. Please check configuration params with your devices once more.
Best regards,
Alex.
Riri
Posts: 25
Joined: 22 Jun 2018 10:08

Re: New 2.1.4 beta

Post by Riri »

Hi, a very big "thanks" for your answer very detailled !

For 1) and 2) I try your code and it works.
The difference with mine is static/dynamic channel :? . I have write two most simples programs what made the same think with the same channel, static works, dynamic not works.
static :

Code: Select all

ZUNO_SETUP_CHANNELS(ZUNO_SWITCH_MULTILEVEL(getSwitchMultilevelValue,setSwitchMultilevelValue));
ZUNO_SETUP_CFGPARAMETER_HANDLER(config_parameter_changed);

word w = 0;

void config_parameter_changed(byte param, word * value)
{
  Serial.println("config_parameter_changed");
  w = *value;
}

void setup() 
{
  Serial.begin();
}

void loop() 
{
  if (Serial.available() > 0) {
    byte serialByte = Serial.read();
    if ((serialByte=='C') || (serialByte=='c')) {
       Serial.println(w, DEC);
    }
  }  
}

//The setSwitchMultilevelValue runs only when a new value comes from the controller by Z-Wave
void setSwitchMultilevelValue(byte newValue) {
  //save new value in a variable
  w = (word)newValue;
}

//The setSwitchMultilevelValue runs only when the controller asks for the current blink rate by Z-Wave
byte getSwitchMultilevelValue(void) {
  //return previously saved value
  return (byte)w;
}
dynamic :

Code: Select all

ZUNO_SETUP_CFGPARAMETER_HANDLER(config_parameter_changed);

word w = 0;

void config_parameter_changed(byte param, word * value)
{
  Serial.println("config_parameter_changed");
  w = *value;
}

void setup() 
{
  ZUNO_START_CONFIG();
  ZUNO_ADD_CHANNEL(ZUNO_SWITCH_MULTILEVEL_CHANNEL_NUMBER,0,0);
  ZUNO_COMMIT_CONFIG();
  
  Serial.begin();
}

void loop() 
{
  if (Serial.available() > 0) {
    byte serialByte = Serial.read();
    if ((serialByte=='C') || (serialByte=='c')) {
       Serial.println(w, DEC);
    }
  }  
}

void zunoCallback(void) 
{
  switch(callback_data.type) {
     case  ZUNO_CHANNEL1_GETTER:
        callback_data.param.bParam = (byte)w;
        break;
     case  ZUNO_CHANNEL1_SETTER:
        w = (word)callback_data.param.bParam;
        break;

      default:
        break;
  }
}
With dynamic code, the config is not always save in eeprom. When I reboot, and when i aks the param with the eedomus box (not by z-uno, i don't place the function zunoLoadCFGParam for keep simple), i have 0.
I excluded / included the z-uno between the two codes to be sure, even it's the same channel.

I have surely make a error, but i don't find where or perhaps the box, but i doubt.

for 3)
I don't use any sensor, I use like you a simple wire connected to the ground. When the wire touch the ground, the response is instantaneous, when the wire release the ground, the response is 1 second.

for 4) Thanks but I don't have any free pin, It's not a problem... but i keep your code under the elbow :D
for 5) Thanks for the function (tested !)

I am french and I am aware that my english is very poor, sorry ;)

Thanks again for your reactivity. What a pleasure !
Eric.
Last edited by Riri on 28 Jun 2018 01:01, edited 3 times in total.
Post Reply