-
Notifications
You must be signed in to change notification settings - Fork 1
/
puck_defaults.cpp
59 lines (49 loc) · 1.85 KB
/
puck_defaults.cpp
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
/***********************************************************************
Copyright 2011 Carnegie Mellon University and Intel Corporation
Author: Mike Vande Weghe <vandeweg@cmu.edu>
This file is part of owd.
owd is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 3 of the License, or (at your
option) any later version.
owd is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***********************************************************************/
int entryLine;
const int FALSE=0;
bool curses(FALSE);
#include "btinterface.h"
#include "btutil_paramDefaults.h"
void usage(char *name) {
printf("Usage: %s <bus> <puck>\n",name);
printf(" <bus>: numerical value of the CANbus device (/dev/pcan##)\n");
printf(" <puck>: CANbus ID of the puck to set (1-14)\n");
}
int main(int argc, char **argv ) {
if (argc ==3) {
int bus = atol(argv[1]);
int puck = atol(argv[2]);
if ((puck < 1) || (puck > 14)) {
printf("Error: puck id %d not in the range 1-14\n",puck);
usage(argv[0]);
exit(1);
}
printf("Updating default values for puck %d...", puck);
btinterface_bus = new CANbus(bus,0,true,false,false,true);
if (btinterface_bus->open() == OW_FAILURE) {
printf("Unable to open CANbus device");
return 1;
}
paramDefaults(puck,puck);
printf("done.\n");
delete btinterface_bus;
exit(0);
} else {
usage(argv[0]);
exit(1);
}
}