diff options
| author | Donald Delmar Davis <don@suspectdevices.com> | 2017-10-20 10:46:30 -0700 |
|---|---|---|
| committer | Donald Delmar Davis <don@suspectdevices.com> | 2017-10-20 10:46:30 -0700 |
| commit | 261ac02efc8361ac1e55d9be72cfab1c8ea55237 (patch) | |
| tree | 4fbe0b23659cbd7c5f50c9e10f65d0441e6fee7c /utilities | |
Let's do this
Diffstat (limited to 'utilities')
| -rwxr-xr-x | utilities/genkeys.py | 150 |
1 files changed, 150 insertions, 0 deletions
diff --git a/utilities/genkeys.py b/utilities/genkeys.py new file mode 100755 index 0000000..b157e81 --- /dev/null +++ b/utilities/genkeys.py @@ -0,0 +1,150 @@ +'''--------------------------------------------------------------------------------------genkeys.py + +Create keyword data from a single consistant datasource. + +Note : .....HACK HACK this works but it wasnt designed.... +mykeywords should be reformated so that test and other data can be created from the dictionary. +REPLACED WITH GO BASED GENERATOR. Need to link to repo..... +''' +mykeywords=[\ + "SYN[! ]sync (hello) |sync", + "ACK[ : ]acknowlege(yes) |ack", + "NAK[ : ]negative (no) |nack", + "SWV[ :?]Software Vers. |softwareVersion", + "HWV[ :?]Hardware Vers. |hardwareVersion", + "GIT[ :?]GIT Repo Vers. |gitRepoVersion", + "MEM[ :?]Avaliable Mem. |memory", + "SSN[ :?]Unit Serial No. |serialNumber", + "HLP[ :?]help |help", + "FTL[!: ]Fatal Error |generateFatalError", + "ALT[!: ]Alert |generateAlert", + "WAR[!: ]Warning |generateWarnig", + "INF[!: ]Info |generateInfo", + "DBG[!: ]Debugging Info |generateDebugData", + "LOG[!: ]Log |logData", + "STC[!: ]State Change |setState", + "DVL[!:?]Display Level |setgetDebugLevel", + "LVL[!:?]Log Level |setgetLogLevel", + "RST[! ]Reboot |reset", + "BLD[! ]Reboot to loader|reset", + "STP[!:?]Sim/Chk E-Stop |stop", + "LCS[!:?]Light Curt. Stop|lightCurtain", + "LCR[!: ]Light Curt. Rst |lightCurtainReset", + "NOW[!:?]Time as a int |setgetUnixTime", + "TIM[!:?]Time for humans |setgetTime", + "TS1[ :?]Temp Sensor 1 |temperature", + "TS2[ :?]Temp Sensor 2 |temperature", + "TMP[ :?]Temp Setting |temperature", + "AMT[ :?]Ambient Temp |ambientTemp", + "AMH[ :?]Ambient Humidity|ambientHumidity", + "RED[!: ]Led (0-255) |redLed", + "HSW[!:?]Heaters (ON/OFF)|heater", + "H1S[!:?]Heater 1(ON/OFF)|heater", + "H1V[!:?]Heater 1 (0-255)|heater", + "H1P[!:?]Heater 1 P value|setgetPids", + "H1I[!:?]Heater 1 I value|setgetPids", + "H1D[!:?]Heater 1 D value|setgetPids", + "H2S[!:?]Heater 1(ON/OFF)|heater", + "H2V[!:?]Heater 1 (0-255)|heater", + "H2P[!:?]Heater 2 P value|setgetPids", + "H2I[!:?]Heater 2 I value|setgetPids", + "H2D[!:?]Heater 2 D value|setgetPids", + "PMS[!:?]Pump Sw (ON/OFF)|pump", + "PSP[ :?]Pressure P value|pressure", + "PSI[ :?]Pressure I value|pressure", + "PSD[ :?]Pressure D value|pressure", + "PS1[ :?]Pressure Sensor |pressure", + "MUP[!: ]Manual up |pressure", + "MDN[!: ]Manual down |pressure", + "TMS[!:?]Timer setting |timer", + "TMR[!:?]Timer Run(ON/OF)|timer", + "TRM[ :?]Time Remaining |timer", + "SOL[!:?]Solenoid(ON/OFF)|pump", + "HOM[ :?]Home Switch |home", + "CMD[!:?]Command Mode |command", + "MLD[!:?]Enable Multiline|multiline", + "SOD[!: ]Start Multiline |multiline", + "EOD[!: ]End Multiline |multiline", +] +'''------------------------------------------------------------------------------------------------- + Generate keywords.h file from data. +''' + + +print ''' +/*-------------------------------------------------------------------------------------------------- + * !!!!!!!!!!!!!!!!!!!!!!!! ..... This may or may not be free software ..... !!!!!!!!!!!!!!!!!!!!!!! + * + * This file is autogenerated and while created by and needed for several open source modules the + * vocabulary is specific to the project and the routines referenced will be liscenced on a per + * project basis + *-------------------------------------------------------------------------------------------------- + * + * + * The idea here is to create an automation freindly monitor protocol and debug interface. + * because this needs to be efficient (and flexible) I have chosen a very simple interface + * which will access and may manipulate the devices public variables. + * + * Basic Syntax for the monitor is + * XXX[?!:] <variable stuff> <CR> + * where: + * XXX is a 3 letter command or variable. + * ! execute command or store value + * ? request a value + * : value sent as a response or an update. + * simple example + * (reboot device) + * RST! + * (set red led value) + * RED!255 + * (request pressure sensor, recieve sensor value and unsolicited temperature sensorupdate ) + * PS1? + * PS1:1240.2 + * TS1:150.5 + * + */ +#ifndef keywords_h +#define keywords_h + +#define HELPTEXT \\''' + +for l in mykeywords: + + print '"'+l[:24]+'"\\' +print '"NOP[!: ]Not implemented"' +print +print '\n\n#define KEYWORDS \\' + +col=1 + +for l in mykeywords: + if not col % 13 and col > 0 : + print '"'+l[:3]+'" \\' + else: + print '"'+l[:3]+'" ', + col += 1 + +if not col % 13 and col > 0 : + print '\\' +print '"NOP"' +print + +print 'enum keywordIndex {' + +col=1 + +for l in mykeywords: + if not col % 13 and col > 0 : + print '_'+l[:3]+'_,' + else: + print '_'+l[:3]+'_,', + col += 1 +if not col % 13 and col > 0 : + print +print '_NOP_};' + +print '''// use enum to determine the size of the keyword arrays. +#define NKEYWORDS _NOP_ + 1 + +#endif +''' |
