Ver Fonte

fix lot of things

Pierre Bourdin há 2 dias atrás
pai
commit
496aac0192
10 ficheiros alterados com 96 adições e 153 exclusões
  1. 16 28
      acquisition_process/1_capture
  2. 22 17
      convert_process/2_convert
  3. 9 4
      functions.sh
  4. 7 6
      start.sh
  5. 6 2
      tx_process/3_transmit
  6. 0 34
      tx_process/easter1
  7. 0 17
      tx_process/easter2
  8. 0 39
      tx_process/easter3
  9. 28 3
      tx_process/qpsk31
  10. 8 3
      variables.sh

+ 16 - 28
acquisition_process/1_capture

@@ -10,8 +10,10 @@ rm -rf /ramfs/*.jpg
 echo "=> Acquisition on !"
 DATE=$(date +%y%m%d_%H%M%S)
 
-
-
+###########################################
+# Si présence d'un GPS quelconque 
+# On va traîter les infos et les intégrer 
+# dans les métadatas.
 
 acquire_with_gps() {
 
@@ -56,22 +58,26 @@ else
 	exiftool -GPSAltitude=$ALTITUDE /ramfs/$DATE.jpg -overwrite_original
 fi
 
-echo "Picz $DATE.jpg saved in RAM"
 cp /ramfs/$DATE.jpg ~/_Pictures
+echo "Picz $DATE.jpg saved in RAM and is flagged to .canbevoncerted"
 echo "$DATE.jpg" > /ramfs/.canbeconvert
-echo "Sleeping... zzzZZZzzZZZzzz..."
-sleep 5
 }
 
+##########################################
+# Pas de GPS, pas de métadatas.
+
 acquire_without_gps() {
 
-echo "Picz $DATE.jpg saved in RAM (without GPS Datas)"
 cp /ramfs/$DATE.jpg ~/_Pictures
 echo "$DATE.jpg" > /ramfs/.canbeconvert
-echo "Sleeping... zzzZZZzzZZZzzz..."
-sleep 5
+echo "Picz $DATE.jpg saved in RAM and is flagged to .canbevoncerted"
 }
 
+
+##########################################
+# Acquisition de l'image 
+# Boucle principale
+
 raspistill -o /ramfs/$DATE.jpg
 if [ $? -eq 0 ]; then
 
@@ -92,27 +98,9 @@ if [ $? -eq 0 ]; then
         acquire_without_gps
     fi
 
-# pour le raspistille
+    sleep $DELAY_ACQUISITION
+
 else
   echo "Picz failed to be acquired..."
   /home/pi/BallonSonde/tx_process/4_tx_file /home/pi/BallonSonde/sound/error_camera.wav
 fi
-
-
-
-if [[ $HAVEGPS == 1 ]]
-then
-    $READ_NMEA_PATH > /ramfs/.out
-    cat /ramfs/.out | grep "Pas de signal GPS"
-
-    if [[ $? -eq 0 ]]; then
-        echo "Pas de signal GPS"
-        echo "Don't have GPS datas, continue without these datas"
-        GPS_SIGNAL="KO"
-    else
-        echo "Signal GPS OK"
-    fi
-
-else
-    GPS_SIGNAL="KO"
-fi

+ 22 - 17
convert_process/2_convert

@@ -6,8 +6,8 @@
 source ~/BallonSonde/variables.sh
 
 while [[ ! -f /ramfs/.canbeconvert ]]; do
-	sleep 1
-	echo "wait for file to convert..."
+    sleep 1
+    echo "wait for file to convert..."
 done
 
 IMG=$(cat /ramfs/.canbeconvert)
@@ -16,8 +16,8 @@ echo "=> File $IMG detected !"
 #############
 # Mode SSTV
 while [[ -f "/ramfs/totx.wav" ]]; do 
-	echo "=> Skipping convert, because old one is not yet Txed !"
-	sleep 5
+    echo "=> Skipping convert, because old one is not yet Txed !"
+    sleep 5
 done
 
 # On traite l'image...
@@ -30,24 +30,29 @@ echo "=> Adding annotaion"
 mogrify -format 'jpg' -font Liberation-Sans -fill white -undercolor '#00000080' -pointsize 24 -gravity NorthEast -annotate +40+10 $SSTV_BANNER /ramfs/lit-$IMG
 mogrify -format 'jpg' -font Liberation-Sans -fill white -undercolor '#00000080' -pointsize 24 -gravity NorthEast -annotate +40+50 " $(date -u --date=@$(date "+%s"))" /ramfs/lit-$IMG
 
-echo "=> Adding GPS Position"
 
-# On cherche à voir si on a la position GPS ou non dans le exif
-exiftool ~/_Pictures/$IMG | grep -e "GPS Position" -e "GPS Altitude"
-echo $?
-if [ $? -eq 0 ]
+if [[ $HAVE_GPS = 1 ]]
 then
-  GPS_POS=$(exiftool ~/_Pictures/$IMG | grep "GPS Position" | cut -d":" -f2)
-  ALTITUDE=$(exiftool ~/_Pictures/$IMG | grep "GPS Altitude" | cut -d":" -f2)
-  mogrify -format 'jpg' -font Liberation-Sans -fill white -undercolor '#00000080' -pointsize 24 -gravity NorthEast -annotate +40+410 "Altitude : $ALTITUDE" /ramfs/lit-$IMG
-  mogrify -format 'jpg' -font Liberation-Sans -fill white -undercolor '#00000080' -pointsize 24 -gravity NorthEast -annotate +40+450 "$GPS_POS" /ramfs/lit-$IMG
-else
-  mogrify -format 'jpg' -font Liberation-Sans -fill white -undercolor '#00000080' -pointsize 24 -gravity NorthEast -annotate +40+410 "Altitude : Unknown" /ramfs/lit-$IMG
-  mogrify -format 'jpg' -font Liberation-Sans -fill white -undercolor '#00000080' -pointsize 24 -gravity NorthEast -annotate +40+450 "NO GPS." /ramfs/lit-$IMG
+    echo "=> Adding GPS Position"
+
+    # On cherche à voir si on a la position GPS ou non dans le exif
+    exiftool ~/_Pictures/$IMG | grep -e "GPS Position" -e "GPS Altitude"
+    echo $?
+    if [ $? -eq 0 ]
+    then
+        GPS_POS=$(exiftool ~/_Pictures/$IMG | grep "GPS Position" | cut -d":" -f2)
+        ALTITUDE=$(exiftool ~/_Pictures/$IMG | grep "GPS Altitude" | cut -d":" -f2)
+        mogrify -format 'jpg' -font Liberation-Sans -fill white -undercolor '#00000080' -pointsize 24 -gravity NorthEast -annotate +40+410 "Altitude : $ALTITUDE" /ramfs/lit-$IMG
+        mogrify -format 'jpg' -font Liberation-Sans -fill white -undercolor '#00000080' -pointsize 24 -gravity NorthEast -annotate +40+450 "$GPS_POS" /ramfs/lit-$IMG
+    else
+        mogrify -format 'jpg' -font Liberation-Sans -fill white -undercolor '#00000080' -pointsize 24 -gravity NorthEast -annotate +40+410 "Altitude : Unknown" /ramfs/lit-$IMG
+        mogrify -format 'jpg' -font Liberation-Sans -fill white -undercolor '#00000080' -pointsize 24 -gravity NorthEast -annotate +40+450 "NO GPS." /ramfs/lit-$IMG
       
+    fi
+else
+    echo "=> HAVE_GPS = 0, add nothing"
 fi
 
-
 echo " => Converting image to WAV..."
 cd ~/PySSTV/
 source bin/activate

+ 9 - 4
functions.sh

@@ -5,9 +5,11 @@ raspi-gpio set $GPIO_PTT op
 ptt_on () {
 if [[ $PTTLOGIC == 0 ]];
 then
-	raspi-gpio set $GPIO_PTT dl
+    if [[ $BLOCK_WIFI_DURING_TX = 1 ]]; then rfkill block wifi; fi
+    raspi-gpio set $GPIO_PTT dl
 else
-	raspi-gpio set $GPIO_PTT dh
+    raspi-gpio set $GPIO_PTT dh
+     if [[ $BLOCK_WIFI_DURING_TX = 1 ]]; then rfkill unblock wifi; fi
 fi
 }
 
@@ -15,8 +17,11 @@ fi
 ptt_off () {
 if [[ $PTTLOGIC == 0 ]];
 then
-        raspi-gpio set $GPIO_PTT dh
+    if [[ $BLOCK_WIFI_DURING_TX = 1 ]]; then rfkill block wifi; fi
+    raspi-gpio set $GPIO_PTT dh
+
 else    
-        raspi-gpio set $GPIO_PTT dl
+    raspi-gpio set $GPIO_PTT dl
+     if [[ $BLOCK_WIFI_DURING_TX = 1 ]]; then rfkill unblock wifi; fi
 fi      
 }

+ 7 - 6
start.sh

@@ -1,10 +1,11 @@
 #!/bin/bash
 
-# To delay with the rest of the system
+acquisition_process/1_capture
+convert_process/2_convert
+tx_process/3_transmit
 
 
-#sleep 10
-while true
-do
-	run-parts ~/BallonSonde/process/
-done
+#while true
+#do
+#	run-parts ~/BallonSonde/process/
+#done

+ 6 - 2
tx_process/3_transmit

@@ -46,8 +46,12 @@ aplay /ramfs/psk.wav
 
 ###########################
 # Partie CW super crade
-ARGS=$(~/BallonSonde/read_nmea.py | awk '{print $3 $5}' | awk -F'[=,]' '{print "--lat " $2 " --lon " $4}')
-QTH=$(~/BallonSonde/qth_locator.py location_to_square $ARGS)
+
+if [[ $HAVE_GPS = 1 ]]
+then
+    ARGS=$(~/BallonSonde/read_nmea.py | awk '{print $3 $5}' | awk -F'[=,]' '{print "--lat " $2 " --lon " $4}')
+    QTH=$(~/BallonSonde/qth_locator.py location_to_square $ARGS)
+fi
 
 MESSAGE="$INDICATIF-AM $INDICATIF-AM from France 
 QTH : $QTH 

+ 0 - 34
tx_process/easter1

@@ -1,34 +0,0 @@
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%:%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%---%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%-----%%%%%%%%%%%%%%%%%%%-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%% -----+%%%%%%%%%%%%%%%%%---:%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%:-------.%%%%%%%%%%%%%%*-------%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%----- ----.%%%%%%%%%%%%.--------:%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%-----------:%%%%%%%%%%------------%%%%%%%%%%%%%%%@%%%%%%%%
-%%%%%%%%%%%%%%%%-------------.%%%%%%%.--------------.%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%+--------------.%%%%% -----------------*%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%% ----.-------:---#%%%.--------------------%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%% ------------------%%------------------+-----%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%-------------------------- ---------------------%%%%%@%%%%%%%%%
-%%%%%%%%%%%#--- --------------- ------------------------------%%%%%%%%%%%%%
-%%%%%%%%%%%------------------------------------------------------%%%%%%%%%%
-%%%%%%%%%%---------------:--.-------------------------------------.%%%%%%%%
-%%%%%%%%%-----------------------------------------------------------.%%%%%%
-%%%%%%%%+----------------.-------------:--------------------------@@@-#%%%%
-%%%%%%%+---:------------@@--------------------------------------*@@@--*%%%%
-%%%%%%+---------------:-@@@@*------------------ ---------------@@@--.%%%%%%
-%%%%%+@@@--------------:---@@@@@---------------------------*@@@@---*%%%%%%%
-%%%%.--@@@@@@@@@@@@@@%@@@ ---%@@@@@@*-------------------@@@@@*--+#%%%%%%%%%
-%%%%%%% ----%@@@@@@@@@@@@@@@ -----%@@@@@@@@@@@@@@@@@@@@@@@---- %%%%%%%%%%%%
-%%%%%%%%%%%%%: :----------+  .%% ----------@@@@@@@-------- #%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  .----------:  %%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-

+ 0 - 17
tx_process/easter2

@@ -1,17 +0,0 @@
-@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
-@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
-@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
-@@@@@-@--+------+-------------------------#*-@@@@@
-@@@@@-@-----------------------------------@-@@@@@@
-@@@@@@-@----------------------------------@-@@@@@@
-@@@@@@-@---------------------------------*@-@@@@@@
-@@@@@@@-@----------------------------+---@-@@@@@@@
-@@@@@@@--@------------------------------@-@@@@@@@@
-@@@@@@@@--@----------------------------@-#@@@@@@@@
-@@@@@@@@@*-@------+------------------%@-@@@@@@@@@@
-@@@@@@@@@@@--@----------------------@--@@@@@@@@@@@
-@@@@@@@@@@@@@--@@----------------@@--@@@@@@@@@@@@@
-@@@@@@@@@@@@@@@---@@@*------@@@@--@@@@@@@@@@@@@@@@
-@@@@@@@@@@@@@@@@@@@-----------#@@@@@@@@@@@@@@@@@@@
-@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
-

+ 0 - 39
tx_process/easter3

@@ -1,39 +0,0 @@
-
-
-======--=---------:::::::::::::::::::::----------::::::::::::------:::::::::::::---------------===++
-==-------------:::::::::::::::::::::::---------:::::::::::::::::::::::::::::::::::--::-:::::---====+
----------------::::::::::-----::::::::::::-::-::::::::::::::::::::::::::--:::::::::-:::::::::----===
-===------------:::--:--:::------:::::::::::::::::::::-::::::::::::::::::::--::::::::--::::::-------=
-===------------::::-------:::-:::::::::::::::--:::----::::-:---------:::::-::::::::-------:------::-
-=-----------:::::::::--:::::----::::::::::::-----:---==-::==-%#+=====---:::-::::::::::--------------
---------:::::::::::::--::::::::---::::::--::-=++===-+=+===+++*#*++++++*+-:---:--::-::::------=------
---------:::::::::::::::::-::::::::--=----=======++==+==-=+***#*+++++****=---=-----:--:::=--=--==--==
----------::::::::::::-----:---==+===++======++++==+++++=***#####*++#*#-+===------====----=====------
-------------=-----==---=++=====+=+---::-::--*==+==+*+****##@##*+-===---=--%@*==+++====---+-==-------
-------------========++=++++=:----====++=++++==--:---=-==+===%##+=+++====++=++++*+*+*++=-----=-------
-------#---===+=+++***++*+=:-===++=========-=-==-=-=--====++=###*++*+***+##=*+*****++++=-------------
-------*=--==++*+***+-::--=====+++++======---+++++++++=+*+++*+=##*++##*#*#%%%*+*+*#***+=---=:--------
--::::-#=--++***##+**-::--===++***++**=+*++++++=+++++++**+**+*+=###++%@*#####+***#***++=---=:::------
-------%*=-=+*######*--:--++++++*++**++++=#+++***+*#*=*++****+*+=#*%*##**+=+****####*++=---=:::::::::
-------##=--+*####***+---=+**+*++*+***+++++*+**+*+**++*+*+**#++#*+*+*######*++********+=----:::::::::
-++====*##---+#*****#*-:-=+*+***+*++*+=+=+**+=++++#*++=****++++=#***+=#@@#**#****#***+=----::::::::::
--------%##=-=*######**---=+*****+*#+++++***#+**+*#**+=++*****+*+#++%%%#+#+*+#####***+=----::::::::::
-----:::=###=-=+######*+--=+********#**+*#+*+++****+**+**+#*+++=#***+@@@**+*#********+=--==:::-------
---------#%##=-=+###+##*=---+*********+*#**=%**+*+**+*+++++*++**+%##**+***#***+*****+=---=:::-------=
-==-------%###===+*####%#=--=+*****#**+++*=*%+*++%#++*#+++*++#*+==%#**#**#**#***#**++---------------=
-+==-------####====+**%%%#---+*****#*#**+*++#+*++%#*+=***+++*=*#**=+#*#*****###***+=----+-------=====
-=======-----#%#@+==+*%#%##---=++*******+*****++%=#++=*+++****=***#****#*###****++=----=*++=-===++++*
-++**=+=+++*#***#@%+==+%%#%%----=+++*+++**+****+*+*+++=+**+=**++********#***+++=----:-=-===========--
-++=====---------*%%@+===%#%%#----=+*+**********#+*****###*++***####*****#**++=-----=====+=++++*+==+*
-+++==+====--------#%%@+==%%@@%=----+=+******#*#*###**#**#*+*****#*******+++=------=======++==+++++=+
-+++========------=-=-*%@@++%%@@%------===+****#**##*###**#*********+++=+==------=++=====++==+====-++
-**++++=++===========-===+#@@%@@@@@-------=+++++**#*****##******+++++====-----==*++**++*=++=+==++++=+
-+*++*=+===-===-====-===+=*#%%@@@@@@@*=-------====++++++++++=+====----------=+*##***+++*++=======***+
-***#*+*+++===++***####%%%%@@@@@@@@@@@@@#=-------------------------------=+%%#%#****#*+++=*++*+++*%@%
-*+++++===+==++++*##%#%%%@@@@@@@@@@@@@@@%@@@%==---------------------=+#@@@%####**+++****++=+++====***
-#####++##*#****#####%#%%%%%%##**+*##%@@@@@@@@@@@@@@%++++=+++#@@@@@@@%%##**+++++++*##**#*++**+*+++**+
-*%%%%###**##*+**+*+=+***#**###%%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%%##*++=++==++++++++-+=-+*+=****##***##
-%%%%%@###+==+**##+*******##%%%@@@@@@%@%%%%@@@%%%@%%#%#%%#%##**#####*++====+=++*-+-=+=+++++***#%%#%%%
-*****%%#**#%*#**++++***####%%%%%%%%%%%%%%###*###***+****##+*+**++=*==+*==--======+=+=+=+===+*++##*#*
-
-

+ 28 - 3
tx_process/qpsk31

@@ -2,10 +2,14 @@
 
 source ~/BallonSonde/variables.sh
 
-PSK="~/PSK31-Modulation-WAV-Generator/psk"
-GPS=$(~/BallonSonde/read_nmea.py)
+PSK=~/PSK31-Modulation-WAV-Generator/psk
 
-DATA="
+if [[ $HAVE_GPS = 1 ]]
+then
+
+    GPS=$(~/BallonSonde/read_nmea.py)
+
+    DATA="
 -=-=-=-=-=-=-=-=-=-=-=-=-=
 $INDICATIF-AM $INDICATIF-AM
 Computer say that we are approximatively here :
@@ -23,4 +27,25 @@ $INDICATIF-AM over.
 -=-=-=-=-=-=-=-=-=-=-=-=-=
 
 "
+else
+
+    
+	DATA="
+-=-=-=-=-=-=-=-=-=-=-=-=-=
+$INDICATIF-AM $INDICATIF-AM
+
+$(cat ~/BallonSonde/tx_process/easter$((1 + $RANDOM % 5)))
+
+From $COUNTRYFROM, launched near $CITYFROM
+
+Send feedback or something in $WEBSITE_REPORT !
+
+<3 Peace, love, NO WAR !
+$INDICATIF-AM over.
+-=-=-=-=-=-=-=-=-=-=-=-=-=
+"
+
+
+fi
+
 $PSK -m qpsk -s 500 -f /ramfs/psk.wav -t "$DATA"

+ 8 - 3
variables.sh

@@ -1,12 +1,12 @@
 #!/bin/bash
 
 INDICATIF="F4IYQ"
-
-CITYFROM="Vaulry"
+CITYFROM="Aubusson"
 COUTRYFROM="France"
+QTH="JN15CW"
 
 # Ne doit pas dépasser 48 caractères sinon ça dépasse sur l'image
-SSTV_BANNER="Ballon machin truc, mission truc."
+SSTV_BANNER="F4KOA-AM - Fête de la Science Limousin"
 
 WEBSITE_REPORT="https://f4koa.fr"
 
@@ -15,6 +15,11 @@ GPIO_PTT="22"
 # Selon comment on cable le transistor pour le PTT
 # Peux être à 1 pour activer le PTT ou 0
 LOGICPTT=1
+BLOCK_WIFI_DURING_TX=1
 
 # don't try to put GPS position on pictures and exif infos.
 HAVE_GPS=0
+
+DELAY_BETWEEN_ACQUISITION=10
+DELAY_BETWEEN_TX=30
+