Rotation type not working?

Discussion about Z-Uno product. Visit http://z-uno.z-wave.me for more details.
Post Reply
janjoh
Posts: 35
Joined: 23 Oct 2016 16:57

Rotation type not working?

Post by janjoh »

The following sketch compiles

Code: Select all

#include "ZUNO_DS18B20.h"


#define FAN1_PWM_PIN 13
#define FAN1_ENABLE_PIN 26
s_pin FAN1_TACH_PIN = 9;

#define FAN2_PWM_PIN 22
#define FAN2_ENABLE_PIN 27
s_pin FAN2_TACH_PIN = 10;

#define MOSFET1_PWM_PIN 20

#define ONE_WIRE1_PIN 11
#define ONE_WIRE2_PIN 12

ZUNO_SETUP_CHANNELS(
        ZUNO_SWITCH_MULTILEVEL(fan1pwmgetter, fan1pwmsetter),
        
        ZUNO_SENSOR_MULTILEVEL(ZUNO_SENSOR_MULTILEVEL_TYPE_TEMPERATURE, SENSOR_MULTILEVEL_SCALE_CELSIUS, SENSOR_MULTILEVEL_SIZE_TWO_BYTES, SENSOR_MULTILEVEL_PRECISION_TWO_DECIMALS, temp1getter)
        
);


void setup() {

}
void loop() {

}

word temp1getter() {
  // NoOp
}

// Fan 1
word fan1tachgetter() {
  // NoOp
}
word fan1pwmgetter() {
  // NoOp
}
word fan1pwmsetter() {
  // NoOp
}

But adding ONE line with a rotation sensor, it does not compile.

Code: Select all

#include "ZUNO_DS18B20.h"


#define FAN1_PWM_PIN 13
#define FAN1_ENABLE_PIN 26
s_pin FAN1_TACH_PIN = 9;

#define FAN2_PWM_PIN 22
#define FAN2_ENABLE_PIN 27
s_pin FAN2_TACH_PIN = 10;

#define MOSFET1_PWM_PIN 20

#define ONE_WIRE1_PIN 11
#define ONE_WIRE2_PIN 12

ZUNO_SETUP_CHANNELS(
        ZUNO_SWITCH_MULTILEVEL(fan1pwmgetter, fan1pwmsetter),
        ZUNO_SENSOR_MULTILEVEL_TYPE_ROTATION(fan1tachgetter),
        ZUNO_SENSOR_MULTILEVEL(ZUNO_SENSOR_MULTILEVEL_TYPE_TEMPERATURE, SENSOR_MULTILEVEL_SCALE_CELSIUS, SENSOR_MULTILEVEL_SIZE_TWO_BYTES, SENSOR_MULTILEVEL_PRECISION_TWO_DECIMALS, temp1getter)
        
);


void setup() {

}
void loop() {

}

word temp1getter() {
  // NoOp
}

word fan1tachgetter() {
  // NoOp
}
word fan1pwmgetter() {
  // NoOp
}
word fan1pwmsetter() {
  // NoOp
}
Using library ZUNO_DS18B20 in folder: C:\Users\j2\AppData\Roaming\Arduino15\packages\Z-Uno\hardware\zw8051\2.0.8\libraries\ZUNO_DS18B20 (legacy)

C:\Users\j2\AppData\Roaming\Arduino15\packages\Z-Uno\tools\zuno_toolchain\00.08.30/zuno_toolchain/compiler build C:\Users\j2\AppData\Local\Temp\build8887622240629786535.tmp/TVBankController.cpp -r C:\Users\j2\AppData\Roaming\Arduino15\packages\Z-Uno\hardware\zw8051\2.0.8

************* Building Arduino Sketch *************
C:\Users\j2\AppData\Local\Temp\build8887622240629786535.tmp/TVBankController.cpp
***************************************************

Preprocessing file: C:\Users\j2\AppData\Local\Temp\build8887622240629786535.tmp\Print.cpp with SDCPP...
Compiling C:\Users\j2\AppData\Local\Temp\build8887622240629786535.tmp\Print_sdcpp_.cpp ...
Preprocessing file: C:\Users\j2\AppData\Local\Temp\build8887622240629786535.tmp\Stream.cpp with SDCPP...
Compiling C:\Users\j2\AppData\Local\Temp\build8887622240629786535.tmp\Stream_sdcpp_.cpp ...
Preprocessing file: C:\Users\j2\AppData\Local\Temp\build8887622240629786535.tmp\HardwareSerial.cpp with SDCPP...
Compiling C:\Users\j2\AppData\Local\Temp\build8887622240629786535.tmp\HardwareSerial_sdcpp_.cpp ...
Preprocessing file: C:\Users\j2\AppData\Local\Temp\build8887622240629786535.tmp\HLCore.cpp with SDCPP...
Compiling C:\Users\j2\AppData\Local\Temp\build8887622240629786535.tmp\HLCore_sdcpp_.cpp ...
Preprocessing file: C:\Users\j2\AppData\Local\Temp\build8887622240629786535.tmp\ZUNO_OneWire.cpp with SDCPP...
Compiling C:\Users\j2\AppData\Local\Temp\build8887622240629786535.tmp\ZUNO_OneWire_sdcpp_.cpp ...
Preprocessing file: C:\Users\j2\AppData\Local\Temp\build8887622240629786535.tmp\ZUNO_DS18B20.cpp with SDCPP...
Compiling C:\Users\j2\AppData\Local\Temp\build8887622240629786535.tmp\ZUNO_DS18B20_sdcpp_.cpp ...
Preprocessing file: C:\Users\j2\AppData\Local\Temp\build8887622240629786535.tmp\_TVBankController.cpp with SDCPP...
Compiling C:\Users\j2\AppData\Local\Temp\build8887622240629786535.tmp\_TVBankController_sdcpp_.cpp ...
TVBankController.ino:34:1:warning:control reaches end of non-void function
TVBankController.ino:38:1:warning:control reaches end of non-void function
TVBankController.ino:41:1:warning:control reaches end of non-void function
TVBankController.ino:44:1:warning:control reaches end of non-void function
Preprocessing file: C:\Users\j2\AppData\Local\Temp\build8887622240629786535.tmp\Print.cpp with SDCPP...
Compiling C:\Users\j2\AppData\Local\Temp\build8887622240629786535.tmp\Print_sdcpp_.cpp ...
Preprocessing file: C:\Users\j2\AppData\Local\Temp\build8887622240629786535.tmp\Stream.cpp with SDCPP...
Compiling C:\Users\j2\AppData\Local\Temp\build8887622240629786535.tmp\Stream_sdcpp_.cpp ...
Preprocessing file: C:\Users\j2\AppData\Local\Temp\build8887622240629786535.tmp\HardwareSerial.cpp with SDCPP...
Compiling C:\Users\j2\AppData\Local\Temp\build8887622240629786535.tmp\HardwareSerial_sdcpp_.cpp ...
Preprocessing file: C:\Users\j2\AppData\Local\Temp\build8887622240629786535.tmp\HLCore.cpp with SDCPP...
Compiling C:\Users\j2\AppData\Local\Temp\build8887622240629786535.tmp\HLCore_sdcpp_.cpp ...
Preprocessing file: C:\Users\j2\AppData\Local\Temp\build8887622240629786535.tmp\ZUNO_OneWire.cpp with SDCPP...
Compiling C:\Users\j2\AppData\Local\Temp\build8887622240629786535.tmp\ZUNO_OneWire_sdcpp_.cpp ...
Preprocessing file: C:\Users\j2\AppData\Local\Temp\build8887622240629786535.tmp\ZUNO_DS18B20.cpp with SDCPP...
Compiling C:\Users\j2\AppData\Local\Temp\build8887622240629786535.tmp\ZUNO_DS18B20_sdcpp_.cpp ...
Preprocessing file: C:\Users\j2\AppData\Local\Temp\build8887622240629786535.tmp\_TVBankController.cpp with SDCPP...
Compiling C:\Users\j2\AppData\Local\Temp\build8887622240629786535.tmp\_TVBankController_sdcpp_.cpp ...
TVBankController.ino:34:1:warning:control reaches end of non-void function
TVBankController.ino:38:1:warning:control reaches end of non-void function
TVBankController.ino:41:1:warning:control reaches end of non-void function
TVBankController.ino:44:1:warning:control reaches end of non-void functionCompiling file "C:\Users\j2\AppData\Local\Temp\build8887622240629786535.tmp\LLCore_arduino.c" by means of SDCC...
sdcc: Calling preprocessor...
sdcc: sdcpp.exe -nostdinc -Wall -obj-ext=.rel -D__SDCC_STACK_AUTO -D__SDCC_MODEL_LARGE -D__SDCC_INT_LONG_REENT -D__SDCC_FLOAT_REENT -D__SDCC=3_5_0 -DSDCC=350 -D__SDCC_REVISION=9253 -D__SDCC_mcs51 -D__STDC_NO_COMPLEX__ -D__STDC_NO_THREADS__ -D__STDC_NO_ATOMICS__ -D__STDC_NO_VLA__ -isystem "C:\Users\j2\AppData\Roaming\ARDUIN~1\packages\Z-Uno\tools\ZUNO_T~1\0008~1.30\ZUNO_T~1/sdcc/\bin\..\include\mcs51" -isystem "C:\Users\j2\AppData\Roaming\ARDUIN~1\packages\Z-Uno\tools\ZUNO_T~1\0008~1.30\ZUNO_T~1/sdcc/\bin\..\include" "C:\Users\j2\AppData\Local\Temp\build8887622240629786535.tmp\LLCore_arduino.c"
sdcc: Generating code...
C:\Users\j2\AppData\Local\Temp\build8887622240629786535.tmp\LLCore_arduino.c:44: warning 85: in function NOPS unreferenced function argument : 'i'
C:\Users\j2\AppData\Local\Temp\build8887622240629786535.tmp\LLCore_arduino.c:256: warning 85: in function delayLoops unreferenced function argument : 'v'
C:\Users\j2\AppData\Local\Temp\build8887622240629786535.tmp\/Custom.h:23: error 12: called object is not a function
C:\Users\j2\AppData\Local\Temp\build8887622240629786535.tmp\/Custom.h:23: error 69: struct/union/array 'zunoChannelSetupArray': initialization needs curly braces
Error. SDCC returned: 1

Error compiling.
janjoh
Posts: 35
Joined: 23 Oct 2016 16:57

Re: Rotation type not working?

Post by janjoh »

I ahve also tried

ZUNO_SENSOR_MULTILEVEL(ZUNO_SENSOR_MULTILEVEL_TYPE_ROTATION, fan1tachgetter),

Which gives the below error. What is the proper way to define a rpm sensor?

Using library ZUNO_DS18B20 in folder: C:\Users\j2\AppData\Roaming\Arduino15\packages\Z-Uno\hardware\zw8051\2.0.8\libraries\ZUNO_DS18B20 (legacy)

C:\Users\j2\AppData\Roaming\Arduino15\packages\Z-Uno\tools\zuno_toolchain\00.08.30/zuno_toolchain/compiler build C:\Users\j2\AppData\Local\Temp\build8887622240629786535.tmp/TVBankController.cpp -r C:\Users\j2\AppData\Roaming\Arduino15\packages\Z-Uno\hardware\zw8051\2.0.8

************* Building Arduino Sketch *************
C:\Users\j2\AppData\Local\Temp\build8887622240629786535.tmp/TVBankController.cpp
***************************************************

Preprocessing file: C:\Users\j2\AppData\Local\Temp\build8887622240629786535.tmp\Print.cpp with SDCPP...
Compiling C:\Users\j2\AppData\Local\Temp\build8887622240629786535.tmp\Print_sdcpp_.cpp ...
Preprocessing file: C:\Users\j2\AppData\Local\Temp\build8887622240629786535.tmp\Stream.cpp with SDCPP...
Compiling C:\Users\j2\AppData\Local\Temp\build8887622240629786535.tmp\Stream_sdcpp_.cpp ...
Preprocessing file: C:\Users\j2\AppData\Local\Temp\build8887622240629786535.tmp\HardwareSerial.cpp with SDCPP...
Compiling C:\Users\j2\AppData\Local\Temp\build8887622240629786535.tmp\HardwareSerial_sdcpp_.cpp ...
Preprocessing file: C:\Users\j2\AppData\Local\Temp\build8887622240629786535.tmp\HLCore.cpp with SDCPP...
Compiling C:\Users\j2\AppData\Local\Temp\build8887622240629786535.tmp\HLCore_sdcpp_.cpp ...
Preprocessing file: C:\Users\j2\AppData\Local\Temp\build8887622240629786535.tmp\ZUNO_OneWire.cpp with SDCPP...
Compiling C:\Users\j2\AppData\Local\Temp\build8887622240629786535.tmp\ZUNO_OneWire_sdcpp_.cpp ...
Preprocessing file: C:\Users\j2\AppData\Local\Temp\build8887622240629786535.tmp\ZUNO_DS18B20.cpp with SDCPP...
Compiling C:\Users\j2\AppData\Local\Temp\build8887622240629786535.tmp\ZUNO_DS18B20_sdcpp_.cpp ...
Preprocessing file: C:\Users\j2\AppData\Local\Temp\build8887622240629786535.tmp\_TVBankController.cpp with SDCPP...
Compiling C:\Users\j2\AppData\Local\Temp\build8887622240629786535.tmp\_TVBankController_sdcpp_.cpp ...
TVBankController.ino:34:1:warning:control reaches end of non-void function
TVBankController.ino:38:1:warning:control reaches end of non-void function
TVBankController.ino:41:1:warning:control reaches end of non-void function
TVBankController.ino:44:1:warning:control reaches end of non-void function
Preprocessing file: C:\Users\j2\AppData\Local\Temp\build8887622240629786535.tmp\Print.cpp with SDCPP...
Compiling C:\Users\j2\AppData\Local\Temp\build8887622240629786535.tmp\Print_sdcpp_.cpp ...
Preprocessing file: C:\Users\j2\AppData\Local\Temp\build8887622240629786535.tmp\Stream.cpp with SDCPP...
Compiling C:\Users\j2\AppData\Local\Temp\build8887622240629786535.tmp\Stream_sdcpp_.cpp ...
Preprocessing file: C:\Users\j2\AppData\Local\Temp\build8887622240629786535.tmp\HardwareSerial.cpp with SDCPP...
Compiling C:\Users\j2\AppData\Local\Temp\build8887622240629786535.tmp\HardwareSerial_sdcpp_.cpp ...
Preprocessing file: C:\Users\j2\AppData\Local\Temp\build8887622240629786535.tmp\HLCore.cpp with SDCPP...
Compiling C:\Users\j2\AppData\Local\Temp\build8887622240629786535.tmp\HLCore_sdcpp_.cpp ...
Preprocessing file: C:\Users\j2\AppData\Local\Temp\build8887622240629786535.tmp\ZUNO_OneWire.cpp with SDCPP...
Compiling C:\Users\j2\AppData\Local\Temp\build8887622240629786535.tmp\ZUNO_OneWire_sdcpp_.cpp ...
Preprocessing file: C:\Users\j2\AppData\Local\Temp\build8887622240629786535.tmp\ZUNO_DS18B20.cpp with SDCPP...
Compiling C:\Users\j2\AppData\Local\Temp\build8887622240629786535.tmp\ZUNO_DS18B20_sdcpp_.cpp ...
Preprocessing file: C:\Users\j2\AppData\Local\Temp\build8887622240629786535.tmp\_TVBankController.cpp with SDCPP...
Compiling C:\Users\j2\AppData\Local\Temp\build8887622240629786535.tmp\_TVBankController_sdcpp_.cpp ...
TVBankController.ino:34:1:warning:control reaches end of non-void function
TVBankController.ino:38:1:warning:control reaches end of non-void function
TVBankController.ino:41:1:warning:control reaches end of non-void function
TVBankController.ino:44:1:warning:control reaches end of non-void functionCompiling file "C:\Users\j2\AppData\Local\Temp\build8887622240629786535.tmp\LLCore_arduino.c" by means of SDCC...
In file included from C:\Users\j2\AppData\Local\Temp\build8887622240629786535.tmp\LLCore_arduino.c:27:
C:\Users\j2\AppData\Local\Temp\build8887622240629786535.tmp\/Custom.h:23:373: error: macro "ZUNO_SENSOR_MULTILEVEL" requires 5 arguments, but only 2 given
sdcc: Calling preprocessor...
sdcc: sdcpp.exe -nostdinc -Wall -obj-ext=.rel -D__SDCC_STACK_AUTO -D__SDCC_MODEL_LARGE -D__SDCC_INT_LONG_REENT -D__SDCC_FLOAT_REENT -D__SDCC=3_5_0 -DSDCC=350 -D__SDCC_REVISION=9253 -D__SDCC_mcs51 -D__STDC_NO_COMPLEX__ -D__STDC_NO_THREADS__ -D__STDC_NO_ATOMICS__ -D__STDC_NO_VLA__ -isystem "C:\Users\j2\AppData\Roaming\ARDUIN~1\packages\Z-Uno\tools\ZUNO_T~1\0008~1.30\ZUNO_T~1/sdcc/\bin\..\include\mcs51" -isystem "C:\Users\j2\AppData\Roaming\ARDUIN~1\packages\Z-Uno\tools\ZUNO_T~1\0008~1.30\ZUNO_T~1/sdcc/\bin\..\include" "C:\Users\j2\AppData\Local\Temp\build8887622240629786535.tmp\LLCore_arduino.c"
sdcc: Generating code...
C:\Users\j2\AppData\Local\Temp\build8887622240629786535.tmp\LLCore_arduino.c:44: warning 85: in function NOPS unreferenced function argument : 'i'
C:\Users\j2\AppData\Local\Temp\build8887622240629786535.tmp\LLCore_arduino.c:256: warning 85: in function delayLoops unreferenced function argument : 'v'
Error. SDCC returned: 1

Error compiling.
janjoh
Posts: 35
Joined: 23 Oct 2016 16:57

Re: Rotation type not working?

Post by janjoh »

Ok, this seem to work

Code: Select all

#include "ZUNO_DS18B20.h"


#define FAN1_PWM_PIN 13
#define FAN1_ENABLE_PIN 26
s_pin FAN1_TACH_PIN = 9;

#define FAN2_PWM_PIN 22
#define FAN2_ENABLE_PIN 27
s_pin FAN2_TACH_PIN = 10;

#define MOSFET1_PWM_PIN 20

#define ONE_WIRE1_PIN 11
#define ONE_WIRE2_PIN 12
// Debug
ZUNO_SETUP_DEBUG_MODE(DEBUG_ON);

ZUNO_SETUP_CHANNELS(
        ZUNO_SWITCH_MULTILEVEL(fan1pwmgetter, fan1pwmsetter),
        ZUNO_SENSOR_MULTILEVEL_ROTATION(fan1tachgetter),
        ZUNO_SENSOR_MULTILEVEL_TEMPERATURE(temp1getter),
        ZUNO_SWITCH_MULTILEVEL(fan2pwmgetter, fan2pwmsetter),
        ZUNO_SENSOR_MULTILEVEL_ROTATION(fan2tachgetter),
        ZUNO_SENSOR_MULTILEVEL_TEMPERATURE(temp2getter), 
        ZUNO_SWITCH_MULTILEVEL(mosfet1pwmgetter, mosfet1pwmsetter)
        
);


void setup() {

}
void loop() {

}

word temp1getter() {
  // NoOp
}

word fan1tachgetter() {
  // NoOp
}
word fan1pwmgetter() {
  // NoOp
}
word fan1pwmsetter() {
  // NoOp
}

word temp2getter() {
  // NoOp
}

word fan2tachgetter() {
  // NoOp
}
word fan2pwmgetter() {
  // NoOp
}
word fan2pwmsetter() {
  // NoOp
}

word mosfet1pwmgetter() {
  // NoOp
}
word mosfet1pwmsetter() {
  // NoOp
}
User avatar
PoltoS
Posts: 7601
Joined: 26 Jan 2011 19:36

Re: Rotation type not working?

Post by PoltoS »

Correct. Now you need to fix pin numbers and it will finally work
janjoh
Posts: 35
Joined: 23 Oct 2016 16:57

Re: Rotation type not working?

Post by janjoh »

PoltoS wrote:Correct. Now you need to fix pin numbers and it will finally work

Uhm.. What is wrong with the pin numbers?
User avatar
PoltoS
Posts: 7601
Joined: 26 Jan 2011 19:36

Re: Rotation type not working?

Post by PoltoS »

Z-Uno have only 0-25 pins ;) There is no pin 26!
janjoh
Posts: 35
Joined: 23 Oct 2016 16:57

Re: Rotation type not working?

Post by janjoh »

PoltoS wrote:Z-Uno have only 0-25 pins ;) There is no pin 26!
Yeah.. i figured out i had entered the physical pin numbers and not the logical ones.
Post Reply