Configurator: signedness warning fixes
[clinton/Smoothieware.git] / src / main.cpp
1 /*
2 This file is part of Smoothie (http://smoothieware.org/). The motion control part is heavily based on Grbl (https://github.com/simen/grbl).
3 Smoothie is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
4 Smoothie 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 General Public License for more details.
5 You should have received a copy of the GNU General Public License along with Smoothie. If not, see <http://www.gnu.org/licenses/>.
6 */
7
8 #include "libs/Kernel.h"
9 #include "modules/tools/laser/Laser.h"
10 #include "modules/tools/extruder/Extruder.h"
11 #include "modules/tools/temperaturecontrol/TemperatureControlPool.h"
12 #include "modules/tools/endstops/Endstops.h"
13 #include "modules/tools/switch/SwitchPool.h"
14 #include "modules/robot/Player.h"
15 #include "modules/utils/simpleshell/SimpleShell.h"
16 #include "modules/utils/configurator/Configurator.h"
17 #include "modules/utils/currentcontrol/CurrentControl.h"
18 #include "modules/utils/pausebutton/PauseButton.h"
19 #include "libs/ChaNFSSD/SDFileSystem.h"
20 #include "libs/Config.h"
21 #include "libs/nuts_bolts.h"
22 #include "libs/utils.h"
23
24 // Debug
25 #include "libs/SerialMessage.h"
26
27 //#include "libs/USBCDCMSC/USBCDCMSC.h"
28 SDFileSystem sd(p5, p6, p7, p8, "sd"); // LPC17xx specific : comment if you are not using a SD card ( for example with a mBed ).
29 //LocalFileSystem local("local"); // LPC17xx specific : comment if you are not running a mBed
30 //USBCDCMSC cdcmsc(&sd); // LPC17xx specific : Composite serial + msc USB device
31
32
33 int main() {
34
35
36 LPC_GPIO1->FIODIR |= 1<<18;
37 LPC_GPIO1->FIODIR |= 1<<19;
38 LPC_GPIO1->FIODIR |= 1<<20;
39 LPC_GPIO1->FIODIR |= 1<<21;
40
41 Kernel* kernel = new Kernel();
42
43 kernel->streams->printf("Smoothie ( grbl port ) version 0.6.1 \r\n");
44
45 //kernel->add_module( new Laser(p21) );
46 kernel->add_module( new Extruder() );
47 kernel->add_module( new SimpleShell() );
48 kernel->add_module( new Configurator() );
49 kernel->add_module( new CurrentControl() );
50 kernel->add_module( new TemperatureControlPool() );
51 kernel->add_module( new SwitchPool() );
52 kernel->add_module( new PauseButton() );
53 kernel->add_module( new Endstops() );
54
55 //kernel->add_module( &cdcmsc );
56
57 kernel->streams->printf("start\r\n");
58
59 struct SerialMessage message;
60 message.message = "G90";
61 message.stream = kernel->serial;
62 kernel->call_event(ON_CONSOLE_LINE_RECEIVED, &message );
63
64 /*
65 int i = 0;
66 while( i <= 60 ){
67 // Debug : launch file on startup
68
69 message.message = "G1 X20 Y20 F9000";
70 message.stream = kernel->serial;
71 kernel->call_event(ON_CONSOLE_LINE_RECEIVED, &message );
72
73 message.message = "G1 X20 Y20.5 F9000";
74 message.stream = kernel->serial;
75 kernel->call_event(ON_CONSOLE_LINE_RECEIVED, &message );
76
77
78 message.message = "G1 X0 Y0.5 F9000";
79 message.stream = kernel->serial;
80 kernel->call_event(ON_CONSOLE_LINE_RECEIVED, &message );
81
82
83 message.message = "G1 X0 Y0 F9000";
84 message.stream = kernel->serial;
85 kernel->call_event(ON_CONSOLE_LINE_RECEIVED, &message );
86
87 i++;
88 }
89 */
90
91 /*
92 int i = 0;
93 while( i <= 60 ){
94 // Debug : launch file on startup
95
96 message.message = "G1 X40 Y0 F9000";
97 message.stream = kernel->serial;
98 kernel->call_event(ON_CONSOLE_LINE_RECEIVED, &message );
99
100 message.message = "G1 X40 Y1 F9000";
101 message.stream = kernel->serial;
102 kernel->call_event(ON_CONSOLE_LINE_RECEIVED, &message );
103
104
105 message.message = "G1 X0 Y1 F9000";
106 message.stream = kernel->serial;
107 kernel->call_event(ON_CONSOLE_LINE_RECEIVED, &message );
108
109
110 message.message = "G1 X0 Y0 F9000";
111 message.stream = kernel->serial;
112 kernel->call_event(ON_CONSOLE_LINE_RECEIVED, &message );
113
114 i++;
115 }
116 */
117
118 // Debug : launch file on startup
119 //struct SerialMessage message;
120 //message.message = "G1 X1000 F2000";
121 message.message = "play /sd/laurana.g -q";
122 message.stream = kernel->serial;
123 kernel->call_event(ON_CONSOLE_LINE_RECEIVED, &message );
124
125 while(1){
126 kernel->call_event(ON_MAIN_LOOP);
127 kernel->call_event(ON_IDLE);
128 }
129 }
130