From 65a78c58a4923e9d426d6c2ed16f4267c01e183f Mon Sep 17 00:00:00 2001 From: Franklin Wei Date: Sun, 6 Apr 2014 21:58:22 +0100 Subject: Added init_morse call, made it possible to run as a non-privileged user --- main.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/main.cpp b/main.cpp index 0750959..9d7b2e8 100644 --- a/main.cpp +++ b/main.cpp @@ -2,6 +2,7 @@ #include #include #include // let the user use this with a screen, too +#include 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); } } -- cgit v1.1