Subroutine calls not allowed in expressions
MarkCo
Posts: 18
Hi,
I have an issue with one function passing value to a variable.
I get an error that says, "Subroutine calls not allowed in expressions"
Below is my program code:
DEFINE_VARIABLE
INTEGER nFamSittingRoomTempFlash //variable for ac in gf family sitting
FLOAT ActualTemp
FLOAT SetTemp
DEFINE_FUNCTION KNXGet(DEV dvKNX, INTEGER nAmxNr)
{
SEND_COMMAND dvKNX,"'GET=', ITOA(nAmxNr)"
}
DEFINE_PROGRAM
WAIT 55 'TEMPFLASH'
{
ActualTemp = KNXGet (dvNxbKnx, 81) //error is here
SetTemp = KNXGet (dvNxbKnx, 84) //error is here
nFamSittingRoomTempFlash = !nFamSittingRoomTempFlash
IF(nFamSittingRoomTempFlash = 0)
{
SEND_COMMAND aTP,"'^SHO-2,0'"
SEND_COMMAND aTP,"'^SHO-22,0'"
SEND_COMMAND aTP,"'^SHO-1,1'"
SEND_COMMAND aTP,"'^SHO-21,1'"
}
IF(nFamSittingRoomTempFlash = 1)
{
SEND_COMMAND aTP,"'^SHO-1,0'"
SEND_COMMAND aTP,"'^SHO-21,0'"
SEND_COMMAND aTP,"'^SHO-2,1'"
SEND_COMMAND aTP,"'^SHO-22,1'"
}
}
Can someone help me with the solution?
Thank you all!
I have an issue with one function passing value to a variable.
I get an error that says, "Subroutine calls not allowed in expressions"
Below is my program code:
DEFINE_VARIABLE
INTEGER nFamSittingRoomTempFlash //variable for ac in gf family sitting
FLOAT ActualTemp
FLOAT SetTemp
DEFINE_FUNCTION KNXGet(DEV dvKNX, INTEGER nAmxNr)
{
SEND_COMMAND dvKNX,"'GET=', ITOA(nAmxNr)"
}
DEFINE_PROGRAM
WAIT 55 'TEMPFLASH'
{
ActualTemp = KNXGet (dvNxbKnx, 81) //error is here
SetTemp = KNXGet (dvNxbKnx, 84) //error is here
nFamSittingRoomTempFlash = !nFamSittingRoomTempFlash
IF(nFamSittingRoomTempFlash = 0)
{
SEND_COMMAND aTP,"'^SHO-2,0'"
SEND_COMMAND aTP,"'^SHO-22,0'"
SEND_COMMAND aTP,"'^SHO-1,1'"
SEND_COMMAND aTP,"'^SHO-21,1'"
}
IF(nFamSittingRoomTempFlash = 1)
{
SEND_COMMAND aTP,"'^SHO-1,0'"
SEND_COMMAND aTP,"'^SHO-21,0'"
SEND_COMMAND aTP,"'^SHO-2,1'"
SEND_COMMAND aTP,"'^SHO-22,1'"
}
}
Can someone help me with the solution?
Thank you all!
0
Comments
does not return anything: it lacks of return type in signature and a return statement.
Also, I/O in NetLinx is asynchronous, so simply returning that send_command from your GetKNX(..) function will not give you the behaviour that you are looking for.
To capture the response from a send_command you will need to use a data_event with a command handler.
You have helped a lot