FlightAware Discussions

How-to Feed Plane Plotter Site directly from Raspberry Pi


#21

Nope didn’t work :frowning: still the same error.

I just copied and overwrite coaa.h to the ppup folder.

Here is the log:
gcc -O2 -g -Wall -W pkg-config --cflags librtlsdr -c ppup1090.c
gcc -O2 -g -Wall -W pkg-config --cflags librtlsdr -c anet.c
gcc -O2 -g -Wall -W pkg-config --cflags librtlsdr -c interactive.c
gcc -O2 -g -Wall -W pkg-config --cflags librtlsdr -c mode_ac.c
gcc -O2 -g -Wall -W pkg-config --cflags librtlsdr -c mode_s.c
gcc -O2 -g -Wall -W pkg-config --cflags librtlsdr -c net_io.c
gcc -g -o ppup1090 ppup1090.o anet.o interactive.o mode_ac.o mode_s.o net_io.o coaa1090.obj pkg-config --libs librtlsdr -lpthread -lm

pi@piaware:~/ppup $ ./ppup1090
Error 0xFFFFFFFE initialising uploader


#22

Can you show the (regno and authcode redacted) output of:

cat coaa.h

Or you can just check yourself if the contents look correct.

I’m not sure what else it might be but that file seems like the most likely culprit.


#23

This is the inside of coaa.h (I changed my real numbers to ‘x’)

//coaa.h configuration file for John Leo Navarro 2019-03-12 15:35:49
#define USER_REGNO xxx
#define USER_AUTHCODE xxxxxxxxx
#define USER_LATITUDE xxxxxxxxx
#define USER_LONGITUDE xxxxxxxxxx


#24

Yeah i’m trying to reproduce the error but the only way i find to do that is to have bad data it coaa.h

For example if the #define USER_REGNO is only 3 digits, i get the same error.
Maybe the file they sent you is just faulty?

To double check that, can you try with the following in coaa.h:

#define USER_REGNO 234333
#define USER_AUTHCODE 23443543543
#define USER_LATITUDE 50.0
#define USER_LONGITUDE 10.0

It will not really allow you to upload data but it is just for testing.
(The application will start without error for me.)
To recompile you can use this command:

make -f makeppup1090 -B

#25

Your Test Code Works!!! hahahaha guess your right, its a problem on my coaa.h, not my fault though since they (COAA) are the one who created my coaa.h file :rofl:

I might request a new one tho, thank you for your help!


#26

Remember you have to wait one minute to see output or upload.


#27

An alternate (and better) method to start ppup1090 at boot is to create ppup1090.service file and enable it, so that ppup1090 is started by systemd instead of rc.local.

This method has following advantages:

  1. It makes starting of ppup1090 to wait till dump1090-fa, or dump1090-mutability starts.
  2. The user can control & monitor ppup1090 by systemctl commands.

The systemd method given below completely replaces following item of Post #1:
"(3) Make ppup1090 to auto-start at boot"

NOTE:
If you have already implemented rc.local startup of Post #1, and want to switch to systemd startup given below, first disable the rc.local startup by following steps:

(1) Open file rc.local to edit

sudo nano /etc/rc.local

(2) From the file opened, delete following line:

/home/pi/ppup/ppup-maint.sh &

(3) Save (Ctrl+o) and Close (Ctrl+x)

(4) Reboot RPi
sudo reboot

.

STEP BY STEP METHOD FOR STARTUP BY SYSTEMD

1 - Create system user ppup1090 which will start the service automatically at boot.

sudo useradd --system ppup1090  

.

2 - Create a blank file ppup1090.service in folder /lib/systemd/system/ppup1090.service

sudo nano /lib/systemd/system/ppup1090.service 

.

3 - Copy-paste following code in this blank file

Note-1: following 2 versions of code are identical, except for the line starting with After=

Note-2: Noted that systemd-journal continously runs & generates plane upload log. To overcome this and reduce cpu & memory usage, I have added --quiet at end of the line ExecStart=/home/pi/ppup/ppup1090.

`
.

IF USING DUMP1090-FA

Applies to:

  • Piaware SD Card image (which has dump1090-fa pre-installed).
  • Raspbian image with dump1090-fa package install.
# planeplotter uploader service for systemd
# create in /lib/systemd/system/
# then install in /etc/systemd/system/default.target.wants/ 
# by command: sudo systemctl enable ppup1090.service

[Unit]
Description=PlanePlotter Raspberry Pi uploader
Wants=network-online.target
After=dump1090-fa.service network-online.target time-sync.target

[Service]
User=ppup1090
RuntimeDirectory=ppup
ExecStart=/home/pi/ppup/ppup1090 --quiet
ExecReload=/bin/kill -HUP $MAINPID
Type=simple
Restart=on-failure
RestartSec=30
# exit code 4 means login failed
# exit code 6 means startup failed
RestartPreventExitStatus=4 6

[Install]
WantedBy=default.target

Save (Ctrl+o) and close (Ctrl+x)

.

IF USING DUMP1090-MUTABILITY

Applies to:

  • Raspbian image with dump1090-mutability ver 1.15~dev package install
  • PI24 image (which has dump1090-mutability ver 1.14 pre-installed)
# planeplotter uploader service for systemd
# create in /lib/systemd/system/
# then install in /etc/systemd/system/default.target.wants/ 
# by command: sudo systemctl enable ppup1090.service

[Unit]
Description=PlanePlotter Raspberry Pi uploader
Wants=network-online.target
After=dump1090-mutability.service network-online.target time-sync.target

[Service]
User=ppup1090
RuntimeDirectory=ppup
ExecStart=/home/pi/ppup/ppup1090 --quiet
ExecReload=/bin/kill -HUP $MAINPID
Type=simple
Restart=on-failure
RestartSec=30
# exit code 4 means login failed
# exit code 6 means startup failed
RestartPreventExitStatus=4 6

[Install]
WantedBy=default.target

Save (Ctrl+o) and close (Ctrl+x)

.

4 - Enable service by following command

sudo systemctl enable ppup1090.service  

sudo systemctl restart ppup1090

.

5 - Check status after few minutes

pi@raspberrypi:~ $ sudo systemctl status ppup1090
● ppup1090.service - PlanePlotter Raspberry Pi uploader
   Loaded: loaded (/lib/systemd/system/ppup1090.service; enabled; vendor preset: enabled)
   Active: active (running) since Sun 2019-03-17 04:36:59 EDT; 5min ago
 Main PID: 860 (ppup1090)
   CGroup: /system.slice/ppup1090.service
           └─860 /home/pi/ppup/ppup1090 --quiet

Mar 17 04:36:59 raspberrypi systemd[1]: Started PlanePlotter Raspberry Pi uploader.

.

6 - Commands to control & monitor

sudo systemctl restart ppup1090   

sudo systemctl stop ppup1090   

sudo systemctl status ppup1090  

.