-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathTSet.cmd
567 lines (470 loc) · 9.55 KB
/
TSet.cmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
@echo off
title TSET Board Builder
rem model
rem menu.usb=USB Type
rem menu.speed=CPU Speed
rem menu.opt=Optimize
rem menu.keys=Keyboard Layout
REM echo %1 %2
goto StartUp
:StartUp
Echo ============================================= MODEL
Echo 1 :: LC
Echo 2 :: 3.2/3.1
Echo 3 :: 3.5
Echo 4 :: 3.6
Echo 5 :: 3.0
Echo 6 :: 4.0
Echo 7 :: 4.1
Echo 8 :: T.MM
Echo q :: quit
Echo.
Choice /C 12345678q /M "Which Teensy"
If Errorlevel 9 Goto TsetQuit
If Errorlevel 8 Goto TMM
If Errorlevel 7 Goto T41
If Errorlevel 6 Goto T40
If Errorlevel 5 Goto T30
If Errorlevel 4 Goto T36
If Errorlevel 3 Goto T35
If Errorlevel 2 Goto T32
If Errorlevel 1 Goto TLC
Echo
:GetSpeed
Echo ============================================= Speed
Echo 1 :: 96 Mhz
Echo 2 :: 120 Mhz
Echo 3 :: 144 Mhz
Echo 4 :: 168 Mhz
Echo 5 :: 180 Mhz [3.6]
Echo 6 :: 192 Mhz [3.6 OC]
Echo 7 :: 216 Mhz [3.6 OC]
Echo 8 :: 240 Mhz [3.6 OC]
Echo 9 :: 256 Mhz [3.6 OC]
Echo a :: 2 Mhz
Echo b :: 16 Mhz
Echo c :: 24 Mhz
Echo d :: 48 Mhz
Echo e :: 72 Mhz
Echo.
Choice /C 123456789abcde /M "What Speed"
If Errorlevel 15 Goto S15
If Errorlevel 14 Goto S14
If Errorlevel 13 Goto S13
If Errorlevel 12 Goto S12
If Errorlevel 11 Goto S11
If Errorlevel 10 Goto S10
If Errorlevel 9 Goto S9
If Errorlevel 8 Goto S8
If Errorlevel 7 Goto S7
If Errorlevel 6 Goto S6
If Errorlevel 5 Goto S5
If Errorlevel 4 Goto S4
If Errorlevel 3 Goto S3
If Errorlevel 2 Goto S2
If Errorlevel 1 Goto S1
:GetSpeedT4
Echo ============================================= Speed
Echo 1 :: 600 Mhz
Echo 2 :: 528 Mhz
Echo 3 :: 396 Mhz
Echo 4 :: 24 Mhz
Echo 5 :: 720 Mhz (OC)
Echo 6 :: 816 Mhz (OC)
Echo 7 :: 912 Mhz (cooling reqd)
Echo 8 :: 960 Mhz (cooling reqd)
Echo 9 :: 1008 Mhz (cooling reqd)
Echo.
Choice /C 123456789 /M "What Speed"
If Errorlevel 9 Goto TS9
If Errorlevel 8 Goto TS8
If Errorlevel 7 Goto TS7
If Errorlevel 6 Goto TS6
If Errorlevel 5 Goto TS5
If Errorlevel 4 Goto TS4
If Errorlevel 3 Goto TS3
If Errorlevel 2 Goto TS2
If Errorlevel 1 Goto TS1
:GetSpeedLC
Echo ============================================= Speed
Echo c :: 24 Mhz
Echo d :: 48 Mhz
Echo.
Choice /C cd /M "What Speed"
If Errorlevel 2 Goto S13
If Errorlevel 1 Goto S12
:GetOpt
Echo ============================================= OPTIMIZE
Echo 1 :: Faster
Echo 2 :: Faster with LTO
Echo 3 :: Fast
Echo 4 :: Fast with LTO
Echo 5 :: Fastest
Echo 6 :: Fastest + pure-code [3.2+]
Echo 7 :: Fastest with LTO
Echo 8 :: Fastest + pure-code with LTO [3.2+]
Echo 9 :: Debug
Echo a :: Debug with LTO
Echo b :: Smallest Code
Echo c :: Smallest Code with LTO
Echo.
Choice /C 123456789abc /M "Optimize Level"
if Errorlevel 12 Goto O12
If Errorlevel 11 Goto O11
If Errorlevel 10 Goto O10
If Errorlevel 9 Goto O9
If Errorlevel 8 Goto O8
If Errorlevel 7 Goto O7
If Errorlevel 6 Goto O6
If Errorlevel 5 Goto O5
If Errorlevel 4 Goto O4
If Errorlevel 3 Goto O3
If Errorlevel 2 Goto O2
If Errorlevel 1 Goto O1
:GetUSB
Echo ============================================= USB
Echo 1 :: serial
Echo 2 :: keyboard
Echo 3 :: touch
Echo 4 :: hidtouch
Echo 5 :: hid
Echo 6 :: serialhid
Echo 7 :: midi
Echo 8 :: midi4
Echo 9 :: midi16
Echo a :: serialmidi
Echo b :: serialmidi4
Echo c :: serialmidi16
Echo d :: audio
Echo e :: serialmidiaudio
Echo f :: serialmidi16audio
Echo g :: mtp
Echo h :: rawhid
Echo i :: flightsim
Echo j :: flightsimjoystick
Echo k :: everything
Echo l :: disable
Echo m :: Dual Serial
Echo n :: Triple Serial
Echo o :: mtpserial
Echo r :: rawhid512
Echo.
Choice /C 123456789abcdefghijklmnor /M "What USB"
If Errorlevel 25 Goto U25
If Errorlevel 24 Goto U24
If Errorlevel 23 Goto U23
If Errorlevel 22 Goto U22
If Errorlevel 21 Goto U21
If Errorlevel 20 Goto U20
If Errorlevel 19 Goto U19
If Errorlevel 18 Goto U18
If Errorlevel 17 Goto U17
If Errorlevel 16 Goto U16
If Errorlevel 15 Goto U15
If Errorlevel 14 Goto U14
If Errorlevel 13 Goto U13
If Errorlevel 12 Goto U12
If Errorlevel 11 Goto U11
If Errorlevel 10 Goto U10
If Errorlevel 9 Goto U9
If Errorlevel 8 Goto U8
If Errorlevel 7 Goto U7
If Errorlevel 6 Goto U6
If Errorlevel 5 Goto U5
If Errorlevel 4 Goto U4
If Errorlevel 3 Goto U3
If Errorlevel 2 Goto U2
If Errorlevel 1 Goto U1
REM >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> MODEL
:TMM
set model=teensyMM
goto GetSpeedT4
:T41
set model=teensy41
goto GetSpeedT4
:T40
set model=teensy40
goto GetSpeedT4
:T30
set model=teensy30
goto GetSpeed
:T36
set model=teensy36
goto GetSpeed
:T35
set model=teensy35
goto GetSpeed
:T32
set model=teensy31
goto GetSpeed
:TLC
set model=teensyLC
set gtv=LC
goto GetSpeed%gtv%
REM >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> MODEL
REM >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> SPEED
:S14
set speed=72
goto GetOpt
:S13
set speed=48
goto GetOpt
:S12
set speed=24
goto GetOpt
:S11
set speed=16
goto GetOpt
:S10
set speed=2
goto GetOpt
:S9
set speed=256
goto GetOpt
:S8
set speed=240
goto GetOpt
:S7
set speed=216
goto GetOpt
:S6
set speed=192
goto GetOpt
:S5
set speed=180
goto GetOpt
:S4
set speed=168
goto GetOpt
:S3
set speed=144
goto GetOpt
:S2
set speed=120
goto GetOpt
:S1
set speed=96
goto GetOpt
REM >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> SPEED T4
:TS9
set speed=1008
goto GetOpt
:TS8
set speed=960
goto GetOpt
:TS7
set speed=912
goto GetOpt
:TS6
set speed=816
goto GetOpt
:TS5
set speed=720
goto GetOpt
:TS4
set speed=24
goto GetOpt
:TS3
set speed=396
goto GetOpt
:TS2
set speed=528
goto GetOpt
:TS1
set speed=600
goto GetOpt
REM >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> SPEED T4
REM >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> OPTIMIZE
:O12
set opt=oslto
goto GetUSB
:O11
set opt=osstd
goto GetUSB
:O10
set opt=oglto
goto GetUSB
:O9
set opt=ogstd
goto GetUSB
:O8
set opt=o3purelto
goto GetUSB
:O7
set opt=o3lto
goto GetUSB
:O6
set opt=o3purestd
goto GetUSB
:O5
set opt=o3std
goto GetUSB
:O4
set opt=o1lto
goto GetUSB
:O3
set opt=o1std
goto GetUSB
:O2
set opt=o2lto
goto GetUSB
:O1
set opt=o2std
goto GetUSB
REM >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> OPTIMIZE
REM >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> USB
:U25
set usb=rawhid512
goto BeDone
:U24
set usb=mtpserial
goto BeDone
:U23
set usb=serial3
goto BeDone
:U22
set usb=serial2
goto BeDone
:U21
set usb=disable
goto BeDone
:U20
set usb=everything
goto BeDone
:U19
set usb=flightsimjoystick
goto BeDone
:U18
set usb=flightsim
goto BeDone
:U17
set usb=rawhid
goto BeDone
:U16
set usb=mtp
goto BeDone
:U15
set usb=serialmidi16audio
goto BeDone
:U14
set usb=serialmidiaudio
goto BeDone
:U13
set usb=audio
goto BeDone
:U12
set usb=serialmidi16
goto BeDone
:U11
set usb=serialmidi4
goto BeDone
:U10
set usb=serialmidi
goto BeDone
:U9
set usb=midi16
goto BeDone
:U8
set usb=midi4
goto BeDone
:U7
set usb=midi
goto BeDone
:U6
set usb=serialhid
goto BeDone
:U5
set usb=hid
goto BeDone
:U4
set usb=hidtouch
goto BeDone
:U3
set usb=touch
goto BeDone
:U2
set usb=keyboard
goto BeDone
:U1
set usb=serial
goto BeDone
REM >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> USB
:BeDone
set BuildUp=cd.
Echo ============================================= Tools Selections
ECHO MODEL :: %model%
ECHO SPEED :: %speed%
ECHO OPTIMIZE :: %opt%
rem echo on
ECHO USB :: %usb%
ECHO Sketch :: %1
set sketchcmd=~
IF EXIST %1 set sketchcmd=%1
REM IF /I "%2" NEQ "ino" set sketchcmd=~
IF "~" NEQ "%sketchcmd%" ECHO SKETCH :: %1
Echo ============================================= CONFIRM
Echo Y :: Yes :: Accept and save to %cd%\Compile.cmd
Echo N :: No :: RESTART
Echo S :: Save to %cd%\%model%
Echo x :: Exit now without writing
Echo D :: yes with DEBUG GDB and save to %cd%\Compile.cmd
Echo T :: yes with Upload by TeensyLoader not TyComm
Echo.
Choice /C YNSxDT /M "Accept"
If Errorlevel 6 Goto DoneNowTeensy
If Errorlevel 5 Goto DoneNowGDB
If Errorlevel 4 Goto TsetQuit
If Errorlevel 3 Goto DoDir
If Errorlevel 2 Goto StartUp
If Errorlevel 1 Goto DoneNow
:DoDir
if not exist %model%/. md %model%
set BuildUp=cd..
set MoveFile=.\%model%\
:DoneNow
set OutCMD=%MoveFile%Compile.cmd
rem can use %~dp0 not %01 %02 to get FB Parts
type %01 > %OutCMD%
echo.>> %OutCMD%
echo REM defragster was here >> %OutCMD%
echo.>> %OutCMD%
echo set model=%model%>> %OutCMD%
echo set speed=%speed%>> %OutCMD%
echo set opt=%opt%>> %OutCMD%
echo set usb=%usb%>> %OutCMD%
echo %BuildUp%>> %OutCMD%
echo set sketchcmd=%sketchcmd%>> %OutCMD%
type %02 >> %OutCMD%
exit
:DoneNowTeensy
set OutCMD=%MoveFile%Compile.cmd
rem can use %~dp0 not %01 %02 to get FB Parts
type %01 > %OutCMD%
echo.>> %OutCMD%
echo REM defragster was here >> %OutCMD%
echo.>> %OutCMD%
echo set model=%model%>> %OutCMD%
echo set speed=%speed%>> %OutCMD%
echo set opt=%opt%>> %OutCMD%
echo set usb=%usb%>> %OutCMD%
echo %BuildUp%>> %OutCMD%
echo set sketchcmd=%sketchcmd%>> %OutCMD%
type %0T >> %OutCMD%
exit
:DoneNowGDB
set OutCMD=%MoveFile%Compile.cmd
rem can use %~dp0 not %01 %02 to get FB Parts
type %01 > %OutCMD%
echo.>> %OutCMD%
echo REM defragster was here >> %OutCMD%
echo.>> %OutCMD%
echo set model=%model%>> %OutCMD%
echo set speed=%speed%>> %OutCMD%
echo set opt=%opt%>> %OutCMD%
echo set usb=%usb%>> %OutCMD%
echo %BuildUp%>> %OutCMD%
echo set sketchcmd=%sketchcmd%>> %OutCMD%
type %02G >> %OutCMD%
exit
:TsetQuit
exit