@@ -61,7 +61,7 @@ int main(int argc, char* argv[]) {
6161 mySwitch.setPulseLength (300 );
6262 usleep (50000 );
6363 mySwitch.enableTransmit (0 );
64- nPlugs=1024 ;
64+ nPlugs=1280 ;
6565 int nState[nPlugs];
6666 nTimeout=0 ;
6767 memset (nState, 0 , sizeof (nState));
@@ -138,11 +138,11 @@ int main(int argc, char* argv[]) {
138138 /* *
139139 * handle messages
140140 */
141- int nAddr = getAddr (nGroup, nSwitchNumber);
141+ int nAddr = getAddrElro (nGroup, nSwitchNumber);
142142 printf (" nAddr: %i\n " , nAddr);
143143 printf (" nPlugs: %i\n " , nPlugs);
144144 char msg[13 ];
145- if (nAddr > 1023 || nAddr < 1 ) {
145+ if (nAddr > 1023 || nAddr < 0 ) {
146146 printf (" Switch out of range: %s:%d\n " , nGroup, nSwitchNumber);
147147 n = write (newsockfd," 2" ,1 );
148148 }
@@ -193,11 +193,11 @@ int main(int argc, char* argv[]) {
193193 printf (" nGroup: %s\n " , nGroup);
194194 printf (" nSwitchNumber: %i\n " , nSwitchNumber);
195195 printf (" nAction: %i\n " , nAction);
196- int nAddr = getAddr (nGroup, nSwitchNumber);
196+ int nAddr = getAddrInt (nGroup, nSwitchNumber);
197197 printf (" nAddr: %i\n " , nAddr);
198198 printf (" nPlugs: %i\n " , nPlugs);
199199 char msg[13 ];
200- if (nAddr > 16 || nAddr < 1 ) {
200+ if (nAddr > 1279 || nAddr < 1024 ) {
201201 printf (" Switch out of range: %s:%d\n " , nGroup, nSwitchNumber);
202202 n = write (newsockfd," 2" ,1 );
203203 }
@@ -318,9 +318,9 @@ void error(const char *msg) {
318318}
319319
320320/* *
321- * calculate the array address of the power state
321+ * calculate the array address of the power state for elro
322322 */
323- int getAddr (const char * nGroup, int nSwitchNumber) {
323+ int getAddrElro (const char * nGroup, int nSwitchNumber) {
324324 int tempgroup = atoi (nGroup);
325325 int group = 0 ;
326326 for (int i = 0 ; i < 5 ; i++) {
@@ -335,6 +335,13 @@ int getAddr(const char* nGroup, int nSwitchNumber) {
335335 return result;
336336}
337337
338+ /* *
339+ * calculate the array address of the power state for intertechno
340+ */
341+ int getAddrInt (const char * nGroup, int nSwitchNumber) {
342+ return ((atoi (nGroup) - 1 ) * 16 ) + (nSwitchNumber - 1 ) + 1024 ;
343+ }
344+
338345PI_THREAD (switchOn) {
339346 printf (" switchOnThread: %d\n " , nTimeout);
340347 char tGroup[6 ];
0 commit comments