diff options
| author | Franklin Wei <frankhwei536@gmail.com> | 2014-04-06 21:58:22 +0100 |
|---|---|---|
| committer | Franklin Wei <frankhwei536@gmail.com> | 2014-04-06 21:58:22 +0100 |
| commit | 65a78c58a4923e9d426d6c2ed16f4267c01e183f (patch) | |
| tree | 24fa710d3328b4dc372580e0ededbf9b2f03b80a | |
| parent | 7193214d3f9d270e2b5a17ce777feba56f72e699 (diff) | |
| download | pish-65a78c58a4923e9d426d6c2ed16f4267c01e183f.zip pish-65a78c58a4923e9d426d6c2ed16f4267c01e183f.tar.gz pish-65a78c58a4923e9d426d6c2ed16f4267c01e183f.tar.bz2 pish-65a78c58a4923e9d426d6c2ed16f4267c01e183f.tar.xz | |
Added init_morse call, made it possible to run as a non-privileged user
| -rw-r--r-- | main.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -2,6 +2,7 @@ #include <led.h> #include <morse.h> #include <iostream> // let the user use this with a screen, too +#include <parse.h> using namespace std; void parse_args(int argc, char* argv[]) { @@ -12,22 +13,24 @@ int main(int argc, char* argv[]) if(geteuid()!=0) // must be root to control LEDS! { cerr << "Need to be root to control LEDs!"<< endl; - return 1; + cerr << "PiSH will work fine, but the LEDs can not be used." << endl; } parse_args(argc, argv); - cout << "PiSH initializied." << endl; + init_morse(); dash(); usleep(250000); dash(); usleep(250000); + cout << "PiSH initializied." << endl; string cmd; while(cmd!="exit") { dot(); cout << "PiSH> "; getline(cin, cmd); - dash(); - usleep(250000); + pish_parse(cmd); + cin.clear(); + sleep(1); } } |