Subversion Repositories f9daq

Rev

Rev 7 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
7 f9daq 1
#include        <stdio.h>
2
#include        <string.h>
3
#include        <unistd.h>
4
#include        "libusmc.h"
5
 
6
 
7
#define         MENU_EXIT       0
8
#define         MENU_ERROR      1
9
#define         MENU_CONTINUE   2
10
 
11
USMC_Devices devices;
12
DWORD        cur_dev;
13
 
14
char str [105] = { 100 };
15
 
16
// Function that prints information about connected devices to console
17
void print_devices ( USMC_Devices devices )
18
{
19
        DWORD i;
20
 
21
        for ( i = 0 ; i < devices.NOD ; i++ )
22
                printf ( "Device# %d,\tSerial Number - %.16s,\tVersion - %.4s\n", i + 1, devices.Serial [i], devices.Version [i] );
23
}
24
 
25
// Function that prints information about device state to console
26
void print_state ( USMC_State state )
27
{
28
        printf ( "The state is:\n" );
29
        printf ( "- Current Position in microsteps - %d\n", state.CurPos );
30
        printf ( "- Temperature - %.2f\xf8\x43\n", state.Temp );
31
        printf ( "- Step Divisor - %d\n", state.SDivisor );
32
        printf ( "- Loft state - %s\n", state.Loft?"Indefinite" : "Fixed" );
33
        printf ( "- Power - %s\n", state.Power ? ( state.FullPower ? "Full" : "Half" ) : "Off" );
34
 
35
        if ( state.RUN )
36
                printf ( "- Step Motor is Running in %s Direction %s\n",
37
                                state.CW_CCW ? "CCW" : "CW", ( ( state.SDivisor == 1 ) && state.FullSpeed ) ? "at Full speed" : "" );
38
        else
39
                printf ( "- Step Motor is Not Running\n" );
40
 
41
        printf ( "- Device %s\n", state.AReset ? "is After Reset" : "Position Already Set" );
42
        printf ( "- Input Synchronization Logical Pin state - %s\n", state.SyncIN ? "TRUE" : "FALSE" );
43
        printf ( "- Output Synchronization Logical Pin state - %s\n", state.SyncOUT ? "TRUE" : "FALSE" );
44
        printf ( "- Rotary Transducer Logical Pin state - %s\n", state.RotTr ? "TRUE" : "FALSE" );
45
        printf ( "- Rotary Transducer Error Flag - %s\n", state.RotTrErr ? "Error" : "Clear" );
46
        printf ( "- Emergency Disable Button - %s\n", state.EmReset ? "Pushed" : "Unpushed" );
47
        printf ( "- Trailer 1 Press state - %s\n", state.Trailer1 ? "Pushed" : "Unpushed" );
48
        printf ( "- Trailer 2 Press state - %s\n", state.Trailer2 ? "Pushed" : "Unpushed" );
49
 
50
        if ( state.Voltage == 0.0f )
335 f9daq 51
                printf ( "- Input Voltage - Low\n" );
7 f9daq 52
        else
53
                printf ( "- Input Voltage - %.1fV\n", state.Voltage );
54
}
55
 
56
// Function that scans start parameters
57
void scan_start_params ( int * dest_pos, float * speed, USMC_StartParameters * sp )
58
{
59
        // Defaults
60
        *speed = 2000.0f;
61
        *dest_pos  = 0;
62
        sp -> SDivisor = 8;
63
 
64
        printf ( "Destination position:" );
65
        scanf  ( "%d", dest_pos );
66
        printf ( "\nSpeed (in tacts):" );
67
        scanf  ( "%f", speed );
68
        printf ( "\nSteps Divisor:" );
335 f9daq 69
        scanf  ( "%c", &( sp -> SDivisor ) );
7 f9daq 70
        getchar ();
71
}
72
 
73
// Function that prints information about device start parameters to console
74
void print_start_params ( int dest_pos, float speed, const USMC_StartParameters sp )
75
{
76
        printf ( "Destination position - %d\n", dest_pos );
77
        printf ( "speed - %.2ftacts/s\n", speed );
78
        printf ( "Steps Divisor - %d\n", sp.SDivisor );
79
 
80
        if ( sp.SDivisor == 1 )
81
                printf ( "Slow start/stop mode - %s\n", sp.SlStart ? "Enabled" : "Disabled" );
82
        else if ( sp.LoftEn ) {
83
                printf ( "Automatic backlash operation - Enabled\n" );
84
                printf ( "Automatic backlash operation direction - %s\n", sp.DefDir ? "CCW" : "CW" );
85
                printf ( "Force automatic backlash operation - %s\n", sp.ForceLoft ? "TRUE" : "FALSE" );
86
        } else {
87
                printf ( "Automatic backlash operation - Disabled\n" );
88
        }
89
        if ( sp.WSyncIN )
90
                printf ( "Controller will wait for input synchronization signal to start\n" );
91
        else
92
                printf ( "Input synchronization signal ignored \n" );
93
 
94
        printf ( "Output synchronization counter will %sbe reset\n", sp.SyncOUTR ? "" : "not " );
95
}
96
 
97
// Function that prints information about device parameters to console
98
void print_params ( USMC_Parameters params )
99
{
100
        printf ( "The parameters are:\n" );
101
        printf ( "Full acceleration time - %.0f ms\n", ( double ) params.AccelT );
102
        printf ( "Full deceleration time - %.0f ms\n", ( double ) params.DecelT );
103
        printf ( "Power reduction timeout - %.0f ms\n", ( double ) params.PTimeout );
104
        printf ( "Button speedup timeout 1 - %.0f ms\n", ( double ) params.BTimeout1 );
105
        printf ( "Button speed after timeout 1 - %.2f steps/s\n", ( double ) params.BTO1P );
106
        printf ( "Button speedup timeout 2 - %.0f ms\n", ( double ) params.BTimeout2 );
107
        printf ( "Button speed after timeout 2 - %.2f steps/s\n", ( double ) params.BTO2P );
108
        printf ( "Button speedup timeout 3 - %.0f ms\n", ( double ) params.BTimeout3 );
109
        printf ( "Button speed after timeout 3 - %.2f steps/s\n", ( double ) params.BTO3P );
110
        printf ( "Button speedup timeout 4 - %.0f ms\n", ( double ) params.BTimeout4 );
111
        printf ( "Button speed after timeout 4 - %.2f steps/s\n", ( double ) params.BTO4P );
112
        printf ( "Button reset timeout - %.0f ms\n", (double) params.BTimeoutR );
113
        printf ( "Button reset operation speed - %.2f steps/s\n", ( double ) params.MinP );
114
        printf ( "Backlash operation distance - %d steps\n", ( int ) params.MaxLoft );
115
        printf ( "Revolution distance - %d steps\n", ( int ) params.RTDelta );
116
        printf ( "Minimal revolution distance error - %d steps\n", ( int ) params.RTMinError );
117
        printf ( "Power off temperature - %.2f\xf8\x43\n", ( double ) params.MaxTemp );
118
        printf ( "Duration of the output synchronization pulse - " );
119
 
120
        if ( params.SynOUTP == 0 )
121
                printf ( "minimal\n");
122
        else
123
                printf ( "%.1f * [Tact Period]\n", params.SynOUTP - 0.5 );
124
 
125
        printf ( "speed of the last phase of the backlash operation - " );
126
 
127
        if ( params.LoftPeriod == 0.0f )
128
                printf ( "normal\n" );
129
        else
130
                printf ( "%.2f steps/s\n", ( double ) params.LoftPeriod );
131
 
132
        printf ( "<Angular Encoder Step> Equals <Angular Step Motor Step>/<%.2f>\n", params.EncMult );
133
}
134
 
135
// Function that prints information about device "mode" parameters to console
136
void print_mode ( USMC_Mode mode )
137
{
138
        printf ( "mode parameters:\n" );
139
        printf ( "Buttons - ");
140
 
141
        if ( mode.PMode )
142
                printf ( "Disabled\n" );
143
        else {
144
                printf ( "Enabled\nButton 1 TRUE state - %s\n", mode.Butt1T ? "+3/+5 V" : "0 V(GND)" );
145
                printf ( "Button 2 TRUE state - %s\n", mode.Butt2T ? "+3/+5 V" : "0 V(GND)" );
146
        }
147
 
148
        printf ( "Current reduction regime - %s\n", mode.PReg ? "Used" : "Not Used" );
149
 
150
        if ( mode.ResetD )
151
                printf ( "Power - %s\n", mode.EMReset ? "Emerjency Off" : "Off" );
152
        else
153
                printf ( "Power - On\n" );
154
 
155
        if ( mode.Tr1En || mode.Tr2En )
156
                printf ( "Trailers are - %s\n", mode.TrSwap ? "Swapped" : "Direct" );
157
 
158
        printf ( "Trailer 1 - ");
159
 
160
        if ( mode.Tr1En )
161
                printf ( "Enabled\nTrailer 1 TRUE state - %s\n", mode.Tr1T ? "+3/+5 V" : "0 V(GND)" );
162
        else
163
                printf ( "Disabled\n" );
164
 
165
        printf ( "Trailer 2 - " );
166
 
167
        if ( mode.Tr2En )
168
                printf ( "Enabled\nTrailer 2 TRUE state - %s\n", mode.Tr2T ? "+3/+5 V" : "0 V(GND)" );
169
        else
170
                printf ( "Disabled\n" );
171
 
172
        if ( mode.EncoderEn ) {
173
                printf ( "Encoder - Enabled\n" );
174
                printf ( "Encoder Position Counter is %s\n", mode.EncoderInv ? "Inverted" : "Direct" );
175
                printf ( "Rotary Transducer and Input Syncronisation are\n"
176
                                " Disabled Because of Encoder\n" );
177
        } else {
178
                printf ( "Encoder - Disabled\n" );
179
                printf ( "Rotary Transducer - " );
180
 
181
                if ( mode.RotTeEn ) {
182
                        printf ( "Enabled\nRotary Transducer TRUE state - %s\n", mode.RotTrT ? "+3/+5 V" : "0 V(GND)" );
183
                        printf ( "Rotary Transducer Operation - %s\n", mode.RotTrOp ? "Stop on error" : "Check and ignore error" );
184
                        printf ( "Reset Rotary Transducer Check Positions - %s\n", mode.ResetRT ? "Initiated" : "No, why?" );
185
                } else {
186
                        printf ( "Disabled\n" );
187
                }
188
 
189
                printf ( "Synchronization input mode:\n" );
190
 
191
                if ( mode.SyncINOp )
192
                        printf ( "Step motor will move one time to the destination position\n" );
193
                else
194
                        printf ( "Step motor will move multiple times by [destination position]\n" );
195
        }
196
 
197
        printf ( "Output Syncronization - " );
198
 
199
        if ( mode.SyncOUTEn ) {
200
                printf ( "Enabled\nReset Output Synchronization Counter - %s\n", mode.SyncOUTR ? "Initiated" : "No, why?" );
201
                printf ( "Number of steps after which synchronization output sygnal occures - %u\n", mode.SyncCount );
202
        } else {
203
                printf ( "Disabled\n" );
204
        }
205
 
206
        printf ( "Synchronization Output is " );
207
 
208
        if ( mode.SyncInvert )
209
                printf ( "INVERTED\n" );
210
        else
211
                printf ( "NORMAL\n" );
212
}
213
 
214
void print_enc_state ( USMC_EncoderState enc_state, USMC_Parameters up )
215
{
216
        printf ( "The encoder state is:\n" );
217
        printf ( "- Current Position in microsteps - %.2f\n", enc_state.ECurPos/up.EncMult );
218
        printf ( "- Encoder Position in microsteps - %.2f\n\n", enc_state.EncoderPos/up.EncMult );
219
        printf ( "- Current Position in \"Half of Encoder Step\"s - %d\n", enc_state.ECurPos );
220
        printf ( "- Encoder Position in \"Half of Encoder Step\"s - %d\n", enc_state.EncoderPos );
221
}
222
 
223
// Function that prints last error information
224
void print_error ( void )
225
{
226
        char er [256];
227
 
228
        USMC_GetLastErr ( er, 255 );
229
        er [255] = '\0';
230
        printf ( "\n%s", er );
231
}
232
 
233
 
234
USMC_State state;
235
USMC_StartParameters start_params;
236
USMC_Parameters params;
237
USMC_Mode mode;
238
USMC_EncoderState enc_state;
239
 
240
// Reference to Functions For Every Command (defined at the end of the file)
241
BOOL f1_get_dev_state ( void );
242
BOOL f2_start ( void );
243
BOOL f3_stop ( void );
244
BOOL f4_set_params ( void );
245
BOOL f5_set_mode ( void );
246
BOOL f6_set_cur_pos ( void );
247
BOOL f7_turn_off_and_save_pos ( void );
248
BOOL fs7_revert_sp_to_0 ( void );
249
BOOL f8_get_enc_state ( void );
250
BOOL fp_change_power ( void );
251
 
252
BOOL smpower = FALSE;
253
 
254
int menu ( void )
255
{
256
        BOOL err = FALSE;
257
        char menu_sel;
258
 
259
        printf ( "menu :\n"
260
                   "1 - Get Device state\n"
261
                   "2 - START\n"
262
                   "3 - STOP\n"
263
                   "4 - Set Parameters (can be changed only in c++ code)\n"
264
                   "5 - Set mode (can be changed only in c++ code)\n"
265
                   "6 - Set Current Position (can be changed only in c++ code)\n"
266
                   "7 - Turn Off and Save Current Position to Flash\n"
267
                   "SHIFT + 7 - Revert Start Position to 0\n"
268
                   "8 - Get Encoder state\n"
269
                   "\n"
270
                   "p - Turn %s Power"
271
                   "\n"
272
                   "9 - Select other device\n"
273
                   "0 - Exit program\n"
274
                   "Choose:", smpower ? "Off" : "On" );
275
 
276
        menu_sel = getchar ();
277
 
278
        switch ( menu_sel )
279
        {
280
        case '1':
281
                err = f1_get_dev_state ();
282
                break;
283
        case '2':
284
                err = f2_start ();
285
                break;
286
        case '3':
287
                err = f3_stop ();
288
                break;
289
        case '4':
290
                err = f4_set_params ();
291
                break;
292
        case '5':
293
                err = f5_set_mode ();
294
                break;
295
        case '6':
296
                err = f6_set_cur_pos ();
297
                break;
298
        case '7':
299
                err = f7_turn_off_and_save_pos ();
300
                break;
301
        case '&':       // 'SHIFT 7' on my keyboard
302
                err = fs7_revert_sp_to_0 ();
303
                break;
304
        case '8':
305
                err = f8_get_enc_state ();
306
                break;
307
        case 'p':
308
        case 'P':
309
                err = fp_change_power ();
310
                break;
311
 
312
        case '9':
313
                return  MENU_ERROR;
314
        case '0':
315
                printf ( "\n" );
316
                return  MENU_EXIT;
317
        default:
318
                system ( "clear" );
319
                break;
320
        }
321
 
322
        if ( err ) {
323
                print_error ();
324
                printf ( "\nPerforming Refressh..." );
325
                getchar ();
326
 
327
                if ( USMC_Init ( &devices ) ) {
328
                        print_error ();
329
                        return  MENU_EXIT;
330
                }
331
 
332
                return  MENU_ERROR;
333
        }
334
 
335
        return  MENU_CONTINUE;
336
}
337
 
338
int select_menu ( void )
339
{
340
        int  ret;
341
        do {
342
                system ( "clear" );
343
                cur_dev = -1;
344
                print_devices ( devices );
345
                printf ( "\n\t0\tExit\n" );
346
    for ( ret=0;ret<devices.NOD;ret++)  printf ( "\t%d\tDevice # %d\n",ret+1,ret+1 );
347
                printf ( "\tx\tReInitialize\n" );
348
                printf ( "\txx\tClose Driver Window and Exit Program\n" );
349
 
350
                printf ( "Select:" );
351
                scanf  ( "%s", str );
352
                getchar ();
353
 
354
                if ( strcmp ( str, "x" ) == 0 )
355
                {
356
                        //// Perform "Refresh" of Driver
357
                        if ( USMC_Init ( &devices ) )
358
                        {
359
                                print_error ();
360
                                return  MENU_EXIT;
361
                        }
362
 
363
                        continue;
364
                } else if ( strcmp ( str, "xx" ) == 0 ) {
365
                        //// Close the MicroSMC.exe process
366
                        if ( USMC_Close () )
367
                        {
368
                                print_error ();
369
                                return  MENU_EXIT;
370
                        }
371
 
372
                        return  MENU_EXIT;
373
                }
374
 
375
                sscanf ( str, "%u", &cur_dev );
376
 
377
                if ( cur_dev == 0 )
378
                        return  MENU_EXIT;
379
        } while ( cur_dev > devices.NOD );
380
 
381
        system ( "clear" );
382
 
383
        cur_dev--;      // Decrement cur_dev by 1 ( we have zero-based device list,
384
                        // but 1-based is user-friendly )
385
 
386
        do {
387
                ret = menu ();
388
        } while ( ret == MENU_CONTINUE );
389
 
390
        return  ret;
391
}
392
 
393
int exit_program ( void )
394
{
395
        printf ( "\nPress any key to exit" );
396
        getchar ();
397
 
398
        return  MENU_EXIT;
399
}
400
 
401
int main ( int argc, const char ** argv )
402
{
403
        int res;
404
 
405
        // change terminal mode to non-buffering
406
        system ( "stty -icanon min 1" );
407
        setbuf ( stdin, NULL );
408
        system ( "clear" );
409
 
410
        if ( USMC_Init ( &devices ) )
411
        {
412
                print_error ();
413
 
414
                return  exit_program ();
415
        }
416
 
417
        while ( select_menu () );
418
 
419
        res = exit_program ();
420
        //restore terminal mode
421
        system ( "stty -icanon" );
422
 
423
        return  res;
424
}
425
 
426
 
427
 
428
BOOL f1_get_dev_state ( void )
429
{
430
        if ( USMC_GetState ( cur_dev, &state ) )
431
                return  TRUE;
432
 
433
        system ( "clear" );
434
        print_state ( state );
335 f9daq 435
        printf ( "\nPress any key to continue" );
436
        getchar ();
7 f9daq 437
        system ( "clear" );
438
 
439
        return  FALSE;
440
}
441
 
442
BOOL f2_start ( void )
443
{
444
        float speed    = 2000.0f;
445
        int   dest_pos = 0;
446
 
447
        if ( USMC_GetStartParameters ( cur_dev, &start_params ) )
448
                return  TRUE;
449
 
450
        system ( "clear" );
451
        scan_start_params ( &dest_pos, &speed, &start_params );
452
        start_params.SlStart = TRUE;
453
 
454
        if ( USMC_Start ( cur_dev, dest_pos, &speed, &start_params ) )
455
                return  TRUE;
456
 
457
        system ( "clear" );
458
        print_start_params ( dest_pos, speed, start_params );
459
        printf ( "\n" );
460
        return  FALSE;
461
}
462
 
463
BOOL f3_stop ( void )
464
{
465
        if ( USMC_Stop ( cur_dev ) )
466
                return  TRUE;
467
 
468
        system ( "clear" );
469
        printf ( "Motor stopped\n\n" );
470
 
471
        return  FALSE;
472
}
473
 
474
BOOL f4_set_params ( void )
475
{
476
        if ( USMC_GetParameters ( cur_dev, &params ) )
477
                return  TRUE;
478
 
479
        // Set anything you want here
480
        params.MaxTemp = 70.0f;
481
        params.AccelT  = 200.0f;
482
        params.DecelT  = 200.0f;
483
        params.BTimeout1 = 5000.0f;
484
        params.BTimeout2 = 5000.0f;
485
        params.BTimeout3 = 5000.0f;
486
        params.BTimeout4 = 5000.0f;
487
        params.BTO1P = 625.0f;
488
        params.BTO2P = 16.0f;
489
        params.BTO3P = 625.0f;
490
        params.BTO4P = 16.0f;//500.0f;
491
        params.MinP  = 500.0f;
492
        params.BTimeoutR  = 500.0f;
493
        params.LoftPeriod = 500.0f;
494
        params.RTDelta    = 200;
495
        params.RTMinError = 15;
496
        params.EncMult = 2.5f;
497
        params.MaxLoft = 32;
498
        params.PTimeout = 100.0f;
499
        params.SynOUTP  = 1;
500
        //
501
 
502
        if ( USMC_SetParameters ( cur_dev, &params ) )
503
                return  TRUE;
504
 
505
        if ( USMC_SaveParametersToFlash ( cur_dev ) )
506
                return  TRUE;
507
 
508
        system ( "clear" );
509
        print_params ( params );
510
        printf ( "\nThese Parameters are Saved to Flash" );
511
        printf ( "\nPress any key to continue" );
512
        getchar ();
513
        system ( "clear" );
514
 
515
        return  FALSE;
516
}
517
 
518
BOOL f5_set_mode ( void )
519
{
520
        if ( USMC_GetMode ( cur_dev, &mode ) )
521
                return  TRUE;
522
 
523
        // Set anything you want here
524
        mode.SyncInvert = !mode.SyncInvert;
525
        mode.EncoderEn  = TRUE;
526
        mode.RotTrOp = FALSE;
527
        mode.ResetRT = TRUE;
528
        mode.ResBEnc = TRUE;
529
        // Set anything you want here
530
 
531
        if ( USMC_SetMode ( cur_dev, &mode ) )
532
                return  TRUE;
533
 
534
 
535
        system ( "clear" );
536
        print_mode ( mode );
537
        printf ( "\nPress any key to continue" );
538
        getchar ();
539
        system ( "clear" );
540
 
541
        return  FALSE;
542
}
543
 
544
BOOL f6_set_cur_pos ( void )
545
{
546
        int newCurPos = 1000;
547
 
548
        if ( USMC_SetCurrentPosition ( cur_dev, newCurPos ) )
549
                return  TRUE;
550
 
551
        system ( "clear" );
552
        printf ( "\nSetCurrentPosition executed with argument %d", newCurPos );
553
        printf ( "\nPress any key to continue" );
554
        getchar ();
555
        system ( "clear" );
556
 
557
        return  FALSE;
558
}
559
 
560
BOOL f7_turn_off_and_save_pos ( void )
561
{
562
        // Initialize structures (in case this function runs first)
563
        if ( USMC_GetParameters ( cur_dev, &params ) )
564
                return  TRUE;
565
        if ( USMC_GetMode ( cur_dev, &mode ) )
566
                return  TRUE;
567
 
568
        // Go to Full Step (automaticaly), then Turn Off
569
        mode.ResetD = TRUE;
570
 
571
        if ( USMC_SetMode ( cur_dev, &mode ) )
572
                return  TRUE;
573
 
574
        // Wait until Previous Comand is Done
575
        do {
576
                usleep ( 50 );
577
 
578
                if ( USMC_GetState ( cur_dev, &state ) )
579
                        return  TRUE;
580
        } while ( state.Power == TRUE );
581
 
582
        // Remember CurPos in Parameters Only While state.Power - FALSE
583
        params.StartPos = state.CurPos;
584
 
585
        if ( USMC_SetParameters ( cur_dev, &params ) )
586
                return  TRUE;
587
 
588
        // Then of Course You Need to SaveToFlash
589
        if ( USMC_SaveParametersToFlash ( cur_dev ) )
590
                return  TRUE;
591
 
592
        // Now You Can Unplug ME
593
        system ( "clear" );
594
        printf ( "\nThe Position \"%d\" is Saved to Flash\n", params.StartPos );
595
        printf ( "\nWhen Controller is Powered Up Next Time\n" );
596
        printf ( "\nIt Will Start From This Position\n" );
597
        printf ( "\nPress any key to exit" );
598
        getchar ();
599
        system ( "clear" );
600
 
601
        return  FALSE;
602
}
603
 
604
BOOL fs7_revert_sp_to_0 ( void )
605
{
606
        // Initialize structures (in case this function runs first)
607
        if ( USMC_GetParameters ( cur_dev, &params ) )
608
                return  TRUE;
609
 
610
        params.StartPos = 0;
611
 
612
        if ( USMC_SetParameters ( cur_dev, &params ) )
613
                return  TRUE;
614
 
615
        // Then of Course You Need to SaveToFlash
616
        if ( USMC_SaveParametersToFlash ( cur_dev ) )
617
                return  TRUE;
618
 
619
        system ( "clear" );
620
        printf ( "\nStart Position is Reset to 0\n" );
621
        printf ( "\nPress any key to continue" );
622
        getchar ();
623
 
624
        return  FALSE;
625
}
626
 
627
BOOL f8_get_enc_state ( void )
628
{
629
        if ( USMC_GetEncoderState ( cur_dev, &enc_state ) )
630
                return  TRUE;
631
        if ( USMC_GetParameters ( cur_dev, &params ) )
632
                return  TRUE;
633
 
634
        system ( "clear" );
635
        print_enc_state ( enc_state, params );
335 f9daq 636
        printf ( "\nPress any key to continue" );
637
        getchar ();
7 f9daq 638
        system ( "clear" );
639
 
640
        return  FALSE;
641
}
642
 
643
BOOL fp_change_power ( void )
644
{
645
        if ( USMC_GetMode ( cur_dev, &mode ) )
646
                return  TRUE;
647
 
648
        smpower     = !smpower;
649
        mode.ResetD = !smpower;
650
 
651
        if ( USMC_SetMode ( cur_dev, &mode ) )
652
                return  TRUE;
653
 
654
        system ( "clear" );
655
        printf ( "Now, Power is %s\n", mode.ResetD ? "Off" : "On" );
656
 
657
        return  FALSE;
658
}