forked from alex-agency/XYC
-
Notifications
You must be signed in to change notification settings - Fork 0
/
xyc.sh
2388 lines (2270 loc) · 69.7 KB
/
xyc.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# Xiaomi Yi Configurator
# http://www.tawbaware.com
# (c) Tawbaware software, 2015
#
# Description: This script runs inside the Xiaomi Yi camera and allows the user
# to enable RAW file creation, and change photographic options such as
# exposure, ISO, whitebalance, etc. It is designed to be executed and accessed
# via a telnet client running on any phone, computer, tablet, etc.
#
#
# Installation:
#
# 1. Install script at top level of SD card and ensure execute permissions:
# chmod 755 /tmp/fuse_d/xyc.sh
# 2 Optional. If you have custom settings that you want to be included in the
# autoexec.ash file, store these commands in a file named autoexec.xyc in
# the same directory as xyc.sh. Also, using XYC, set the "Import User settings"
# menu choice to "yes". XYC will copy everything from the autoexec.xyc into
# autoexec.ash whenever it updates autoexec.ash.
# 3. Optional. If you want XYC to operate in a language other than English,
# create a file named xyc_strings.sh in the same directory as xyc.sh. See
# "TRANSLATION STRINGS" section below.
#
# Usage:
#
# 1. Enable wifi, and connect to camera using telnet
# (IP=192.168.42.1, user id="root", no password)
# 2. Run script: /tmp/fuse_d/xyc.sh
#
# Changelog:
#
# 1.0.1 (Feb 2016) - Simplified user interface for support different languages
# by Alex - Updated support for 6 languages
# - Updated YiMAX preset
# - Updated WaffleFPV preset to V8
# - Better quality with Alex_Day preset
# - Night vision with Alex_Night preset
# - Predefined saturation adjustments
# - Added scene mode
# - Renovate sharpness and coring
# - Save battery adjustment
# - Ability to change buzzer volume
# 0.3.5 (Jan 2016) - Added SuperView feature
# by Alex - Added WaffleFPV preset
# 0.3.4 (Dec 2015) - Added Time-lapse script
# by Alex - Added ability to use Time-lapse with HDR, RAW and others settings
# - Added ability to save and reuse different presets
# - Added ability to set bitrates for all resolutions
# - Added new video frequencies: 24fps, 48fps
# - Resolved 2560x1440 resolution, it's upscaling from 2304x1296
# - Added ability to adjust Auto Knee, Gamma level
# - Increased script performance
# - Fixed issue in XYC Update
# - Fixed issue in HDR scripts
# - Removed GoPrawn script
# 0.3.3 (Oct 2015) - Support latest 1.2.13 firmware
# by Alex - Added support file weight limit to 4GB
# - Added 1440p resolution for test purpose
# - Added ability managing Noise Reduction
# - Added new bitrates for Video Quality (40-50Mb)
# - Added XYC Update feature for automatic download new version
# - Removed Time Lapse script (use YiCam app Time-lapse with XYC camera settings)
# 0.3.2 (Sep 2015) - Updated YiMax script
# by Alex - Added shadow/highlight/gamma script
# - Added sharpness script
# - Fixed HDR scripts and added HDR Night
# 0.3.1 (Sep 2015) - Ported features from XYC v4.6 https://rendy37.wordpress.com/2015/08/13/xiaomi-yi-configurator-xyc-ubah-script-tanpa-pc/
# by Alex - Added YiMax Movie script http://nutseynuts.blogspot.com/2015/06/xiaomi-yi-action-cam-custom-scripts.html
# - Simplified menu interface
# - Fixed issues
# 0.2.0 (Aug 2015) - Added support for alternate langauges
# - Added support for user settings
# - Standardized menu interface
# 0.1.0 (Aug 2015) - Initial release
# Disclaimer: This software is not created or endorsed by Xiaomi; it relies on
# undocumented features of the Xiaomi Yi. Using this software may void your
# camera's warranty and possibly damage your camera. Use at your own risk!
VERS="1.0.1 Alex"
FUSED=/tmp/fuse_d
SCRIPT_DIR=$(cd `dirname "$0"` && pwd)
WEB=/var/www
if [ ! -d "$FUSED" ]; then
FUSED=$SCRIPT_DIR
if [ -d "$WEB" ]; then
FUSED=$WEB
fi
fi
AASH=${FUSED}/autoexec.ash
CORCONF=${FUSED}/sharpening.config
THIS_SCRIPT="$SCRIPT_DIR/`basename "$0"`"
LANGUAGE_FILE="$SCRIPT_DIR/xyc_strings.sh"
USER_SETTINGS_FILE="$SCRIPT_DIR/autoexec.xyc"
PRESETS_FILE="$SCRIPT_DIR/xyc_presets.sh"
#=============================================================================
#
# TRANSLATION STRINGS
#
# This list of variables contains the user interface strings for the English
# Language. English is the default language for this program, but other
# languages can be easily supported. If you wish to translate xyc to a
# different language, create a file named xyc_strings.sh in the same directory
# as xyc.sh, and store translated versions of (any or all) these XYC_* strings
# in that file.
XYC_MAIN_MENU="Main Menu"
XYC_EDIT_PHOTO_SETTINGS="Edit Photo settings"
XYC_EDIT_VIDEO_SETTINGS="Edit Video settings"
XYC_RESET_SETTINGS="Reset all settings"
XYC_RESTART_CAMERA="Restart camera"
XYC_EXIT="Exit"
XYC_INVALID_CHOICE="Invalid choice"
XYC_SD_CARD_USAGE="SD Card usage"
XYC_TOTAL="Total"
XYC_USED="Used"
XYC_FREE="Free"
XYC_FILE_COUNTS="File counts"
XYC_ESTIMATED_REMAINING="Estimated remaining file capacity"
XYC_MINUTES="minutes"
XYC_UNKNOWN_OPTION="Warning...unknown option"
XYC_ISO="ISO"
XYC_EXPOSURE="Exposure"
XYC_AWB="AWB"
XYC_CREATE_RAW="Create RAW"
XYC_RAW="RAW"
XYC_YES="Yes"
XYC_NO="No"
XYC_Y="y"
XYC_N="n"
XYC_ON="On"
XYC_OFF="Off"
XYC_AUTO="Auto"
XYC_ENTER="Enter"
XYC_ENTER_AWB_PROMPT="Auto White Balance"
XYC_CREATE_RAW_PROMPT="Create RAW files"
XYC_REBOOTING_NOW="Rebooting now"
XYC_WRITING="Writing"
XYC_DELETING="Deleting"
XYC_CREATE_HDR="Create HDR script"
XYC_PHOTO_SETTINGS="Photo Settings"
XYC_VIDEO_SETTINGS="Video Settings"
XYC_INCLUDE_USER_SETTINGS_PROMPT="Import settings from autoexec.xyc"
XYC_HDR_SETTINGS="HDR Settings"
XYC_CANNOT_READ="WARNING: Cannot read/access"
XYC_USER_IMPORT="Import User settings"
XYC_SEC="sec"
XYC_REMOVING="Removing"
XYC_DELETE_VIDEO_PREVIEW_PROMPT="Delete All Video Preview files"
XYC_DELETE_RAW_PROMPT="Delete All RAW files"
XYC_HDR="HDR"
XYC_HDR_RESET="Reset HDR settings"
XYC_RESOLUTION="Resolution"
XYC_DEFAULT="Default"
XYC_FREQUENCY="Frequency"
XYC_BITRATE="Bitrate"
XYC_AUTOKNEE="Auto Knee"
XYC_AUTOKNEE_PROMPT="Auto Knee level"
XYC_SHARPNESS="Sharpness"
XYC_SHARPNESS_FIR="Digital Filter"
XYC_SHARPNESS_COR="Coring"
XYC_SHR_MODE_VIDEO="Video"
XYC_SHR_MODE_FAST="Fast Still"
XYC_SHR_MODE_LOWISO="LowISO Still"
XYC_SHR_MODE_HIGHISO="HighISO Still"
XYC_SHARPNESS_FIR_PROMPT="Sharpness Digital Filter"
XYC_SHARPNESS_COR_PROMPT="Sharpness Coring"
XYC_BIG_FILE="4Gb files"
XYC_BIG_FILE_PROMPT="Set file weight limit to 4GB"
XYC_NOISE_REDUCTION="Noise Reduction"
XYC_CUSTOM_NR_PROMPT="Noise Reduction level"
XYC_MAX="Max"
XYC_DISABLE="Disable"
XYC_UPDATING_NOW="Updating now"
XYC_SCRIPT_UPDATE="Update XYC"
XYC_UPDATE_NOW_PROMPT="Download latest and rewrite existing XYC"
XYC_NO_INTERNET="The script doesn't have internet connection."
XYC_UPDATE_ERROR="It's required for download XYC update."
XYC_UPDATE_COMPLETE="Update complete."
XYC_UPDATE_MANUAL="For download script manually browse to"
XYC_CREATE_FILE="First create"
XYC_BITRATE_ALL="Bitrate all"
XYC_AAA="AE/AWB/ADJ locks"
XYC_AAA_PROMPT="Set AE/AWB/ADJ locks"
XYC_GAMMA="Gamma"
XYC_GAMMA_PROMPT="Gamma level"
XYC_CUSTOM="Custom"
XYC_VIBSAT="Saturation"
XYC_PRESETS="Manage XYC Presets"
XYC_NO_PRESETS="You don't have any preset, create it first."
XYC_CREATE_PRESET="Create new Preset"
XYC_REMOVE_PRESET="Remove Preset"
XYC_LOAD_PRESET="Load Preset"
XYC_NEW_PRESET_PROMPT="Enter name of current configuration"
XYC_NAME_EXIST="Specified name already exist"
XYC_PRESET_CREATED="XYC settings were saved to"
XYC_PRESET_LOADED="Preset loaded"
XYC_PRESET_REMOVED="Preset removed"
XYC_CREATE_TIME_LAPSE="Create Time-lapse script"
XYC_TIME_LAPSE_SETTINGS="Time-lapse Settings"
XYC_TIME_LAPSE_RESET="Reset Time-lapse settings"
XYC_TIME_LAPSE_MODE="Time-lapse Mode"
XYC_TIME_LAPSE_CYCLES="Time-lapse Cycles"
XYC_TIME_LAPSE_INTERVAL="Time-lapse Interval"
XYC_RUN_ONCE_ONLY="Run once only"
XYC_ALLOW_POWEROFF="Allow poweroff"
XYC_SHUTTING_DOWN_NOW="Shutting down now"
XYC_NUM_CYCLES_PROMPT="Number of cycles"
XYC_CYCLES_INTERVAL_PROMPT="Interval between cycles, sec"
XYC_RUN_ONCE_ONLY_PROMPT="Remove time-lapse script when complete"
XYC_POWEROFF_WHEN_COMPLETE_PROMPT="Poweroff camera when complete"
XYC_RESTART_TO_APPLY="Restart your camera to apply settings."
XYC_INVINITY="Invinity"
XYC_SUPERVIEW="SuperView"
XYC_VIEW_AUTOEXEC="View Autoexec.ash"
XYC_EDIT_CAMERA_SETTINGS="Edit Camera settings"
XYC_CAMERA_UTILS="Camera Utils"
XYC_LONG_EXPOSURE="Long Exposure"
XYC_SHORT_EXPOSURE="Short Exposure"
XYC_CAMERA_SETTINGS="Camera Settings"
XYC_SD_CARD_CLEANUP="SD Card cleanup"
XYC_MIN="Min"
XYC_DAY="Day"
XYC_NIGHT="Night"
XYC_MENU="Menu"
XYC_MODE="Mode"
XYC_WARNING="Warning!"
XYC_SUPER_HIGH="Super High"
XYC_HIGH="High"
XYC_NORMAL="Normal"
XYC_LOW="Low"
XYC_GRAY="Gray"
XYC_SAVE_BATTERY="Save battery"
XYC_SAVE_BATTERY_PROMPT="Save battery adjustment"
XYC_BUZZER_VOLUME="Buzzer volume"
XYC_BUZZER_VOLUME_PROMPT="Buzzer volume level"
XYC_JPEG_QUALITY="Jpeg 100"
XYC_JPEG_QUALITY_PROMPT="JPEG quality 100%"
XYC_SCENE="Scene Mode"
XYC_LANDSCAPE="Landscape"
XYC_PORTRAIT="Portrait"
XYC_THROUGH_GLASS="Through glass"
XYC_CAR_DV="Car DV"
XYC_FPS="FPS"
XYC_MBS="Mb/s"
#If language file exists, source it to override English language UI strings
if [[ -s "$LANGUAGE_FILE" && -r "$LANGUAGE_FILE" ]]; then
source $LANGUAGE_FILE
fi
#=============================================================================
welcome ()
{
clear
echo ""
echo " Xiaomi Yi Configurator"
echo " 02/16/2016 ${VERS}"
echo ""
}
showMainMenu ()
{
local REPLY
while [ "$EXITACTION" == "" ]
do
echo " -> ${XYC_MAIN_MENU}"
echo " |- 0: ${XYC_VIEW_AUTOEXEC}"
echo " |- 1: ${XYC_EDIT_CAMERA_SETTINGS}"
echo " |- 2: ${XYC_EDIT_PHOTO_SETTINGS}"
echo " |- 3: ${XYC_EDIT_VIDEO_SETTINGS}"
echo " |- 4: ${XYC_CREATE_TIME_LAPSE}"
echo " |- 5: ${XYC_CREATE_HDR}"
echo " |- 6: ${XYC_PRESETS}"
echo " |- 7: ${XYC_CAMERA_UTILS}"
echo " |- 8: ${XYC_RESET_SETTINGS}"
echo " |- 9: ${XYC_RESTART_CAMERA}"
echo " |- 10: ${XYC_SCRIPT_UPDATE}"
echo " |- 11: ${XYC_EXIT}"
read -p " -> " REPLY
clear
case $REPLY in
0) clear; cat $AASH;;
1) showCameraSettingsMenu; writeAutoexec;;
2) showPhotoSettingsMenu; writeAutoexec;;
3) showVideoSettingsMenu; writeAutoexec;;
4) showTimeLapseMenu; writeAutoexec;;
5) showHDRMenu; writeAutoexec;;
6) showPresetsMenu;;
7) showUtilsMenu; clear;;
8) removeAutoexec; resetCameraSettings;;
9) EXITACTION="reboot";;
10) EXITACTION="update";;
11) EXITACTION="nothing";;
*) echo "${XYC_INVALID_CHOICE}";;
esac
done
}
showCameraSettingsMenu ()
{
local REPLY
while true
do
echo " |- 0: ${XYC_MAIN_MENU}"
echo " |-> ${XYC_CAMERA_SETTINGS} ${XYC_MENU}"
printf " |- 1: ${XYC_AUTOKNEE}: "
if [ -z "$AUTOKNEE" ]; then
echo "${XYC_DEFAULT}"
else
echo "$AUTOKNEE"
fi
printf " |- 2: ${XYC_VIBSAT}: "
if [ -z "$VIBSAT" ]; then
echo "${XYC_DEFAULT}"
elif [ $VIBSAT -eq 1 ]; then
echo "${XYC_SUPER_HIGH}"
elif [ $VIBSAT -eq 2 ]; then
echo "${XYC_HIGH}"
elif [ $VIBSAT -eq 3 ]; then
echo "${XYC_NORMAL}"
elif [ $VIBSAT -eq 4 ]; then
echo "${XYC_LOW}"
elif [ $VIBSAT -eq 5 ]; then
echo "${XYC_GRAY}"
fi
printf " |- 3: ${XYC_SHARPNESS}: "
if [ -z "$SHR" ]; then
echo "${XYC_DEFAULT}"
else
echo "$SHR/$FIR/$COR"
fi
printf " |- 4: ${XYC_SCENE}: "
if [ -z "$SCENE" ]; then
echo "${XYC_DEFAULT}"
elif [ $SCENE -eq 1 ]; then
echo "${XYC_AUTO}"
elif [ $SCENE -eq 13 ]; then
echo "${XYC_LANDSCAPE}"
elif [ $SCENE -eq 14 ]; then
echo "${XYC_PORTRAIT}"
elif [ $SCENE -eq 34 ]; then
echo "${XYC_THROUGH_GLASS}"
elif [ $SCENE -eq 38 ]; then
echo "${XYC_CAR_DV}"
fi
printf " |- 5: ${XYC_USER_IMPORT}: "
if [ "$INC_USER" == ${XYC_Y} ]; then
echo "${XYC_YES}"
else
echo "${XYC_NO}"
fi
printf " |- 6: ${XYC_SAVE_BATTERY}: "
if [ "$BAT" == ${XYC_Y} ]; then
echo "${XYC_YES}"
else
echo "${XYC_NO}"
fi
printf " |- 7: ${XYC_BUZZER_VOLUME}: "
if [ -z "$VOL" ]; then
echo "${XYC_DEFAULT}"
else
echo "$VOL"
fi
read -p " -> " REPLY
case $REPLY in
0) clear; return;;
1) getAutoKneeInput; clear;;
2) getSaturationInput; clear;;
3) getSharpnessInput; clear;;
4) getSceneInput; clear;;
5) getIncludeUserSettings; clear;;
6) getSaveBatteryInput; clear;;
7) getBuzzerVolumeInput; clear;;
*) clear; echo "${XYC_INVALID_CHOICE}";;
esac
done
}
showPhotoSettingsMenu ()
{
local REPLY
while true
do
echo " |- 0: ${XYC_MAIN_MENU}"
echo " |-> ${XYC_PHOTO_SETTINGS} ${XYC_MENU}"
printf " |- 1: ${XYC_EXPOSURE}: "
if [ -z "$EXP" ]; then
echo "${XYC_AUTO}"
else
expView $EXP
echo "$EXPVIEW"
fi
printf " |- 2: ${XYC_ISO}: "
if [ -z "$ISO" ]; then
echo "${XYC_AUTO}"
else
echo "$ISO"
fi
printf " |- 3: ${XYC_AWB}: "
if [ "$AWB" == ${XYC_N} ]; then
echo "${XYC_NO}"
else
echo "${XYC_YES}"
fi
printf " |- 4: ${XYC_CREATE_RAW}: "
if [ "$RAW" == ${XYC_Y} ]; then
echo "${XYC_YES}"
else
echo "${XYC_NO}"
fi
printf " |- 5: ${XYC_JPEG_QUALITY}: "
if [ "$JPEG" == ${XYC_Y} ]; then
echo "${XYC_YES}"
else
echo "${XYC_NO}"
fi
read -p " -> " REPLY
case $REPLY in
0) clear; return;;
1) getExposureInput; clear;;
2) getISOInput; clear;;
3) getAWBInput; clear;;
4) getRawInput; clear;;
5) getJpegInput; clear;;
*) clear; echo "${XYC_INVALID_CHOICE}";;
esac
done
}
showVideoSettingsMenu ()
{
local REPLY
while true
do
echo " |- 0: ${XYC_MAIN_MENU}"
echo " |-> ${XYC_VIDEO_SETTINGS} ${XYC_MENU}"
printf " |- 1: ${XYC_NOISE_REDUCTION}: "
if [ -z "$NR" ]; then
echo "${XYC_DEFAULT}"
elif [ $NR -eq -1 ]; then
echo "${XYC_DISABLE}"
elif [ $NR -eq 0 ]; then
echo "${XYC_MIN}"
elif [ $NR -eq 16383 ]; then
echo "${XYC_MAX}"
else
echo "$NR"
fi
printf " |- 2: ${XYC_AAA}: "
if [ "$AAA" == ${XYC_Y} ]; then
echo "${XYC_YES}"
else
echo "${XYC_DEFAULT}"
fi
printf " |- 3: ${XYC_GAMMA}: "
if [ -z "$GAMMA" ]; then
echo "${XYC_DEFAULT}"
else
echo "$GAMMA"
fi
printf " |- 4: ${XYC_RESOLUTION}: "
if [ -z "$RES" ]; then
echo "${XYC_DEFAULT}"
else
echo "$RESVIEW"
fi
printf " |- 5: ${XYC_SUPERVIEW}: "
if [ -z "$SVIEW" ]; then
echo "${XYC_DISABLE}"
else
echo "$SVIEW"
fi
printf " |- 6: ${XYC_BITRATE_ALL}: "
if [ -z "$BIT" ]; then
echo "${XYC_DEFAULT}"
else
echo "$BITVIEW"
fi
printf " |- 7: ${XYC_BIG_FILE}: "
if [ "$BIG_FILE" == ${XYC_Y} ]; then
echo "${XYC_YES}"
else
echo "${XYC_NO}"
fi
read -p " -> " REPLY
case $REPLY in
0) clear; return;;
1) getNRInput; clear;;
2) getAAAInput; clear;;
3) getGammaInput; clear;;
4) getVideoResolutionInput; clear;;
5) getSuperViewInput; clear;;
6) getVideoBitrateInput; clear;;
7) getBigFileInput; clear;;
*) clear; echo "${XYC_INVALID_CHOICE}";;
esac
done
}
showTimeLapseMenu ()
{
local REPLY
while true
do
echo " |- 0: ${XYC_MAIN_MENU}"
echo " |-> ${XYC_TIME_LAPSE_SETTINGS} ${XYC_MENU}"
printf " |- 1: ${XYC_TIME_LAPSE_MODE}: "
if [ -z "$TLMODE" ]; then
echo "${XYC_DISABLE}"
elif [ $TLMODE -eq 0 ]; then
echo "${XYC_CUSTOM}"
if [ -z "$TLDELAY" ]; then TLDELAY=10; fi;
if [ -z "$TLNUM" ]; then TLNUM=30; fi;
if [ -z "$TLONCE" ]; then TLONCE=${XYC_Y}; fi;
elif [ $TLMODE -eq 1 ]; then
echo "${XYC_INVINITY}"
if [ -z "$TLDELAY" ]; then TLDELAY=10; fi;
unset TLNUM TLONCE TLOFF
elif [ $TLMODE -eq 2 ]; then
echo "${XYC_HDR}"
if [ -z "$TLDELAY" ]; then TLDELAY=10; fi;
unset TLNUM TLONCE TLOFF
fi
printf " |- 2: ${XYC_TIME_LAPSE_INTERVAL}: "
if [[ -z "$TLMODE" || -z "$TLDELAY" ]]; then
echo "${XYC_DISABLE}"
else
echo "$TLDELAY"
fi
printf " |- 3: ${XYC_TIME_LAPSE_CYCLES}: "
if [ -z "$TLMODE" ]; then
echo "${XYC_DISABLE}"
elif [ $TLMODE -eq 0 ]; then
echo "$TLNUM"
else
echo "${XYC_INVINITY}"
fi
printf " |- 4: ${XYC_RUN_ONCE_ONLY}: "
if [ "$TLONCE" == ${XYC_Y} ]; then
echo "${XYC_YES}"
else
echo "${XYC_NO}"
fi
printf " |- 5: ${XYC_ALLOW_POWEROFF}: "
if [ "$TLOFF" == ${XYC_Y} ]; then
echo "${XYC_YES}"
else
echo "${XYC_NO}"
fi
echo " |- 6: ${XYC_TIME_LAPSE_RESET}"
read -p " -> " REPLY
case $REPLY in
0) clear; return;;
1) getTLModeInput; clear;;
2) getTLDelayInput; clear;;
3) getTLNumShotsInput; clear;;
4) getTLOnceInput; clear;;
5) getTLOffInput; clear;;
6) unset TLMODE TLDELAY TLNUM TLONCE TLOFF; clear; return;;
*) clear; echo "${XYC_INVALID_CHOICE}";;
esac
done
}
showHDRMenu ()
{
local REPLY
while true
do
echo " |- 0: ${XYC_MAIN_MENU}"
echo " |-> ${XYC_HDR_SETTINGS} ${XYC_MENU}"
echo " |- 1: ${XYC_HDR} ${XYC_DAY}"
if [ $AUTAN -eq 1 2> /dev/null ]; then
echo " | 1/15 ${XYC_SEC}"
echo " | 1/50 ${XYC_SEC}"
echo " | 1/250 ${XYC_SEC}"
echo " | 1/500 ${XYC_SEC}"
echo " | 1/1244 ${XYC_SEC}"
echo " | 1/8147 ${XYC_SEC}"
fi
echo " |- 2: ${XYC_HDR} ${XYC_NIGHT}"
if [ $AUTAN -eq 2 2> /dev/null ]; then
echo " | 7.9 ${XYC_SEC}"
echo " | 4.6 ${XYC_SEC}"
echo " | 2.7 ${XYC_SEC}"
echo " | 1.0 ${XYC_SEC}"
echo " | 1/3 ${XYC_SEC}"
echo " | 1/15 ${XYC_SEC}"
fi
echo " |- 3: ${XYC_CUSTOM}"
if [ $AUTAN -eq 0 2> /dev/null ]; then
expView $HDR1
echo " | $EXPVIEW"
expView $HDR2
echo " | $EXPVIEW"
expView $HDR3
echo " | $EXPVIEW"
fi
echo " |- 4: ${XYC_HDR_RESET}"
read -p " -> " REPLY
case $REPLY in
0) clear; return;;
1) AUTAN=1; HDR1=900; HDR2=1531; HDR3=2047; clear;;
2) AUTAN=2; HDR1=1; HDR2=300; HDR3=900; clear;;
3) AUTAN=0; getHDRInput; clear;;
4) unset AUTAN HDR1 HDR2 HDR3; clear; return;;
*) clear; echo "${XYC_INVALID_CHOICE}";;
esac
done
}
showPresetsMenu ()
{
clear
local REPLY
while true
do
echo " |- 0: ${XYC_MAIN_MENU}"
echo " |-> ${XYC_PRESETS} ${XYC_MENU}"
echo " |- 1: ${XYC_LOAD_PRESET}"
echo " |- 2: ${XYC_CREATE_PRESET}"
echo " |- 3: ${XYC_REMOVE_PRESET}"
read -p " -> " REPLY
case $REPLY in
0) clear; return;;
1) if showPresetsList "load"; then
writeAutoexec; return;
fi; clear;;
2) getCreatePresetInput; clear;;
3) showPresetsList "remove"; clear;;
*) clear; echo "${XYC_INVALID_CHOICE}";;
esac
done
}
showUtilsMenu ()
{
clear
local REPLY
while true
do
echo " |- 0: ${XYC_MAIN_MENU}"
echo " |-> ${XYC_CAMERA_UTILS} ${XYC_MENU}"
echo " |- 1: ${XYC_SD_CARD_USAGE}"
echo " |- 2: ${XYC_SD_CARD_CLEANUP}"
local REPLY
read -p " -> " REPLY
case $REPLY in
0) clear; return;;
1) showSpaceUsage; clear;;
2) getCleanUpInput; clear;;
*) clear; echo "${XYC_INVALID_CHOICE}";;
esac
done
}
parseCommandLine ()
{
while [ $# -gt 0 ]
do
key="$1"
case $key in
-i) ISO=$2; shift;;
-e) EXP=$2; shift;;
-n) NR=$2; shift;;
-u) INC_USER=$2; shift;;
-t) TLMODE=$2; shift;;
-h) AUTAN=$2; shift;;
*) echo "${XYC_UNKNOWN_OPTION}: $key"; shift;;
esac
shift # past argument or value
# write and close
if [ $# -eq 0 ]; then
writeAutoexec
exit
fi
done
}
parseExistingAutoexec ()
{
#Parse existing values from autoexec.ash
ISO=$(grep "t ia2 -ae exp" $AASH 2>/dev/null | cut -d " " -f 5)
if [ $ISO -eq 0 2> /dev/null ]; then unset ISO; fi
EXP=$(grep "t ia2 -ae exp" $AASH 2>/dev/null | cut -d " " -f 6)
if [ $EXP -eq 0 2> /dev/null ]; then unset EXP; fi
NR=$(grep "t ia2 -adj tidx" $AASH 2>/dev/null | cut -d " " -f 6)
GAMMA=$(grep "t ia2 -adj gamma" $AASH 2>/dev/null | cut -d " " -f 5)
AUTOKNEE=$(grep "t ia2 -adj autoknee" $AASH 2>/dev/null | cut -d " " -f 5)
SCENE=$(grep "t cal -sc" $AASH 2>/dev/null | cut -d " " -f 4)
VOL=$(grep "t pwm 1 set_level" $AASH 2>/dev/null | cut -d " " -f 5)
grep -q "t ia2 -awb off" $AASH 2>/dev/null
if [ $? -eq 0 ]; then AWB=${XYC_N}; fi
grep -q "t app test debug_dump 14" $AASH 2>/dev/null
if [ $? -eq 0 ]; then RAW=${XYC_Y}; fi
grep -q "t cal -jqlt 100" $AASH 2>/dev/null
if [ $? -eq 0 ]; then JPEG=${XYC_Y}; fi
grep -q "t ia2 -3a" $AASH 2>/dev/null
if [ $? -eq 0 ]; then AAA=${XYC_Y}; fi
grep -q "#User settings" $AASH 2>/dev/null
if [ $? -eq 0 ]; then INC_USER=${XYC_Y}; fi
grep -q "t app lowbatt" $AASH 2>/dev/null
if [ $? -eq 0 ]; then BAT=${XYC_Y}; fi
grep -q "#Time-lapse:" $AASH 2>/dev/null
if [ $? -eq 0 ]; then
TLMODE=$(grep "#Time-lapse:" $AASH | cut -d " " -f 2)
TLDELAY=$(grep "#Time-lapse:" $AASH | cut -d " " -f 3)
TLNUM=$(grep "#Time-lapse:" $AASH | cut -d " " -f 4)
TLONCE=$(grep "#Time-lapse:" $AASH | cut -d " " -f 5)
TLOFF=$(grep "#Time-lapse:" $AASH | cut -d " " -f 6)
fi
grep -q "#HDRParams:" $AASH 2>/dev/null
if [ $? -eq 0 ]; then
AUTAN=$(grep "#HDRParams:" $AASH | cut -d " " -f 2)
HDR1=$(grep "#HDRParams:" $AASH | cut -d " " -f 3)
HDR2=$(grep "#HDRParams:" $AASH | cut -d " " -f 4)
HDR3=$(grep "#HDRParams:" $AASH | cut -d " " -f 5)
fi
grep -q "#Sharpness:" $AASH 2>/dev/null
if [ $? -eq 0 ]; then
SHR=$(grep "#Sharpness:" $AASH | cut -d " " -f 2)
FIR=$(grep "#Sharpness:" $AASH | cut -d " " -f 3)
COR=$(grep "#Sharpness:" $AASH | cut -d " " -f 4)
fi
grep -q "t ia2 -adj ev" $AASH 2>/dev/null
if [ $? -eq 0 ]; then
grep -q "t ia2 -adj ev 0 0 160 0 0 190 0" $AASH 2>/dev/null
if [ $? -eq 0 ]; then VIBSAT=1; fi
grep -q "t ia2 -adj ev 0 0 140 0 0 150 0" $AASH 2>/dev/null
if [ $? -eq 0 ]; then VIBSAT=2; fi
grep -q "t ia2 -adj ev 10 0 70 0 0 150 0" $AASH 2>/dev/null
if [ $? -eq 0 ]; then VIBSAT=3; fi
grep -q "t ia2 -adj ev 10 0 70 0 0 100 0" $AASH 2>/dev/null
if [ $? -eq 0 ]; then VIBSAT=4; fi
grep -q "t ia2 -adj ev 10 0 70 0 0 50 0" $AASH 2>/dev/null
if [ $? -eq 0 ]; then VIBSAT=5; fi
fi
grep -q "writeb 0xC06CC426" $AASH 2>/dev/null
if [ $? -eq 0 ]; then
grep -q "writeb 0xC06CC426 0x28" $AASH 2>/dev/null
if [ $? -eq 0 ]; then RES=1; FPS=1; fi
grep -q "writeb 0xC06CC426 0x11" $AASH 2>/dev/null
if [ $? -eq 0 ]; then RES=1; FPS=2; fi
grep -q "writeb 0xC06CC426 0x27" $AASH 2>/dev/null
if [ $? -eq 0 ]; then RES=1; FPS=3; fi
grep -q "writeb 0xC06CC426 0x0F" $AASH 2>/dev/null
if [ $? -eq 0 ]; then RES=1; FPS=4; fi
grep -q "writeb 0xC06CC426 0x34" $AASH 2>/dev/null
if [ $? -eq 0 ]; then RES=1; FPS=5; fi
grep -q "writeb 0xC06CC426 0x26" $AASH 2>/dev/null
if [ $? -eq 0 ]; then RES=2; FPS=1; fi
grep -q "writeb 0xC06CC426 0x17" $AASH 2>/dev/null
if [ $? -eq 0 ]; then RES=2; FPS=2; fi
grep -q "writeb 0xC06CC426 0x25" $AASH 2>/dev/null
if [ $? -eq 0 ]; then RES=2; FPS=3; fi
grep -q "writeb 0xC06CC426 0x16" $AASH 2>/dev/null
if [ $? -eq 0 ]; then RES=2; FPS=4; fi
grep -q "writeb 0xC06CC426 0x24" $AASH 2>/dev/null
if [ $? -eq 0 ]; then RES=3; FPS=1; fi
grep -q "writeb 0xC06CC426 0x0D" $AASH 2>/dev/null
if [ $? -eq 0 ]; then RES=3; FPS=2; fi
grep -q "writeb 0xC06CC426 0x23" $AASH 2>/dev/null
if [ $? -eq 0 ]; then RES=3; FPS=3; fi
grep -q "writeb 0xC06CC426 0x0C" $AASH 2>/dev/null
if [ $? -eq 0 ]; then RES=3; FPS=4; fi
grep -q "writeb 0xC06CC426 0x21" $AASH 2>/dev/null
if [ $? -eq 0 ]; then RES=4; FPS=1; fi
grep -q "writeb 0xC06CC426 0x06" $AASH 2>/dev/null
if [ $? -eq 0 ]; then RES=4; FPS=2; fi
grep -q "writeb 0xC06CC426 0x20" $AASH 2>/dev/null
if [ $? -eq 0 ]; then RES=4; FPS=3; fi
grep -q "writeb 0xC06CC426 0x03" $AASH 2>/dev/null
if [ $? -eq 0 ]; then RES=4; FPS=4; fi
fi
grep -q "writel 0xC05C2CB4" $AASH 2>/dev/null
if [ $? -eq 0 ]; then
grep -q "writel 0xC05C2CB4 0x05100900" $AASH 2>/dev/null
if [ $? -eq 0 ]; then RES=5; FPS=2; fi
grep -q "writel 0xC05C2CB4 0x05A00A00" $AASH 2>/dev/null
if [ $? -eq 0 ]; then RES=6; FPS=2; fi
fi
grep -q "writel 0xC05C2D7C 0x04380780" $AASH 2>/dev/null
if [ $? -eq 0 ]; then SVIEW="1080p@60"; fi
grep -q "writel 0xC05C2D90 0x05100900" $AASH 2>/dev/null
if [ $? -eq 0 ]; then SVIEW="1296p@30"; fi
grep -q "writel 0xC05C2D90 0x05A00A00" $AASH 2>/dev/null
if [ $? -eq 0 ]; then SVIEW="1440p@30"; fi
grep -q "0x41A0" $AASH 2>/dev/null
if [ $? -eq 0 ]; then BIT="0x41A0"; fi
grep -q "0x41C8" $AASH 2>/dev/null
if [ $? -eq 0 ]; then BIT="0x41C8"; fi
grep -q "0x41F0" $AASH 2>/dev/null
if [ $? -eq 0 ]; then BIT="0x41F0"; fi
grep -q "0x420C" $AASH 2>/dev/null
if [ $? -eq 0 ]; then BIT="0x420C"; fi
grep -q "0x4220" $AASH 2>/dev/null
if [ $? -eq 0 ]; then BIT="0x4220"; fi
grep -q "0x4234" $AASH 2>/dev/null
if [ $? -eq 0 ]; then BIT="0x4234"; fi
grep -q "0x4248" $AASH 2>/dev/null
if [ $? -eq 0 ]; then BIT="0x4248"; fi
grep -q "writew 0xC03A8520 0x2004" $AASH 2>/dev/null
if [ $? -eq 0 ]; then BIG_FILE=${XYC_Y}; fi
}
resetCameraSettings ()
{
unset EXP ISO AWB RAW JPEG
unset NR AAA GAMMA RES FPS SVIEW BIT BIG_FILE
unset SHR FIR COR
unset AUTOKNEE VIBSAT SCENE
unset TLMODE TLDELAY TLNUM TLONCE TLOFF
unset AUTAN HDR1 HDR2 HDR3
unset INC_USER BAT VOL
setMissingValues
}
setMissingValues ()
{
expView $EXP
setRESView
setBITView
}
getExposureInput ()
{
clear
echo " |-> ${XYC_EXPOSURE} ${XYC_MENU}"
echo " |- 1: ${XYC_LONG_EXPOSURE}"
echo " |- 2: ${XYC_SHORT_EXPOSURE}"
local REPLY
read -p " -> " REPLY
case $REPLY in
1) getLongExposureInput;;
2) getShortExposureInput;;
esac
}
getLongExposureInput ()
{
clear
echo " |- ${XYC_EXPOSURE} ${XYC_MENU}"
echo " |-> ${XYC_LONG_EXPOSURE} ${XYC_MENU}"
echo " |- 0: ${XYC_AUTO}"
echo " |- 1: 7.9 ${XYC_SEC}"
echo " |- 2: 7.7 ${XYC_SEC}"
echo " |- 3: 6.1 ${XYC_SEC}"
echo " |- 4: 4.6 ${XYC_SEC}"
echo " |- 5: 2.7 ${XYC_SEC}"
echo " |- 6: 1.0 ${XYC_SEC}"
read -p " -> " REPLY
case $REPLY in
0) unset EXP;;
1) EXP=1;;
2) EXP=8;;
3) EXP=50;;
4) EXP=100;;
5) EXP=200;;
6) EXP=300;;
esac
}
getShortExposureInput ()
{
clear
echo " |- ${XYC_EXPOSURE} ${XYC_MENU}"
echo " |-> ${XYC_SHORT_EXPOSURE} ${XYC_MENU}"
echo " |- 0: ${XYC_AUTO}"
echo " |- 1: 1/3 ${XYC_SEC}"
echo " |- 2: 1/5 ${XYC_SEC}"
echo " |- 3: 1/10 ${XYC_SEC}"
echo " |- 4: 1/15 ${XYC_SEC}"
echo " |- 5: 1/30 ${XYC_SEC}"
echo " |- 6: 1/50 ${XYC_SEC}"
echo " |- 7: 1/60 ${XYC_SEC}"
echo " |- 8: 1/80 ${XYC_SEC}"
echo " |- 9: 1/125 ${XYC_SEC}"
echo " |- 10: 1/140 ${XYC_SEC}"
echo " |- 11: 1/250 ${XYC_SEC}"
echo " |- 12: 1/320 ${XYC_SEC}"
echo " |- 13: 1/500 ${XYC_SEC}"
echo " |- 14: 1/752 ${XYC_SEC}"
echo " |- 15: 1/1244 ${XYC_SEC}"
echo " |- 16: 1/2138 ${XYC_SEC}"
echo " |- 17: 1/3675 ${XYC_SEC}"
echo " |- 18: 1/6316 ${XYC_SEC}"
echo " |- 19: 1/8147 ${XYC_SEC}"
local REPLY=$EXP
read -p " -> " REPLY
case $REPLY in
0) unset EXP;;
1) EXP=590;;
2) EXP=700;;
3) EXP=800;;
4) EXP=900;;
5) EXP=1000;;
6) EXP=1100;;
7) EXP=1145;;
8) EXP=1200;;
9) EXP=1275;;
10) EXP=1300;;
11) EXP=1405;;
12) EXP=1450;;
13) EXP=1531;;
14) EXP=1607;;
15) EXP=1700;;
16) EXP=1800;;
17) EXP=1900;;
18) EXP=2000;;
19) EXP=2047;;
esac
}
expView ()
{
case ${1} in
1) EXPVIEW="7.9 ${XYC_SEC}";;
8) EXPVIEW="7.7 ${XYC_SEC}";;
50) EXPVIEW="6.1 ${XYC_SEC}";;
100) EXPVIEW="4.6 ${XYC_SEC}";;
200) EXPVIEW="2.7 ${XYC_SEC}";;
300) EXPVIEW="1 ${XYC_SEC}";;
590) EXPVIEW="1/3 ${XYC_SEC}";;
700) EXPVIEW="1/5 ${XYC_SEC}";;
800) EXPVIEW="1/10 ${XYC_SEC}";;
900) EXPVIEW="1/15 ${XYC_SEC}";;
1000) EXPVIEW="1/30 ${XYC_SEC}";;
1100) EXPVIEW="1/50 ${XYC_SEC}";;
1145) EXPVIEW="1/60 ${XYC_SEC}";;
1200) EXPVIEW="1/80 ${XYC_SEC}";;
1275) EXPVIEW="1/125 ${XYC_SEC}";;
1300) EXPVIEW="1/140 ${XYC_SEC}";;
1405) EXPVIEW="1/250 ${XYC_SEC}";;
1450) EXPVIEW="1/320 ${XYC_SEC}";;
1531) EXPVIEW="1/500 ${XYC_SEC}";;
1607) EXPVIEW="1/752 ${XYC_SEC}";;
1700) EXPVIEW="1/1244 ${XYC_SEC}";;
1800) EXPVIEW="1/2138 ${XYC_SEC}";;
1900) EXPVIEW="1/3675 ${XYC_SEC}";;
2000) EXPVIEW="1/6316 ${XYC_SEC}";;
2047) EXPVIEW="1/8147 ${XYC_SEC}";;
*) EXPVIEW="${XYC_AUTO}";;
esac
}
getISOInput ()
{
clear
echo " |-> ${XYC_ISO} ${XYC_MENU}"
echo " |- 0: ${XYC_AUTO}"
echo " |- 1: 100"
echo " |- 2: 200"
echo " |- 3: 400"
echo " |- 4: 800"
echo " |- 5: 1600"
echo " |- 6: 3200"
echo " |- 7: 6400"
echo " |- 8: 12800 ${XYC_WARNING}"
echo " |- 9: 25600 ${XYC_WARNING}"
local REPLY
read -p " -> " REPLY
case $REPLY in
0) unset ISO;;
1) ISO=100;;
2) ISO=200;;
3) ISO=400;;
4) ISO=800;;
5) ISO=1600;;
6) ISO=3200;;
7) ISO=6400;;
8) ISO=12800;;
9) ISO=25600;;
esac
}
getAWBInput ()
{
clear
local REPLY
read -p "${XYC_ENTER_AWB_PROMPT} (${XYC_Y}/${XYC_N}) [${XYC_ENTER}]: " REPLY
if [[ "$REPLY" == ${XYC_Y} || "$REPLY" == ${XYC_N} ]]; then AWB=$REPLY; fi