Subversion Repositories HomeAutomation

Rev

Rev 1527 | Rev 1717 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed

Rev 1527 Rev 1701
Line 22... Line 22...
22
   
22
   
23
    static bool aBios=false;        //if commandline says it is a bios update
23
    static bool aBios=false;        //if commandline says it is a bios update
24
    static bool aReset=false;       //if commandline says a reset should be sent before downloading to target
24
    static bool aReset=false;       //if commandline says a reset should be sent before downloading to target
25
    static bool aStart=false;       //if commandline says a start should be sent after downloading to target
25
    static bool aStart=false;       //if commandline says a start should be sent after downloading to target
26
    static bool aTerminal=false;    //if commandline says we should start in interactive mode
26
    static bool aTerminal=false;    //if commandline says we should start in interactive mode
-
 
27
    static bool aDefaultBios=false;     //if commandline says it is a node with hwid 0xffffffff
27
       
28
       
28
    static bool sNodeid=false;      //true when a nodeid has been parsed
29
    static bool sNodeid=false;      //true when a nodeid has been parsed
29
    static bool sHWid=false;        //true when a hardware id has been parsed
30
    static bool sHWid=false;        //true when a hardware id has been parsed
30
    static bool sHexfile=false;     //true when a hexfile has been specified
31
    static bool sHexfile=false;     //true when a hexfile has been specified
31
       
32
       
Line 47... Line 48...
47
            //parse commandline arguments
48
            //parse commandline arguments
48
            CommandLine=new Arguments(args);
49
            CommandLine=new Arguments(args);
49
           
50
           
50
            //check single arguments
51
            //check single arguments
51
            if (CommandLine["b"] == "true") { aBios = true; }
52
            if (CommandLine["b"] == "true") { aBios = true; }
-
 
53
            if (CommandLine["d"] == "true") { aDefaultBios = true; }
52
            if (CommandLine["r"] == "true") { aReset = true; }
54
            if (CommandLine["r"] == "true") { aReset = true; }
53
            if (CommandLine["s"] == "true") { aStart = true; }
55
            if (CommandLine["s"] == "true") { aStart = true; }
54
            if (CommandLine["t"] == "true") { aTerminal = true; }
56
            if (CommandLine["t"] == "true") { aTerminal = true; }
55
           
57
           
56
            //check hexfile argument
58
            //check hexfile argument
Line 106... Line 108...
106
                if (sNodeid) { Console.WriteLine("Nodeaddress: 0x" + String.Format("{0:x2}", nodeid)); }
108
                if (sNodeid) { Console.WriteLine("Nodeaddress: 0x" + String.Format("{0:x2}", nodeid)); }
107
                if (sHWid) { Console.WriteLine("HW id: 0x" + String.Format("{0:x8}", HWid)); }
109
                if (sHWid) { Console.WriteLine("HW id: 0x" + String.Format("{0:x8}", HWid)); }
108
                Console.WriteLine("Host: {0}:{1}", host, port);
110
                Console.WriteLine("Host: {0}:{1}", host, port);
109
                if (hexfile != null) { Console.WriteLine("Hexfile: {0}", hexfile); }
111
                if (hexfile != null) { Console.WriteLine("Hexfile: {0}", hexfile); }
110
                Console.Write("Parameters: ");
112
                Console.Write("Parameters: ");
-
 
113
                if (aDefaultBios) { Console.Write("Default "); }
111
                if (aBios) { Console.Write("Bios "); }
114
                if (aBios) { Console.Write("Bios "); }
112
                if (aReset) { Console.Write("Reset "); }
115
                if (aReset) { Console.Write("Reset "); }
113
                if (aStart) { Console.Write("Start "); }
116
                if (aStart) { Console.Write("Start "); }
114
                if (aTerminal) { Console.Write("Terminal"); }
117
                if (aTerminal) { Console.Write("Terminal"); }
115
                Console.WriteLine("");
118
                Console.WriteLine("");
Line 176... Line 179...
176
                bool autosuccess = true;
179
                bool autosuccess = true;
177
               
180
               
178
                CanNMT cpn = new CanNMT(HWID_INUSE);
181
                CanNMT cpn = new CanNMT(HWID_INUSE);
179
                if (aReset) {
182
                if (aReset) {
180
                    //send a reset command (and wait for feedback)
183
                    //send a reset command (and wait for feedback)
-
 
184
                    if (!aDefaultBios) {
181
                   autosuccess = cpn.doReset(dc, nodeid, HWid);
185
                        autosuccess = cpn.doReset(dc, nodeid, HWid);
-
 
186
                    } else {
-
 
187
                        autosuccess = cpn.doReset(dc, nodeid, 0xffffffff);
-
 
188
                    }
-
 
189
                       
182
 
190
 
183
                    if (!autosuccess) {
191
                    if (!autosuccess) {
184
                        if (DEBUG_LEVEL>0) { Console.WriteLine("Target node did not respond to reset, I quit"); }
192
                        if (DEBUG_LEVEL>0) { Console.WriteLine("Target node did not respond to reset, I quit"); }
185
                    }
193
                    }
186
                }
194
                }
Line 216... Line 224...
216
        Console.WriteLine("  -i <HWid>      Id of target node, hex or decimal.");
224
        Console.WriteLine("  -i <HWid>      Id of target node, hex or decimal.");
217
        Console.WriteLine("  -t             Enter terminal mode.");
225
        Console.WriteLine("  -t             Enter terminal mode.");
218
        Console.WriteLine("  -r             Reset node before loading target.");
226
        Console.WriteLine("  -r             Reset node before loading target.");
219
        Console.WriteLine("  -s             Start node after loading target.");
227
        Console.WriteLine("  -s             Start node after loading target.");
220
        Console.WriteLine("  -b             Program hex as bios, use with caution.");
228
        Console.WriteLine("  -b             Program hex as bios, use with caution.");
-
 
229
        Console.WriteLine("  -d             Program hex as bios, use with caution. Initially uses hwid 0xffffffff.");
221
    }
230
    }
222
   
231
   
223
    static private void printHelp() {
232
    static private void printHelp() {
224
        Console.WriteLine("canDude commands:");
233
        Console.WriteLine("canDude commands:");
225
        Console.WriteLine("load [<hexfile>] - reload hexfile or load new hexfile");
234
        Console.WriteLine("load [<hexfile>] - reload hexfile or load new hexfile");