|
|
@@ -40,6 +40,8 @@
|
|
|
#include "../commhub/client_utils.h"
|
|
|
#include "../common/gpsmath.h"
|
|
|
|
|
|
+#define PADDLEMGR_VERSION "0.1.1"
|
|
|
+
|
|
|
// structure for loading stop definitions
|
|
|
//
|
|
|
typedef struct stop_struct {
|
|
|
@@ -431,6 +433,8 @@ int main(int argc, char **argv) {
|
|
|
|
|
|
struct message_record incoming_msg;
|
|
|
|
|
|
+ int send_initial_status_update = 0;
|
|
|
+
|
|
|
#ifdef DEBUG_PRINT
|
|
|
long long int _usec_now, _usec_prv, _usec_del;
|
|
|
_usec_now = get_usec_time();
|
|
|
@@ -438,6 +442,31 @@ int main(int argc, char **argv) {
|
|
|
_usec_del = 60000000;
|
|
|
#endif
|
|
|
|
|
|
+ if ( (argc>1) && (
|
|
|
+ (strncmp(argv[1], "-h", 3)==0) ||
|
|
|
+ (strncmp(argv[1], "-v", 3)==0) ) ) {
|
|
|
+ printf("paddlemgr version: %s\n", PADDLEMGR_VERSION);
|
|
|
+ exit(0);
|
|
|
+ }
|
|
|
+
|
|
|
+ //----
|
|
|
+
|
|
|
+ // try to restore as much state as possible
|
|
|
+ //
|
|
|
+ init_state_info();
|
|
|
+
|
|
|
+ gps_stat.lat = state_info.lat;
|
|
|
+ gps_stat.lon = state_info.lon;
|
|
|
+ gps_stat.gps_good = state_info.gps_good;
|
|
|
+ gps_stat.num_sats = state_info.num_sats;
|
|
|
+
|
|
|
+ if (state_info.paddle != 0) {
|
|
|
+ if (load_paddle(state_info.paddle) >= 0) {
|
|
|
+ send_initial_status_update = 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //----
|
|
|
+
|
|
|
configure_signal_handlers(argv[0]);
|
|
|
maintain_ipc_hub_connect(argv[0]);
|
|
|
|
|
|
@@ -453,6 +482,10 @@ int main(int argc, char **argv) {
|
|
|
register_dispatch_callback(MAILBOX_NEXT_STOP, CALLBACK_USER(4), handle_next_req, NULL);
|
|
|
register_dispatch_callback(MAILBOX_PREV_STOP, CALLBACK_USER(5), handle_prev_req, NULL);
|
|
|
|
|
|
+ //---
|
|
|
+ if (send_initial_status_update) { send_status_update(); }
|
|
|
+ //---
|
|
|
+
|
|
|
while( exit_request_status == EXIT_REQUEST_NONE ) {
|
|
|
|
|
|
RESET_WATCHDOG();
|