Author Topic: SYNTAX ERROR IN GSD, SERIAL TO DMX 512 CONVERTER  (Read 1169 times)

gonesurfing

  • Veteran
  • ***
  • Posts: 61
    • View Profile
SYNTAX ERROR IN GSD, SERIAL TO DMX 512 CONVERTER
« on: November 24, 2009, 10:12:46 am »
 Hi,
I bought a simple serial to DMX 512 converter and I am have troubles with the ruby and would be grateful if someone could help as I have exhausted my technical abilities which are very basic.  I was copying "GSD to driver weeder I/O WTDIO-M". I modified the AHA to the instructions from Milford Instruments ie channel number channel level [34,127]. Could you please view the error log and point me in the right direction?  If I can get this simple DMX converter working I will post a how to in the wiki.  I am sure there are a lot of better ways to write the driver in ruby but you have to start somewhere and this seemed to be the easiest to follow.  I have deleted the log from child 47 to child 86 as it just repeated.  I did this to cut the size of the post down.
Complete log
Device dmx protocol converter, # 46
  Device Template dmx protocol converter, device category Lighting Interface, manufacturer milford instruments.
  383 lines, displaying from 0 to 383
  1
  05      11/24/09 8:12:50.530            Going to rotate logs... <0xb5effb90>
05      11/24/09 19:27:16.703           Got a reload command from 0  <0xb5effb90>
05      11/24/09 19:27:16.960           void ClientSocket::Disconnect() on this socket: 0x88795a8 (m_Socket: 8) <0xb78538d0>
Return code: 2
2       11/24/09 19:27:16       46 (spawning-device)    Device requests restart... count=1/50 dev=46
Tue Nov 24 19:27:17 EST 2009 Restart
========== NEW LOG SECTION ==========
1       11/24/09 19:27:25       46 (spawning-device)    Starting... 1
1       11/24/09 19:27:25       46 (spawning-device)    Found /usr/pluto/bin/Generic_Serial_Device

05      11/24/09 19:27:25.172           Note: Device manager has attached a device of type 37 that this has no custom event handler for.  It will not fire events. <0xb78dd8d0>
05      11/24/09 19:27:25.172           Note: Device manager has attached a device of type 37 that this has no custom handler for.  This is normal for IR. <0xb78dd8d0>
05      11/24/09 19:27:25.172           Creating child 86 <0xb78dd8d0>
05      11/24/09 19:27:25.172           Note: Device manager has attached a device of type 37 that this has no custom event handler for.  It will not fire events. <0xb78dd8d0>
05      11/24/09 19:27:25.172           Note: Device manager has attached a device of type 37 that this has no custom handler for.  This is normal for IR. <0xb78dd8d0>
RCODE:
   0:require 'Ruby_Generic_Serial_Device'
   1:class Command < Ruby_Generic_Serial_Device::RubyCommandWrapper
   2:end
   3:class Device_46 < Ruby_Generic_Serial_Device::RubySerialIOWrapper
   4:#### 192 ####################################################################
   5:def cmd_192(pk_pipe, pk_device_pipes, cmd=nil)
   6:@returnParamArray.clear
   7:0000 006D 0000 0022 00AC 00AC 0015 0040 0015 0040 0015 0040 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0040 0015 0040 0015 0040 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0040 0015 0015 0015 0015 0015 0040 0015 0040 0015 0015 0015 0015 0015 0040 0015 0015 0015 0040 0015 0040 0015 0015 0015 0015 0015 0040 0015 0040 0015 0015 0015 0689
   8:return @returnParamArray
   9:end
  10:#### 193 ####################################################################
  11:def cmd_193(pk_pipe, cmd=nil)
  12:@returnParamArray.clear
  13:0000 006D 0000 0022 00AC 00AC 0015 0040 0015 0040 0015 0040 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0040 0015 0040 0015 0040 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0040 0015 0040 0015 0015 0015 0015 0015 0040 0015 0040 0015 0040 0015 0040 0015 0015 0015 0015 0015 0040 0015 0040 0015 0015 0015 0689
  14:return @returnParamArray
  15:end
  16:def cmd_ReceiveCommandForChild(cmd)
  17:if cmd.id_==192#192 is on
  18: id=device_.childdevices_[cmd.devidto_].devdata_[12]#get child device number
  19:  if id=="1"
  20:     conn_.send("1,240\r")#channel1 at 95%
  21:    end
  22:  if id=="2"
  23:     conn_.send("2,240\r")#channel2 at 95%
  24:    end
  25:  if id=="3"
  26:     conn_.send("3,240\r")#channel3 at 95%
  27:    end
  28:  if id=="4"
  29:     conn_.send("4,240\r")#channel4 at 95%
  30:    end
  31:  if id=="5"
  32:     conn_.send("5,240\r")#channel5 at 95%
  33:    end
  34:  if id=="6"
  35:     conn_.send("6,240\r")#channel6 at 95%
  36:    end
  37:  if id=="7"
  38:     conn_.send("7,240\r")#channel7 at 95%
  39:    end
  40:  if id=="8"
  41:     conn_.send("8,240\r")#channel8 at 95%
  42:    end
  43:  if id=="9"
  44:     conn_.send("9,240\r")#channel9 at 95%
  45:    end
  46:  if id=="10"
  47:     conn_.send("10,240\r")#channel10 at 95%
  48:    end
  49:  if id=="11"
  50:     conn_.send("11,240\r")#channel11 at 95%
  51:    end
  52:  if id=="12"
  53:     conn_.send("12,240\r")#channel12 at 95%
  54:    end
  55:  if id=="13"
  56:     conn_.send("13,240\r")#channel13 at 95%
  57:    end
  58:  if id=="14"
  59:     conn_.send("14,240\r")#channel14 at 95%
  60:    end
  61:  if id=="15"
  62:     conn_.send("15,240\r")#channel15 at 95%
  63:    end
  64:  if id=="16"
  65:     conn_.send("16,240\r")#channel16 at 95%
  66:    end
  67:  if id=="17"
  68:     conn_.send("17,240\r")#channel17 at 95%
  69:    end
  70:  if id=="18"
  71:     conn_.send("18,240\r")#channel18 at 95%
  72:    end
  73:  if id=="19"
  74:     conn_.send("19,240\r")#channel19 at 95%
  75:    end
  76:  if id=="20"
  77:     conn_.send("20,240\r")#channel20 at 95%
  78:    end
  79:  if id=="21"
  80:     conn_.send("21,240\r")#channel21 at 95%
  81:    end
  82:  if id=="22"
  83:     conn_.send("22,240\r")#channel22 at 95%
  84:    end
  85:  if id=="23"
  86:     conn_.send("23,240\r")#channel23 at 95%
  87:    end
  88:  if id=="24"
  89:     conn_.send("24,240\r")#channel24 at 95%
  90:    end
  91:  if id=="25"
  92:     conn_.send("25,240\r")#channel25 at 95%
  93:    end
  94:  if id=="26"
  95:     conn_.send("26,240\r")#channel26 at 95%
  96:    end
  97:  if id=="27"
  98:     conn_.send("27,240\r")#channel27 at 95%
  99:    end
 100:  if id=="28"
 101:     conn_.send("28,240\r")#channel28 at 95%
 102:    end
 103:  if id=="29"
 104:     conn_.send("29,240\r")#channel29 at 95%
 105:    end
 106:  if id=="30"
 107:     conn_.send("30,240\r")#channel30 at 95%
 108:    end
 109:  if id=="31"
 110:     conn_.send("31,240\r")#channel31 at 95%
 111:    end
 112:  if id=="32"
 113:     conn_.send("32,240\r")#channel32 at 95%
 114:    end
 115:  if id=="33"
 116:     conn_.send("33,240\r")#channel33 at 95%
 117:    end
 118:  if id=="34"
 119:     conn_.send("34,240\r")#channel34 at 95%
 120:    end
 121:  if id=="35"
 122:     conn_.send("35,240\r")#channel35 at 95%
 123:    end
 124:  if id=="36"
 125:     conn_.send("36,240\r")#channel36 at 95%
 126:    end
 127:  if id=="37"
 128:     conn_.send("37,240\r")#channel37 at 95%
 129:    end
 130:end
 131:if cmd.id_==193#193 is off
 132:  id=device_.childdevices_[cmd.devidto_].devdata_[12]
 133:  if id=="1"
 134:     conn_.send("1,0\r")#channel1 off
 135:    end
 136:  if id=="2"
 137:     conn_.send("2,0\r")#channel2 off
 138:    end
 139:  if id=="3"
 140:     conn_.send("3,0\r")#channel3 off
 141:    end
 142:  if id=="4"
 143:     conn_.send("4,0\r")#channel4 off
 144:    end
 145:  if id=="5"
 146:     conn_.send("5,0\r")#channel5 off
 147:    end
 148:  if id=="6"
 149:     conn_.send("6,0\r")#channel6 off
 150:    end
 151:  if id=="7"
 152:     conn_.send("7,0\r")#channel7 off
 153:    end
 154:  if id=="8"
 155:     conn_.send("8,0\r")#channel8 off
 156:    end
 157:  if id=="9"
 158:     conn_.send("9,0\r")#channel9 off
 159:    end
 160:  if id=="10"
 161:     conn_.send("10,0\r")#channel10 off
 162:    end
 163:  if id=="11"
 164:     conn_.send("11,0\r")#channel11 off
 165:    end
 166:  if id=="12"
 167:     conn_.send("12,0\r")#channel12 off
 168:    end
 169:  if id=="13"
 170:     conn_.send("13,0\r")#channel13 off
 171:    end
 172:  if id=="14"
 173:     conn_.send("14,0\r")#channel14 off
 174:    end
 175:  if id=="15"
 176:     conn_.send("15,0\r")#channel15 off
 177:    end
 178:  if id=="16"
 179:     conn_.send("16,0\r")#channel16 off
 180:    end
 181:  if id=="17"
 182:     conn_.send("17,0\r")#channel17 off
 183:    end
 184:  if id=="18"
 185:     conn_.send("18,0\r")#channel18 off
 186:    end
 187:  if id=="19"
 188:     conn_.send("19,0\r")#channel19 off
 189:    end
 190:  if id=="20"
 191:     conn_.send("20,0\r")#channel20 off
 192:    end
 193:  if id=="21"
 194:     conn_.send("21,0\r")#channel21 off
 195:    end
 196:  if id=="22"
 197:     conn_.send("22,0\r")#channel22 off
 198:    end
 199:  if id=="23"
 200:     conn_.send("23,0\r")#channel23 off
 201:    end
 202:  if id=="24"
 203:     conn_.send("24,0\r")#channel24 off
 204:    end
 205:  if id=="25"
 206:     conn_.send("25,0\r")#channel25 off
 207:    end
 208:  if id=="26"
 209:     conn_.send("26,0\r")#channel26 off
 210:    end
 211:  if id=="27"
 212:     conn_.send("27,0\r")#channel27 off
 213:    end
 214:  if id=="28"
 215:     conn_.send("28,0\r")#channel28 off
 216:    end
 217:  if id=="29"
 218:     conn_.send("29,0\r")#channel29 off
 219:    end
 220:  if id=="30"
 221:     conn_.send("30,0\r")#channel30 off
 222:    end
 223:  if id=="31"
 224:     conn_.send("31,0\r")#channel31 off
 225:    end
 226:  if id=="32"
 227:     conn_.send("32,0\r")#channel32 off
 228:    end
 229:  if id=="33"
 230:     conn_.send("33,0\r")#channel33 off
 231:    end
 232:  if id=="34"
 233:     conn_.send("34,0\r")#channel34 off
 234:    end
 235:  if id=="35"
 236:     conn_.send("35,0\r")#channel35 off
 237:    end
 238:  if id=="36"
 239:     conn_.send("36,0\r")#channel36 off
 240:    end
 241:  if id=="37"
 242:     conn_.send("37,0\r")#channel37 off
 243:    end
 244:end
 245:end
 246:#### START SETTERS ####################################################################
 247:def initialize()
 248:super
 249:@returnParamArray=Array.new
 250:end
 251:####  END  SETTERS ####################################################################
 252:end
254:01  11/24/09 19:27:25.242           Failed loading code: Error loading code:
error: (eval):252: compile error
(eval):7: syntax error, unexpected tINTEGER, expecting kEND
0000 006D 0000 0022 00AC 00AC 0015 004...
        ^
(eval):13: syntax error, unexpected tINTEGER, expecting kEND
0000 006D 0000 0022 00AC 00AC 0015 004...
        ^, line: 252
. <0xb56feb90>

hari

  • Administrator
  • LinuxMCE God
  • *****
  • Posts: 2421
    • View Profile
    • ago control
Re: SYNTAX ERROR IN GSD, SERIAL TO DMX 512 CONVERTER
« Reply #1 on: November 24, 2009, 10:00:09 pm »
what are lines 7 and 13 used for? They look like pronto infrared codes or something like that..

br Hari
rock your home - http://www.agocontrol.com home automation

tschak909

  • LinuxMCE God
  • ****
  • Posts: 5499
  • DOES work for LinuxMCE.
    • View Profile
Re: SYNTAX ERROR IN GSD, SERIAL TO DMX 512 CONVERTER
« Reply #2 on: November 25, 2009, 01:42:40 am »
it looks like there was a collision with an existing entry in the ir repository... ugh.

-Thom

darrenmason

  • Addicted
  • *
  • Posts: 529
    • View Profile
Re: SYNTAX ERROR IN GSD, SERIAL TO DMX 512 CONVERTER
« Reply #3 on: November 25, 2009, 02:05:04 am »
What do you need command 192 and 193 to do? Is there commands for the DMX box to turn it on or off?

Start with deleting the code in those for now as that is where your syntax error is.


I think that your receiveCommandForChild can be simplified dramatically.

def cmd_ReceiveCommandForChild(cmd)
  id=device_.childdevices_[cmd.devidto_].devdata_[12]#get child device number
  if cmd.id_==192#192 is on
        conn_.send(id + ",240\r")#set channel ID to 95%
  end
  if cmd.id_==193#193 is off
        conn_.send(id + ",0\r")#set channel ID off
  end
end

gonesurfing

  • Veteran
  • ***
  • Posts: 61
    • View Profile
Re: SYNTAX ERROR IN GSD, SERIAL TO DMX 512 CONVERTER
« Reply #4 on: November 25, 2009, 09:21:20 am »
Hi,
Many thanks for your replies - especially for the heads up on the ruby code.  I knew it could be done but I just didn't know how.  I guess I need to explain a little more about my set-up.  The serial to DMX converter will handle 112 channels of DMX.  I am only currently using 37 channels.  I set-up a template device 46 as a lighting interface.  I then created 37 child device templates which were lighting environment templates light switch on/off which gave me the command 192/193.  I guess I have messed something up with the templates.  My plan now is to delete the templates and reinstall with the amended ruby.  Once again many thanks for your assistance.  Steve

darrenmason

  • Addicted
  • *
  • Posts: 529
    • View Profile
Re: SYNTAX ERROR IN GSD, SERIAL TO DMX 512 CONVERTER
« Reply #5 on: November 25, 2009, 11:44:43 pm »
Hi Steve,

You should only need one device template created - which is for your lighting interface.
Your child devices should just be the light devices that already exist. Basically what you are doing is handling commands for these devices in the interface.
From the looks of your interface it should support dimming commands as well quite easily.

Out of interest what is the converter you are using. I might look at getting one myself for controlling some LED lighting.

Regards
Darren

gonesurfing

  • Veteran
  • ***
  • Posts: 61
    • View Profile
Re: SYNTAX ERROR IN GSD, SERIAL TO DMX 512 CONVERTER
« Reply #6 on: November 26, 2009, 11:11:28 am »
Hi Darren,
Thanks for your help.  I have seen the dimming commands #184 I presume this is the one you are on about.  I understand that you set the level to 50% or in my case with the converter to 127.  However, I do not understand how to programme the ruby to set up and down from the mid point.  I was planning to get a simple on/off working before I looked further into the dimming as ultimately this is where I would like to go. 
I am by no means an expert on LEDs and DMX lighting however I have put a considerable amount of time in research.  When it comes to LED lights I use two types - one is a concealed unit eg a par or a wash light generally they have 150 LEDs and are 50 watts in red, green and blue.  They work great and you use one channel for one colour simply by dimming the channels you end up mixing the colours and the fourth channel to turn on/off.  The second method I use is a DMX decoder which I then attach strip LEDs or ribbons.
I prefer using the SMD LEDs as opposed to the single colour LEDS as if you are running red, green, blue you have to diffuse them because they do not look great if the bulbs are visible.
I have attached a couple of web pages with the suppliers of the converters they also have some other reasonably priced stuff.  The converters are slightly restrictive when setting up your LEDs you would be better off with some sort of control interface.  I like the look of this one and there is also some free software - one of which is a web server which will handle HTTP and has a lot more channels than one of the converters and it can also run as lighting desk on a pc which there is also free software.  But wait it gets even better - there is a partly compatible DIY project I think it needs some programming to finish it off.  I will also include their website and the website where the software is.
If you send me an address I have some spare SMD LEDs, a DMX decoder and a RF decoder.  I also have a half complete DIY kit which I am happy to give to you if you (its not been started ,i have not sourced all the parts,i just dont have the time)

http://www.bpesolutions.com/dmxproduct.html                                                                    #converters
http://www.milinst.com/DMX/dmxtext.htm                                                                            #converters
http://www.doityourselfchristmas.com/forums/forumdisplay.php?f=33                                #diy project + converters+RPMS enttec usb pro compatible dongle
http://www.chromakinetics.com/DMX/                                                                                 #software
thanks steve

darrenmason

  • Addicted
  • *
  • Posts: 529
    • View Profile
Re: SYNTAX ERROR IN GSD, SERIAL TO DMX 512 CONVERTER
« Reply #7 on: November 26, 2009, 11:56:15 pm »
Thanks Steve... will do some reading over the weekend...