mirror of https://github.com/billw2/pikrellcam.git
Changes for Pi 4 peripheral base and Buster installs
V 4.2.1 Pi 4 servos use peripheral base 0xfe000000 Buster install: Install package ffmpeg instead of libav-tools Install php7.3 scripts-dist/startup waits up to 10 seconds for NFS mount.
This commit is contained in:
parent
1e970587b8
commit
949225d275
|
@ -112,19 +112,29 @@ echo "Starting PiKrellCam install..."
|
|||
#
|
||||
JESSIE=8
|
||||
STRETCH=9
|
||||
BUSTER=10
|
||||
|
||||
V=`cat /etc/debian_version`
|
||||
DEB_VERSION="${V:0:1}"
|
||||
#DEB_VERSION="${V:0:1}"
|
||||
# Strip all chars after decimal point
|
||||
DEB_VERSION="${V%.*}"
|
||||
|
||||
PACKAGE_LIST=""
|
||||
|
||||
if ((DEB_VERSION >= STRETCH))
|
||||
if ((DEB_VERSION >= BUSTER))
|
||||
then
|
||||
AV_PACKAGES="ffmpeg"
|
||||
PHP_PACKAGES="php7.3 php7.3-common php7.3-fpm"
|
||||
elif ((DEB_VERSION >= STRETCH))
|
||||
then
|
||||
AV_PACKAGES="libav-tools"
|
||||
PHP_PACKAGES="php7.0 php7.0-common php7.0-fpm"
|
||||
else
|
||||
AV_PACKAGES="libav-tools"
|
||||
PHP_PACKAGES="php5 php5-common php5-fpm"
|
||||
fi
|
||||
|
||||
for PACKAGE in $PHP_PACKAGES
|
||||
for PACKAGE in $PHP_PACKAGES $AV_PACKAGES
|
||||
do
|
||||
if ! dpkg -s $PACKAGE 2>/dev/null | grep Status | grep -q installed
|
||||
then
|
||||
|
@ -132,7 +142,7 @@ do
|
|||
fi
|
||||
done
|
||||
|
||||
for PACKAGE in gpac nginx libav-tools bc \
|
||||
for PACKAGE in gpac nginx bc \
|
||||
sshpass mpack imagemagick apache2-utils libasound2 libasound2-dev \
|
||||
libmp3lame0 libmp3lame-dev
|
||||
do
|
||||
|
@ -303,7 +313,10 @@ sudo sed -i "s|PIKRELLCAM_WWW|$PWD/www|; \
|
|||
s/PORT/$PORT/" \
|
||||
/etc/nginx/sites-available/pikrellcam
|
||||
|
||||
if ((DEB_VERSION >= STRETCH))
|
||||
if ((DEB_VERSION >= BUSTER))
|
||||
then
|
||||
sudo sed -i "s/php5/php\/php7.3/" /etc/nginx/sites-available/pikrellcam
|
||||
elif ((DEB_VERSION >= STRETCH))
|
||||
then
|
||||
sudo sed -i "s/php5/php\/php7.0/" /etc/nginx/sites-available/pikrellcam
|
||||
fi
|
||||
|
|
BIN
pikrellcam
BIN
pikrellcam
Binary file not shown.
|
@ -13,6 +13,16 @@ TEST=$4
|
|||
#MEDIA_DIRECTORY=/home/pi/pikrellcam/www/media
|
||||
#ARCHIVE_DIR=/home/pi/pikrellcam/www/media/archive
|
||||
|
||||
BUSTER=10
|
||||
V=`cat /etc/debian_version`
|
||||
DEB_VERSION="${V%.*}"
|
||||
|
||||
if ((DEB_VERSION >= BUSTER))
|
||||
then
|
||||
AV_PGM=ffmpeg
|
||||
else
|
||||
AV_PGM=avconv
|
||||
fi
|
||||
|
||||
function check_thumb
|
||||
{
|
||||
|
@ -39,10 +49,10 @@ function check_thumb
|
|||
if [ ! -f $THUMBS_DIR/$THUMB_JPEG ]
|
||||
then
|
||||
THUMB_FAIL=false
|
||||
# echo " avconv -i $1 -ss 0 -vframes 1 $TMP_DIR/$THUMB_JPEG" >>$LOG
|
||||
# echo " $AV_PGM -i $1 -ss 0 -vframes 1 $TMP_DIR/$THUMB_JPEG" >>$LOG
|
||||
if [ "$TEST" != "test" ]
|
||||
then
|
||||
if ! avconv -i $1 -ss 0 -vframes 1 $TMP_DIR/$THUMB_JPEG
|
||||
if ! $AV_PGM -i $1 -ss 0 -vframes 1 $TMP_DIR/$THUMB_JPEG
|
||||
then
|
||||
echo " Failed to extract thumb from video: $1" >> $LOG
|
||||
THUMB_FAIL=true
|
||||
|
|
|
@ -38,6 +38,17 @@ LOG_FILE=$4
|
|||
COMMAND_FIFO=$5
|
||||
FILENAME_FORMAT=$6
|
||||
|
||||
BUSTER=10
|
||||
V=`cat /etc/debian_version`
|
||||
DEB_VERSION="${V%.*}"
|
||||
|
||||
if ((DEB_VERSION >= BUSTER))
|
||||
then
|
||||
AV_PGM=ffmpeg
|
||||
else
|
||||
AV_PGM=avconv
|
||||
fi
|
||||
|
||||
#
|
||||
# Requires libav-tools
|
||||
#
|
||||
|
@ -52,7 +63,7 @@ cd $MEDIA_DIR/timelapse
|
|||
FIRST=$(ls tl_${SERIES}_*.jpg | head -n1)
|
||||
NUM=${FIRST:9:5}
|
||||
|
||||
nice -2 avconv -r 6 -start_number $NUM -i $FILENAME_FORMAT \
|
||||
nice -2 $AV_PGM -r 6 -start_number $NUM -i $FILENAME_FORMAT \
|
||||
-b:v 6M -maxrate 6M -minrate 1M -bufsize 4M \
|
||||
-vcodec libx264 -crf 20 -g 4 -movflags faststart \
|
||||
$SERIES.mp4
|
||||
|
|
|
@ -124,13 +124,18 @@ then
|
|||
echo " $archive_dir is already NFS mounted." >> $log_file
|
||||
else
|
||||
cp $install_dir/www/images/nfs-mounting.jpg /run/pikrellcam/mjpeg.jpg
|
||||
sudo mount $NFS_ARCHIVE
|
||||
fs_type=$(stat -f -L -c %T $archive_dir)
|
||||
if [ "$fs_type" == "nfs" ]
|
||||
then
|
||||
echo " NFS mounted $NFS_ARCHIVE" >> $log_file
|
||||
else
|
||||
echo " NFS mount of $NFS_ARCHIVE failed" >> $log_file
|
||||
fi
|
||||
sudo mount $NFS_ARCHIVE &
|
||||
for ((p = 0; p < 10; p++))
|
||||
do
|
||||
sleep 1
|
||||
fs_type=$(stat -f -L -c %T $archive_dir)
|
||||
if [ "$fs_type" == "nfs" ]
|
||||
then
|
||||
echo " NFS mounted $NFS_ARCHIVE" >> $log_file
|
||||
break;
|
||||
else
|
||||
echo " NFS mount of $NFS_ARCHIVE slow or failed ..." >> $log_file
|
||||
fi
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
|
16
src/config.c
16
src/config.c
|
@ -303,7 +303,6 @@ rotation_control_set(char *option, char *setting)
|
|||
MMAL_STATUS_T status = MMAL_EINVAL;
|
||||
|
||||
value = ((value % 360 ) / 90) * 90;
|
||||
pikrellcam.rotation_value = value;
|
||||
for (i = 0; i < MAX_CAMERA_PORTS; ++i)
|
||||
{
|
||||
status = mmal_port_parameter_set_int32(camera.component->output[i],
|
||||
|
@ -1383,21 +1382,6 @@ config_load(char *config_file)
|
|||
|
||||
if (pikrellcam.config_sequence_new != pikrellcam.config_sequence)
|
||||
{
|
||||
#if 0
|
||||
if ( pikellcam.config_sequence <= 45
|
||||
&& ( pikrellcam.rotation_value == 90
|
||||
|| pikrellcam.rotation_value == 270
|
||||
)
|
||||
)
|
||||
{
|
||||
n = pikrellcam.video_width;
|
||||
pikrellcam.video_width = pikrellcam.video_height;
|
||||
pikrellcam.video_height = n;
|
||||
n = pikrellcam.still_width;
|
||||
pikrellcam.still_width = pikrellcam.still_height;
|
||||
pikrellcam.still_height = n;
|
||||
}
|
||||
#endif
|
||||
pikrellcam.config_sequence = pikrellcam.config_sequence_new;
|
||||
pikrellcam.config_modified = TRUE;
|
||||
}
|
||||
|
|
|
@ -1887,25 +1887,18 @@ pi_model(void)
|
|||
{
|
||||
FILE *f;
|
||||
static int model;
|
||||
char buf[200], arm[32];
|
||||
char buf[200];
|
||||
|
||||
if (model == 0)
|
||||
{
|
||||
if ((f = fopen("/proc/cpuinfo", "r")) != NULL)
|
||||
if ((f = fopen("/sys/firmware/devicetree/base/model", "r")) != NULL)
|
||||
{
|
||||
while (fgets(buf, sizeof(buf), f) != NULL)
|
||||
{
|
||||
if (sscanf(buf, "model name %*s %31s", arm) > 0)
|
||||
{
|
||||
if (!strncmp(arm, "ARMv6", 5))
|
||||
model = 1;
|
||||
else
|
||||
model = 2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
model = 1;
|
||||
if (fscanf(f, "Raspberry Pi %s", buf) == 1)
|
||||
sscanf(buf, "%d ", &model);
|
||||
fclose(f);
|
||||
}
|
||||
// printf("Pi model: %d\n", model);
|
||||
}
|
||||
return model;
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
|
||||
#include "utils.h"
|
||||
|
||||
#define PIKRELLCAM_VERSION "4.2.0"
|
||||
#define PIKRELLCAM_VERSION "4.2.1"
|
||||
|
||||
|
||||
//TCP Stream Server
|
||||
|
@ -759,8 +759,7 @@ typedef struct
|
|||
boolean video_notify,
|
||||
still_notify,
|
||||
timelapse_notify;
|
||||
int notify_duration,
|
||||
rotation_value;
|
||||
int notify_duration;
|
||||
|
||||
char *sharpness,
|
||||
*contrast,
|
||||
|
|
41
src/servo.c
41
src/servo.c
|
@ -29,9 +29,6 @@
|
|||
#include <stdint.h>
|
||||
#include <sys/mman.h>
|
||||
|
||||
#define PI_1_PERIPHERAL_BASE 0x20000000
|
||||
#define PI_2_PERIPHERAL_BASE 0x3F000000
|
||||
|
||||
#define GPIO_BASE 0x200000
|
||||
#define PWM_BASE 0x20C000
|
||||
#define CLOCK_BASE 0x101000
|
||||
|
@ -90,6 +87,16 @@
|
|||
#define SERVO_MOVING 2
|
||||
#define SERVO_STOP 3
|
||||
|
||||
|
||||
#define N_MODEL_PERIPHERAL_BASES 4
|
||||
|
||||
static uint32_t model_peripheral_base[N_MODEL_PERIPHERAL_BASES] =
|
||||
{
|
||||
0x20000000, 0x3F000000, 0x3F000000, 0xfe000000
|
||||
};
|
||||
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
pthread_mutex_t mutex;
|
||||
|
@ -398,12 +405,31 @@ servo_move(int pan, int tilt, int delay)
|
|||
void
|
||||
servo_init(void)
|
||||
{
|
||||
int fd, peripheral_base, pan_alt, tilt_alt;
|
||||
uint32_t divi, t1, t2;
|
||||
int fd, pan_alt, tilt_alt, n;
|
||||
uint32_t divi, t1, t2, peripheral_base;
|
||||
|
||||
pan_cur = tilt_cur = 150.0;
|
||||
if (!pikrellcam.have_servos)
|
||||
return;
|
||||
|
||||
n = pikrellcam.pi_model - 1;
|
||||
if (n < 0)
|
||||
{
|
||||
log_printf_no_timestamp("======= Servo init failed: Unknown Pi model.\n");
|
||||
return;
|
||||
}
|
||||
if (n >= N_MODEL_PERIPHERAL_BASES)
|
||||
{
|
||||
n = N_MODEL_PERIPHERAL_BASES - 1;
|
||||
log_printf_no_timestamp(
|
||||
" ======= Servo assuming peripheral base is same as Pi %d.\n",
|
||||
N_MODEL_PERIPHERAL_BASES);
|
||||
}
|
||||
peripheral_base = model_peripheral_base[n];
|
||||
log_printf_no_timestamp(
|
||||
"======= Servo Pi %d init using peripheral base: 0x%x.\n",
|
||||
pikrellcam.pi_model, peripheral_base);
|
||||
|
||||
if (pikrellcam.servo_use_servoblaster)
|
||||
{
|
||||
pwm_width_func = pwm_width_servoblaster;
|
||||
|
@ -427,13 +453,12 @@ servo_init(void)
|
|||
pan_channel = tilt_channel = -1;
|
||||
return;
|
||||
}
|
||||
peripheral_base = (pikrellcam.pi_model == 2)
|
||||
? PI_2_PERIPHERAL_BASE : PI_1_PERIPHERAL_BASE;
|
||||
|
||||
|
||||
if ((fd = open("/dev/mem", O_RDWR|O_SYNC) ) < 0)
|
||||
{
|
||||
pan_channel = tilt_channel = -1;
|
||||
log_printf_no_timestamp("======= Servo init failed: /dev/mem open failed.");
|
||||
log_printf_no_timestamp("======= Servo init failed: /dev/mem open failed.\n");
|
||||
return;
|
||||
}
|
||||
gpio_mmap = (uint32_t *) mmap(NULL, 0x100, PROT_READ|PROT_WRITE, MAP_SHARED,
|
||||
|
|
|
@ -68,6 +68,10 @@ And there is a Raspberry Pi
|
|||
<span style='font-size: 1.5em; font-weight: 650;'>Release Notes</span><hr>
|
||||
<div class='indent0'>
|
||||
|
||||
<br>
|
||||
Version 4.2.1 - Changes for Pi 4 peripheral base and Buster installs.
|
||||
<br>
|
||||
|
||||
Version 4.2.0
|
||||
<div class='indent1'>
|
||||
<a href="help.php#MOTION_EVENTS_FIFO">motion_detects_FIFO</a> can be read
|
||||
|
|
Loading…
Reference in New Issue