Guest User

Untitled

a guest
Feb 24th, 2016
4,938
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Xiaomi Yi Configurator
  2. # http://www.tawbaware.com
  3. # (c) Tawbaware software, 2015
  4. #
  5. # Description: This script runs inside the Xiaomi Yi camera and allows the user
  6. # to enable RAW file creation, and change photographic options such as
  7. # exposure, ISO, whitebalance, etc. It is designed to be executed and accessed
  8. # via a telnet client running on any phone, computer, tablet, etc.
  9. #
  10. #
  11. # Installation:
  12. #
  13. # 1. Install script at top level of SD card and ensure execute permissions:
  14. # chmod 755 /tmp/fuse_d/xyc.sh
  15. # 2 Optional. If you have custom settings that you want to be included in the
  16. # autoexec.ash file, store these commands in a file named autoexec.xyc in
  17. # the same directory as xyc.sh. Also, using XYC, set the "Import User settings"
  18. # menu choice to "yes". XYC will copy everything from the autoexec.xyc into
  19. # autoexec.ash whenever it updates autoexec.ash.
  20. # 3. Optional. If you want XYC to operate in a language other than English,
  21. # create a file named xyc_strings.sh in the same directory as xyc.sh. See
  22. # "TRANSLATION STRINGS" section below.
  23. #
  24. # Usage:
  25. #
  26. # 1. Enable wifi, and connect to camera using telnet
  27. # (IP=192.168.42.1, user id="root", no password)
  28. # 2. Run script: /tmp/fuse_d/xyc.sh
  29. #
  30. # Changelog:
  31. #
  32. # 1.0.1 (Feb 2016) - Simplified user interface for support different languages
  33. # by Alex - Updated support for 6 languages
  34. # - Updated YiMAX preset
  35. # - Updated WaffleFPV preset to V8
  36. # - Better quality with Alex_Day preset
  37. # - Night vision with Alex_Night preset
  38. # - Predefined saturation adjustments
  39. # - Added scene mode
  40. # - Renovate sharpness and coring
  41. # - Save battery adjustment
  42. # - Ability to change buzzer volume
  43. # 0.3.5 (Jan 2016) - Added SuperView feature
  44. # by Alex - Added WaffleFPV preset
  45. # 0.3.4 (Dec 2015) - Added Time-lapse script
  46. # by Alex - Added ability to use Time-lapse with HDR, RAW and others settings
  47. # - Added ability to save and reuse different presets
  48. # - Added ability to set bitrates for all resolutions
  49. # - Added new video frequencies: 24fps, 48fps
  50. # - Resolved 2560x1440 resolution, it's upscaling from 2304x1296
  51. # - Added ability to adjust Auto Knee, Gamma level
  52. # - Increased script performance
  53. # - Fixed issue in XYC Update
  54. # - Fixed issue in HDR scripts
  55. # - Removed GoPrawn script
  56. # 0.3.3 (Oct 2015) - Support latest 1.2.13 firmware
  57. # by Alex - Added support file weight limit to 4GB
  58. # - Added 1440p resolution for test purpose
  59. # - Added ability managing Noise Reduction
  60. # - Added new bitrates for Video Quality (40-50Mb)
  61. # - Added XYC Update feature for automatic download new version
  62. # - Removed Time Lapse script (use YiCam app Time-lapse with XYC camera settings)
  63. # 0.3.2 (Sep 2015) - Updated YiMax script
  64. # by Alex - Added shadow/highlight/gamma script
  65. # - Added sharpness script
  66. # - Fixed HDR scripts and added HDR Night
  67. # 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/
  68. # by Alex - Added YiMax Movie script http://nutseynuts.blogspot.com/2015/06/xiaomi-yi-action-cam-custom-scripts.html
  69. # - Simplified menu interface
  70. # - Fixed issues
  71. # 0.2.0 (Aug 2015) - Added support for alternate langauges
  72. # - Added support for user settings
  73. # - Standardized menu interface
  74. # 0.1.0 (Aug 2015) - Initial release
  75. # Disclaimer: This software is not created or endorsed by Xiaomi; it relies on
  76. # undocumented features of the Xiaomi Yi. Using this software may void your
  77. # camera's warranty and possibly damage your camera. Use at your own risk!
  78.  
  79. VERS="1.0.1 Alex"
  80. FUSED=/tmp/fuse_d
  81. SCRIPT_DIR=$(cd `dirname "$0"` && pwd)
  82. WEB=/var/www
  83. if [ ! -d "$FUSED" ]; then
  84. FUSED=$SCRIPT_DIR
  85. if [ -d "$WEB" ]; then
  86. FUSED=$WEB
  87. fi
  88. fi
  89. AASH=${FUSED}/autoexec.ash
  90. CORCONF=${FUSED}/sharpening.config
  91. THIS_SCRIPT="$SCRIPT_DIR/`basename "$0"`"
  92. LANGUAGE_FILE="$SCRIPT_DIR/xyc_strings.sh"
  93. USER_SETTINGS_FILE="$SCRIPT_DIR/autoexec.xyc"
  94. PRESETS_FILE="$SCRIPT_DIR/xyc_presets.sh"
  95.  
  96. #=============================================================================
  97. #
  98. # TRANSLATION STRINGS
  99. #
  100. # This list of variables contains the user interface strings for the English
  101. # Language. English is the default language for this program, but other
  102. # languages can be easily supported. If you wish to translate xyc to a
  103. # different language, create a file named xyc_strings.sh in the same directory
  104. # as xyc.sh, and store translated versions of (any or all) these XYC_* strings
  105. # in that file.
  106.  
  107. XYC_MAIN_MENU="Main Menu"
  108. XYC_EDIT_PHOTO_SETTINGS="Edit Photo settings"
  109. XYC_EDIT_VIDEO_SETTINGS="Edit Video settings"
  110. XYC_RESET_SETTINGS="Reset all settings"
  111. XYC_RESTART_CAMERA="Restart camera"
  112. XYC_EXIT="Exit"
  113. XYC_INVALID_CHOICE="Invalid choice"
  114. XYC_SD_CARD_USAGE="SD Card usage"
  115. XYC_TOTAL="Total"
  116. XYC_USED="Used"
  117. XYC_FREE="Free"
  118. XYC_FILE_COUNTS="File counts"
  119. XYC_ESTIMATED_REMAINING="Estimated remaining file capacity"
  120. XYC_MINUTES="minutes"
  121. XYC_UNKNOWN_OPTION="Warning...unknown option"
  122. XYC_ISO="ISO"
  123. XYC_EXPOSURE="Exposure"
  124. XYC_AWB="AWB"
  125. XYC_CREATE_RAW="Create RAW"
  126. XYC_RAW="RAW"
  127. XYC_YES="Yes"
  128. XYC_NO="No"
  129. XYC_Y="y"
  130. XYC_N="n"
  131. XYC_ON="On"
  132. XYC_OFF="Off"
  133. XYC_AUTO="Auto"
  134. XYC_ENTER="Enter"
  135. XYC_ENTER_AWB_PROMPT="Auto White Balance"
  136. XYC_CREATE_RAW_PROMPT="Create RAW files"
  137. XYC_REBOOTING_NOW="Rebooting now"
  138. XYC_WRITING="Writing"
  139. XYC_DELETING="Deleting"
  140. XYC_CREATE_HDR="Create HDR script"
  141. XYC_PHOTO_SETTINGS="Photo Settings"
  142. XYC_VIDEO_SETTINGS="Video Settings"
  143. XYC_INCLUDE_USER_SETTINGS_PROMPT="Import settings from autoexec.xyc"
  144. XYC_HDR_SETTINGS="HDR Settings"
  145. XYC_CANNOT_READ="WARNING: Cannot read/access"
  146. XYC_USER_IMPORT="Import User settings"
  147. XYC_SEC="sec"
  148. XYC_REMOVING="Removing"
  149. XYC_DELETE_VIDEO_PREVIEW_PROMPT="Delete All Video Preview files"
  150. XYC_DELETE_RAW_PROMPT="Delete All RAW files"
  151. XYC_HDR="HDR"
  152. XYC_HDR_RESET="Reset HDR settings"
  153. XYC_RESOLUTION="Resolution"
  154. XYC_DEFAULT="Default"
  155. XYC_FREQUENCY="Frequency"
  156. XYC_BITRATE="Bitrate"
  157. XYC_AUTOKNEE="Auto Knee"
  158. XYC_AUTOKNEE_PROMPT="Auto Knee level"
  159. XYC_SHARPNESS="Sharpness"
  160. XYC_SHARPNESS_FIR="Digital Filter"
  161. XYC_SHARPNESS_COR="Coring"
  162. XYC_SHR_MODE_VIDEO="Video"
  163. XYC_SHR_MODE_FAST="Fast Still"
  164. XYC_SHR_MODE_LOWISO="LowISO Still"
  165. XYC_SHR_MODE_HIGHISO="HighISO Still"
  166. XYC_SHARPNESS_FIR_PROMPT="Sharpness Digital Filter"
  167. XYC_SHARPNESS_COR_PROMPT="Sharpness Coring"
  168. XYC_BIG_FILE="4Gb files"
  169. XYC_BIG_FILE_PROMPT="Set file weight limit to 4GB"
  170. XYC_NOISE_REDUCTION="Noise Reduction"
  171. XYC_CUSTOM_NR_PROMPT="Noise Reduction level"
  172. XYC_MAX="Max"
  173. XYC_DISABLE="Disable"
  174. XYC_UPDATING_NOW="Updating now"
  175. XYC_SCRIPT_UPDATE="Update XYC"
  176. XYC_UPDATE_NOW_PROMPT="Download latest and rewrite existing XYC"
  177. XYC_NO_INTERNET="The script doesn't have internet connection."
  178. XYC_UPDATE_ERROR="It's required for download XYC update."
  179. XYC_UPDATE_COMPLETE="Update complete."
  180. XYC_UPDATE_MANUAL="For download script manually browse to"
  181. XYC_CREATE_FILE="First create"
  182. XYC_BITRATE_ALL="Bitrate all"
  183. XYC_AAA="AE/AWB/ADJ locks"
  184. XYC_AAA_PROMPT="Set AE/AWB/ADJ locks"
  185. XYC_GAMMA="Gamma"
  186. XYC_GAMMA_PROMPT="Gamma level"
  187. XYC_CUSTOM="Custom"
  188. XYC_VIBSAT="Saturation"
  189. XYC_PRESETS="Manage XYC Presets"
  190. XYC_NO_PRESETS="You don't have any preset, create it first."
  191. XYC_CREATE_PRESET="Create new Preset"
  192. XYC_REMOVE_PRESET="Remove Preset"
  193. XYC_LOAD_PRESET="Load Preset"
  194. XYC_NEW_PRESET_PROMPT="Enter name of current configuration"
  195. XYC_NAME_EXIST="Specified name already exist"
  196. XYC_PRESET_CREATED="XYC settings were saved to"
  197. XYC_PRESET_LOADED="Preset loaded"
  198. XYC_PRESET_REMOVED="Preset removed"
  199. XYC_CREATE_TIME_LAPSE="Create Time-lapse script"
  200. XYC_TIME_LAPSE_SETTINGS="Time-lapse Settings"
  201. XYC_TIME_LAPSE_RESET="Reset Time-lapse settings"
  202. XYC_TIME_LAPSE_MODE="Time-lapse Mode"
  203. XYC_TIME_LAPSE_CYCLES="Time-lapse Cycles"
  204. XYC_TIME_LAPSE_INTERVAL="Time-lapse Interval"
  205. XYC_RUN_ONCE_ONLY="Run once only"
  206. XYC_ALLOW_POWEROFF="Allow poweroff"
  207. XYC_SHUTTING_DOWN_NOW="Shutting down now"
  208. XYC_NUM_CYCLES_PROMPT="Number of cycles"
  209. XYC_CYCLES_INTERVAL_PROMPT="Interval between cycles, sec"
  210. XYC_RUN_ONCE_ONLY_PROMPT="Remove time-lapse script when complete"
  211. XYC_POWEROFF_WHEN_COMPLETE_PROMPT="Poweroff camera when complete"
  212. XYC_RESTART_TO_APPLY="Restart your camera to apply settings."
  213. XYC_INVINITY="Invinity"
  214. XYC_SUPERVIEW="SuperView"
  215. XYC_VIEW_AUTOEXEC="View Autoexec.ash"
  216. XYC_EDIT_CAMERA_SETTINGS="Edit Camera settings"
  217. XYC_CAMERA_UTILS="Camera Utils"
  218. XYC_LONG_EXPOSURE="Long Exposure"
  219. XYC_SHORT_EXPOSURE="Short Exposure"
  220. XYC_CAMERA_SETTINGS="Camera Settings"
  221. XYC_SD_CARD_CLEANUP="SD Card cleanup"
  222. XYC_MIN="Min"
  223. XYC_DAY="Day"
  224. XYC_NIGHT="Night"
  225. XYC_MENU="Menu"
  226. XYC_MODE="Mode"
  227. XYC_WARNING="Warning!"
  228. XYC_SUPER_HIGH="Super High"
  229. XYC_HIGH="High"
  230. XYC_NORMAL="Normal"
  231. XYC_LOW="Low"
  232. XYC_GRAY="Gray"
  233. XYC_SAVE_BATTERY="Save battery"
  234. XYC_SAVE_BATTERY_PROMPT="Save battery adjustment"
  235. XYC_BUZZER_VOLUME="Buzzer volume"
  236. XYC_BUZZER_VOLUME_PROMPT="Buzzer volume level"
  237. XYC_JPEG_QUALITY="Jpeg 100"
  238. XYC_JPEG_QUALITY_PROMPT="JPEG quality 100%"
  239. XYC_SCENE="Scene Mode"
  240. XYC_LANDSCAPE="Landscape"
  241. XYC_PORTRAIT="Portrait"
  242. XYC_THROUGH_GLASS="Through glass"
  243. XYC_CAR_DV="Car DV"
  244. XYC_FPS="FPS"
  245. XYC_MBS="Mb/s"
  246.  
  247. #If language file exists, source it to override English language UI strings
  248. if [[ -s "$LANGUAGE_FILE" && -r "$LANGUAGE_FILE" ]]; then
  249. source $LANGUAGE_FILE
  250. fi
  251.  
  252. #=============================================================================
  253.  
  254. welcome ()
  255. {
  256. clear
  257. echo ""
  258. echo " Xiaomi Yi Configurator"
  259. echo " 02/16/2016 ${VERS}"
  260. echo ""
  261. }
  262.  
  263. showMainMenu ()
  264. {
  265. local REPLY
  266. while [ "$EXITACTION" == "" ]
  267. do
  268. echo " -> ${XYC_MAIN_MENU}"
  269. echo " |- 0: ${XYC_VIEW_AUTOEXEC}"
  270. echo " |- 1: ${XYC_EDIT_CAMERA_SETTINGS}"
  271. echo " |- 2: ${XYC_EDIT_PHOTO_SETTINGS}"
  272. echo " |- 3: ${XYC_EDIT_VIDEO_SETTINGS}"
  273. echo " |- 4: ${XYC_CREATE_TIME_LAPSE}"
  274. echo " |- 5: ${XYC_CREATE_HDR}"
  275. echo " |- 6: ${XYC_PRESETS}"
  276. echo " |- 7: ${XYC_CAMERA_UTILS}"
  277. echo " |- 8: ${XYC_RESET_SETTINGS}"
  278. echo " |- 9: ${XYC_RESTART_CAMERA}"
  279. echo " |- 10: ${XYC_SCRIPT_UPDATE}"
  280. echo " |- 11: ${XYC_EXIT}"
  281. read -p " -> " REPLY
  282. clear
  283. case $REPLY in
  284. 0) clear; cat $AASH;;
  285. 1) showCameraSettingsMenu; writeAutoexec;;
  286. 2) showPhotoSettingsMenu; writeAutoexec;;
  287. 3) showVideoSettingsMenu; writeAutoexec;;
  288. 4) showTimeLapseMenu; writeAutoexec;;
  289. 5) showHDRMenu; writeAutoexec;;
  290. 6) showPresetsMenu;;
  291. 7) showUtilsMenu; clear;;
  292. 8) removeAutoexec; resetCameraSettings;;
  293. 9) EXITACTION="reboot";;
  294. 10) EXITACTION="update";;
  295. 11) EXITACTION="nothing";;
  296. *) echo "${XYC_INVALID_CHOICE}";;
  297. esac
  298. done
  299. }
  300.  
  301. showCameraSettingsMenu ()
  302. {
  303. local REPLY
  304. while true
  305. do
  306. echo " |- 0: ${XYC_MAIN_MENU}"
  307. echo " |-> ${XYC_CAMERA_SETTINGS} ${XYC_MENU}"
  308. printf " |- 1: ${XYC_AUTOKNEE}: "
  309. if [ -z "$AUTOKNEE" ]; then
  310. echo "${XYC_DEFAULT}"
  311. else
  312. echo "$AUTOKNEE"
  313. fi
  314. printf " |- 2: ${XYC_VIBSAT}: "
  315. if [ -z "$VIBSAT" ]; then
  316. echo "${XYC_DEFAULT}"
  317. elif [ $VIBSAT -eq 1 ]; then
  318. echo "${XYC_SUPER_HIGH}"
  319. elif [ $VIBSAT -eq 2 ]; then
  320. echo "${XYC_HIGH}"
  321. elif [ $VIBSAT -eq 3 ]; then
  322. echo "${XYC_NORMAL}"
  323. elif [ $VIBSAT -eq 4 ]; then
  324. echo "${XYC_LOW}"
  325. elif [ $VIBSAT -eq 5 ]; then
  326. echo "${XYC_GRAY}"
  327. fi
  328. printf " |- 3: ${XYC_SHARPNESS}: "
  329. if [ -z "$SHR" ]; then
  330. echo "${XYC_DEFAULT}"
  331. else
  332. echo "$SHR/$FIR/$COR"
  333. fi
  334. printf " |- 4: ${XYC_SCENE}: "
  335. if [ -z "$SCENE" ]; then
  336. echo "${XYC_DEFAULT}"
  337. elif [ $SCENE -eq 1 ]; then
  338. echo "${XYC_AUTO}"
  339. elif [ $SCENE -eq 13 ]; then
  340. echo "${XYC_LANDSCAPE}"
  341. elif [ $SCENE -eq 14 ]; then
  342. echo "${XYC_PORTRAIT}"
  343. elif [ $SCENE -eq 34 ]; then
  344. echo "${XYC_THROUGH_GLASS}"
  345. elif [ $SCENE -eq 38 ]; then
  346. echo "${XYC_CAR_DV}"
  347. fi
  348. printf " |- 5: ${XYC_USER_IMPORT}: "
  349. if [ "$INC_USER" == ${XYC_Y} ]; then
  350. echo "${XYC_YES}"
  351. else
  352. echo "${XYC_NO}"
  353. fi
  354. printf " |- 6: ${XYC_SAVE_BATTERY}: "
  355. if [ "$BAT" == ${XYC_Y} ]; then
  356. echo "${XYC_YES}"
  357. else
  358. echo "${XYC_NO}"
  359. fi
  360. printf " |- 7: ${XYC_BUZZER_VOLUME}: "
  361. if [ -z "$VOL" ]; then
  362. echo "${XYC_DEFAULT}"
  363. else
  364. echo "$VOL"
  365. fi
  366. read -p " -> " REPLY
  367. case $REPLY in
  368. 0) clear; return;;
  369. 1) getAutoKneeInput; clear;;
  370. 2) getSaturationInput; clear;;
  371. 3) getSharpnessInput; clear;;
  372. 4) getSceneInput; clear;;
  373. 5) getIncludeUserSettings; clear;;
  374. 6) getSaveBatteryInput; clear;;
  375. 7) getBuzzerVolumeInput; clear;;
  376. *) clear; echo "${XYC_INVALID_CHOICE}";;
  377. esac
  378. done
  379. }
  380.  
  381. showPhotoSettingsMenu ()
  382. {
  383. local REPLY
  384. while true
  385. do
  386. echo " |- 0: ${XYC_MAIN_MENU}"
  387. echo " |-> ${XYC_PHOTO_SETTINGS} ${XYC_MENU}"
  388. printf " |- 1: ${XYC_EXPOSURE}: "
  389. if [ -z "$EXP" ]; then
  390. echo "${XYC_AUTO}"
  391. else
  392. expView $EXP
  393. echo "$EXPVIEW"
  394. fi
  395. printf " |- 2: ${XYC_ISO}: "
  396. if [ -z "$ISO" ]; then
  397. echo "${XYC_AUTO}"
  398. else
  399. echo "$ISO"
  400. fi
  401. printf " |- 3: ${XYC_AWB}: "
  402. if [ "$AWB" == ${XYC_N} ]; then
  403. echo "${XYC_NO}"
  404. else
  405. echo "${XYC_YES}"
  406. fi
  407. printf " |- 4: ${XYC_CREATE_RAW}: "
  408. if [ "$RAW" == ${XYC_Y} ]; then
  409. echo "${XYC_YES}"
  410. else
  411. echo "${XYC_NO}"
  412. fi
  413. printf " |- 5: ${XYC_JPEG_QUALITY}: "
  414. if [ "$JPEG" == ${XYC_Y} ]; then
  415. echo "${XYC_YES}"
  416. else
  417. echo "${XYC_NO}"
  418. fi
  419. read -p " -> " REPLY
  420. case $REPLY in
  421. 0) clear; return;;
  422. 1) getExposureInput; clear;;
  423. 2) getISOInput; clear;;
  424. 3) getAWBInput; clear;;
  425. 4) getRawInput; clear;;
  426. 5) getJpegInput; clear;;
  427. *) clear; echo "${XYC_INVALID_CHOICE}";;
  428. esac
  429. done
  430. }
  431.  
  432. showVideoSettingsMenu ()
  433. {
  434. local REPLY
  435. while true
  436. do
  437. echo " |- 0: ${XYC_MAIN_MENU}"
  438. echo " |-> ${XYC_VIDEO_SETTINGS} ${XYC_MENU}"
  439. printf " |- 1: ${XYC_NOISE_REDUCTION}: "
  440. if [ -z "$NR" ]; then
  441. echo "${XYC_DEFAULT}"
  442. elif [ $NR -eq -1 ]; then
  443. echo "${XYC_DISABLE}"
  444. elif [ $NR -eq 0 ]; then
  445. echo "${XYC_MIN}"
  446. elif [ $NR -eq 16383 ]; then
  447. echo "${XYC_MAX}"
  448. else
  449. echo "$NR"
  450. fi
  451. printf " |- 2: ${XYC_AAA}: "
  452. if [ "$AAA" == ${XYC_Y} ]; then
  453. echo "${XYC_YES}"
  454. else
  455. echo "${XYC_DEFAULT}"
  456. fi
  457. printf " |- 3: ${XYC_GAMMA}: "
  458. if [ -z "$GAMMA" ]; then
  459. echo "${XYC_DEFAULT}"
  460. else
  461. echo "$GAMMA"
  462. fi
  463. printf " |- 4: ${XYC_RESOLUTION}: "
  464. if [ -z "$RES" ]; then
  465. echo "${XYC_DEFAULT}"
  466. else
  467. echo "$RESVIEW"
  468. fi
  469. printf " |- 5: ${XYC_SUPERVIEW}: "
  470. if [ -z "$SVIEW" ]; then
  471. echo "${XYC_DISABLE}"
  472. else
  473. echo "$SVIEW"
  474. fi
  475. printf " |- 6: ${XYC_BITRATE_ALL}: "
  476. if [ -z "$BIT" ]; then
  477. echo "${XYC_DEFAULT}"
  478. else
  479. echo "$BITVIEW"
  480. fi
  481. printf " |- 7: ${XYC_BIG_FILE}: "
  482. if [ "$BIG_FILE" == ${XYC_Y} ]; then
  483. echo "${XYC_YES}"
  484. else
  485. echo "${XYC_NO}"
  486. fi
  487. read -p " -> " REPLY
  488. case $REPLY in
  489. 0) clear; return;;
  490. 1) getNRInput; clear;;
  491. 2) getAAAInput; clear;;
  492. 3) getGammaInput; clear;;
  493. 4) getVideoResolutionInput; clear;;
  494. 5) getSuperViewInput; clear;;
  495. 6) getVideoBitrateInput; clear;;
  496. 7) getBigFileInput; clear;;
  497. *) clear; echo "${XYC_INVALID_CHOICE}";;
  498. esac
  499. done
  500. }
  501.  
  502. showTimeLapseMenu ()
  503. {
  504. local REPLY
  505. while true
  506. do
  507. echo " |- 0: ${XYC_MAIN_MENU}"
  508. echo " |-> ${XYC_TIME_LAPSE_SETTINGS} ${XYC_MENU}"
  509. printf " |- 1: ${XYC_TIME_LAPSE_MODE}: "
  510. if [ -z "$TLMODE" ]; then
  511. echo "${XYC_DISABLE}"
  512. elif [ $TLMODE -eq 0 ]; then
  513. echo "${XYC_CUSTOM}"
  514. if [ -z "$TLDELAY" ]; then TLDELAY=10; fi;
  515. if [ -z "$TLNUM" ]; then TLNUM=30; fi;
  516. if [ -z "$TLONCE" ]; then TLONCE=${XYC_Y}; fi;
  517. elif [ $TLMODE -eq 1 ]; then
  518. echo "${XYC_INVINITY}"
  519. if [ -z "$TLDELAY" ]; then TLDELAY=10; fi;
  520. unset TLNUM TLONCE TLOFF
  521. elif [ $TLMODE -eq 2 ]; then
  522. echo "${XYC_HDR}"
  523. if [ -z "$TLDELAY" ]; then TLDELAY=10; fi;
  524. unset TLNUM TLONCE TLOFF
  525. fi
  526. printf " |- 2: ${XYC_TIME_LAPSE_INTERVAL}: "
  527. if [[ -z "$TLMODE" || -z "$TLDELAY" ]]; then
  528. echo "${XYC_DISABLE}"
  529. else
  530. echo "$TLDELAY"
  531. fi
  532. printf " |- 3: ${XYC_TIME_LAPSE_CYCLES}: "
  533. if [ -z "$TLMODE" ]; then
  534. echo "${XYC_DISABLE}"
  535. elif [ $TLMODE -eq 0 ]; then
  536. echo "$TLNUM"
  537. else
  538. echo "${XYC_INVINITY}"
  539. fi
  540. printf " |- 4: ${XYC_RUN_ONCE_ONLY}: "
  541. if [ "$TLONCE" == ${XYC_Y} ]; then
  542. echo "${XYC_YES}"
  543. else
  544. echo "${XYC_NO}"
  545. fi
  546. printf " |- 5: ${XYC_ALLOW_POWEROFF}: "
  547. if [ "$TLOFF" == ${XYC_Y} ]; then
  548. echo "${XYC_YES}"
  549. else
  550. echo "${XYC_NO}"
  551. fi
  552. echo " |- 6: ${XYC_TIME_LAPSE_RESET}"
  553. read -p " -> " REPLY
  554. case $REPLY in
  555. 0) clear; return;;
  556. 1) getTLModeInput; clear;;
  557. 2) getTLDelayInput; clear;;
  558. 3) getTLNumShotsInput; clear;;
  559. 4) getTLOnceInput; clear;;
  560. 5) getTLOffInput; clear;;
  561. 6) unset TLMODE TLDELAY TLNUM TLONCE TLOFF; clear; return;;
  562. *) clear; echo "${XYC_INVALID_CHOICE}";;
  563. esac
  564. done
  565. }
  566.  
  567. showHDRMenu ()
  568. {
  569. local REPLY
  570. while true
  571. do
  572. echo " |- 0: ${XYC_MAIN_MENU}"
  573. echo " |-> ${XYC_HDR_SETTINGS} ${XYC_MENU}"
  574. echo " |- 1: ${XYC_HDR} ${XYC_DAY}"
  575. if [ $AUTAN -eq 1 2> /dev/null ]; then
  576. echo " | 1/15 ${XYC_SEC}"
  577. echo " | 1/50 ${XYC_SEC}"
  578. echo " | 1/250 ${XYC_SEC}"
  579. echo " | 1/500 ${XYC_SEC}"
  580. echo " | 1/1244 ${XYC_SEC}"
  581. echo " | 1/8147 ${XYC_SEC}"
  582. fi
  583. echo " |- 2: ${XYC_HDR} ${XYC_NIGHT}"
  584. if [ $AUTAN -eq 2 2> /dev/null ]; then
  585. echo " | 7.9 ${XYC_SEC}"
  586. echo " | 4.6 ${XYC_SEC}"
  587. echo " | 2.7 ${XYC_SEC}"
  588. echo " | 1.0 ${XYC_SEC}"
  589. echo " | 1/3 ${XYC_SEC}"
  590. echo " | 1/15 ${XYC_SEC}"
  591. fi
  592. echo " |- 3: ${XYC_CUSTOM}"
  593. if [ $AUTAN -eq 0 2> /dev/null ]; then
  594. expView $HDR1
  595. echo " | $EXPVIEW"
  596. expView $HDR2
  597. echo " | $EXPVIEW"
  598. expView $HDR3
  599. echo " | $EXPVIEW"
  600. fi
  601. echo " |- 4: ${XYC_HDR_RESET}"
  602. read -p " -> " REPLY
  603. case $REPLY in
  604. 0) clear; return;;
  605. 1) AUTAN=1; HDR1=900; HDR2=1531; HDR3=2047; clear;;
  606. 2) AUTAN=2; HDR1=1; HDR2=300; HDR3=900; clear;;
  607. 3) AUTAN=0; getHDRInput; clear;;
  608. 4) unset AUTAN HDR1 HDR2 HDR3; clear; return;;
  609. *) clear; echo "${XYC_INVALID_CHOICE}";;
  610. esac
  611. done
  612. }
  613.  
  614. showPresetsMenu ()
  615. {
  616. clear
  617. local REPLY
  618. while true
  619. do
  620. echo " |- 0: ${XYC_MAIN_MENU}"
  621. echo " |-> ${XYC_PRESETS} ${XYC_MENU}"
  622. echo " |- 1: ${XYC_LOAD_PRESET}"
  623. echo " |- 2: ${XYC_CREATE_PRESET}"
  624. echo " |- 3: ${XYC_REMOVE_PRESET}"
  625. read -p " -> " REPLY
  626. case $REPLY in
  627. 0) clear; return;;
  628. 1) if showPresetsList "load"; then
  629. writeAutoexec; return;
  630. fi; clear;;
  631. 2) getCreatePresetInput; clear;;
  632. 3) showPresetsList "remove"; clear;;
  633. *) clear; echo "${XYC_INVALID_CHOICE}";;
  634. esac
  635. done
  636. }
  637.  
  638. showUtilsMenu ()
  639. {
  640. clear
  641. local REPLY
  642. while true
  643. do
  644. echo " |- 0: ${XYC_MAIN_MENU}"
  645. echo " |-> ${XYC_CAMERA_UTILS} ${XYC_MENU}"
  646. echo " |- 1: ${XYC_SD_CARD_USAGE}"
  647. echo " |- 2: ${XYC_SD_CARD_CLEANUP}"
  648. local REPLY
  649. read -p " -> " REPLY
  650. case $REPLY in
  651. 0) clear; return;;
  652. 1) showSpaceUsage; clear;;
  653. 2) getCleanUpInput; clear;;
  654. *) clear; echo "${XYC_INVALID_CHOICE}";;
  655. esac
  656. done
  657. }
  658.  
  659. parseCommandLine ()
  660. {
  661. while [ $# -gt 0 ]
  662. do
  663. key="$1"
  664. case $key in
  665. -i) ISO=$2; shift;;
  666. -e) EXP=$2; shift;;
  667. -n) NR=$2; shift;;
  668. -u) INC_USER=$2; shift;;
  669. -t) TLMODE=$2; shift;;
  670. -h) AUTAN=$2; shift;;
  671. *) echo "${XYC_UNKNOWN_OPTION}: $key"; shift;;
  672. esac
  673. shift # past argument or value
  674. # write and close
  675. if [ $# -eq 0 ]; then
  676. writeAutoexec
  677. exit
  678. fi
  679. done
  680. }
  681.  
  682. parseExistingAutoexec ()
  683. {
  684. #Parse existing values from autoexec.ash
  685. ISO=$(grep "t ia2 -ae exp" $AASH 2>/dev/null | cut -d " " -f 5)
  686. if [ $ISO -eq 0 2> /dev/null ]; then unset ISO; fi
  687. EXP=$(grep "t ia2 -ae exp" $AASH 2>/dev/null | cut -d " " -f 6)
  688. if [ $EXP -eq 0 2> /dev/null ]; then unset EXP; fi
  689.  
  690. NR=$(grep "t ia2 -adj tidx" $AASH 2>/dev/null | cut -d " " -f 6)
  691. GAMMA=$(grep "t ia2 -adj gamma" $AASH 2>/dev/null | cut -d " " -f 5)
  692. AUTOKNEE=$(grep "t ia2 -adj autoknee" $AASH 2>/dev/null | cut -d " " -f 5)
  693. SCENE=$(grep "t cal -sc" $AASH 2>/dev/null | cut -d " " -f 4)
  694. VOL=$(grep "t pwm 1 set_level" $AASH 2>/dev/null | cut -d " " -f 5)
  695.  
  696. grep -q "t ia2 -awb off" $AASH 2>/dev/null
  697. if [ $? -eq 0 ]; then AWB=${XYC_N}; fi
  698.  
  699. grep -q "t app test debug_dump 14" $AASH 2>/dev/null
  700. if [ $? -eq 0 ]; then RAW=${XYC_Y}; fi
  701.  
  702. grep -q "t cal -jqlt 100" $AASH 2>/dev/null
  703. if [ $? -eq 0 ]; then JPEG=${XYC_Y}; fi
  704.  
  705. grep -q "t ia2 -3a" $AASH 2>/dev/null
  706. if [ $? -eq 0 ]; then AAA=${XYC_Y}; fi
  707.  
  708. grep -q "#User settings" $AASH 2>/dev/null
  709. if [ $? -eq 0 ]; then INC_USER=${XYC_Y}; fi
  710.  
  711. grep -q "t app lowbatt" $AASH 2>/dev/null
  712. if [ $? -eq 0 ]; then BAT=${XYC_Y}; fi
  713.  
  714. grep -q "#Time-lapse:" $AASH 2>/dev/null
  715. if [ $? -eq 0 ]; then
  716. TLMODE=$(grep "#Time-lapse:" $AASH | cut -d " " -f 2)
  717. TLDELAY=$(grep "#Time-lapse:" $AASH | cut -d " " -f 3)
  718. TLNUM=$(grep "#Time-lapse:" $AASH | cut -d " " -f 4)
  719. TLONCE=$(grep "#Time-lapse:" $AASH | cut -d " " -f 5)
  720. TLOFF=$(grep "#Time-lapse:" $AASH | cut -d " " -f 6)
  721. fi
  722.  
  723. grep -q "#HDRParams:" $AASH 2>/dev/null
  724. if [ $? -eq 0 ]; then
  725. AUTAN=$(grep "#HDRParams:" $AASH | cut -d " " -f 2)
  726. HDR1=$(grep "#HDRParams:" $AASH | cut -d " " -f 3)
  727. HDR2=$(grep "#HDRParams:" $AASH | cut -d " " -f 4)
  728. HDR3=$(grep "#HDRParams:" $AASH | cut -d " " -f 5)
  729. fi
  730.  
  731. grep -q "#Sharpness:" $AASH 2>/dev/null
  732. if [ $? -eq 0 ]; then
  733. SHR=$(grep "#Sharpness:" $AASH | cut -d " " -f 2)
  734. FIR=$(grep "#Sharpness:" $AASH | cut -d " " -f 3)
  735. COR=$(grep "#Sharpness:" $AASH | cut -d " " -f 4)
  736. fi
  737.  
  738. grep -q "t ia2 -adj ev" $AASH 2>/dev/null
  739. if [ $? -eq 0 ]; then
  740. grep -q "t ia2 -adj ev 0 0 160 0 0 190 0" $AASH 2>/dev/null
  741. if [ $? -eq 0 ]; then VIBSAT=1; fi
  742. grep -q "t ia2 -adj ev 0 0 140 0 0 150 0" $AASH 2>/dev/null
  743. if [ $? -eq 0 ]; then VIBSAT=2; fi
  744. grep -q "t ia2 -adj ev 10 0 70 0 0 150 0" $AASH 2>/dev/null
  745. if [ $? -eq 0 ]; then VIBSAT=3; fi
  746. grep -q "t ia2 -adj ev 10 0 70 0 0 100 0" $AASH 2>/dev/null
  747. if [ $? -eq 0 ]; then VIBSAT=4; fi
  748. grep -q "t ia2 -adj ev 10 0 70 0 0 50 0" $AASH 2>/dev/null
  749. if [ $? -eq 0 ]; then VIBSAT=5; fi
  750. fi
  751.  
  752. grep -q "writeb 0xC06CC426" $AASH 2>/dev/null
  753. if [ $? -eq 0 ]; then
  754. grep -q "writeb 0xC06CC426 0x28" $AASH 2>/dev/null
  755. if [ $? -eq 0 ]; then RES=1; FPS=1; fi
  756. grep -q "writeb 0xC06CC426 0x11" $AASH 2>/dev/null
  757. if [ $? -eq 0 ]; then RES=1; FPS=2; fi
  758. grep -q "writeb 0xC06CC426 0x27" $AASH 2>/dev/null
  759. if [ $? -eq 0 ]; then RES=1; FPS=3; fi
  760. grep -q "writeb 0xC06CC426 0x0F" $AASH 2>/dev/null
  761. if [ $? -eq 0 ]; then RES=1; FPS=4; fi
  762. grep -q "writeb 0xC06CC426 0x34" $AASH 2>/dev/null
  763. if [ $? -eq 0 ]; then RES=1; FPS=5; fi
  764. grep -q "writeb 0xC06CC426 0x26" $AASH 2>/dev/null
  765. if [ $? -eq 0 ]; then RES=2; FPS=1; fi
  766. grep -q "writeb 0xC06CC426 0x17" $AASH 2>/dev/null
  767. if [ $? -eq 0 ]; then RES=2; FPS=2; fi
  768. grep -q "writeb 0xC06CC426 0x25" $AASH 2>/dev/null
  769. if [ $? -eq 0 ]; then RES=2; FPS=3; fi
  770. grep -q "writeb 0xC06CC426 0x16" $AASH 2>/dev/null
  771. if [ $? -eq 0 ]; then RES=2; FPS=4; fi
  772. grep -q "writeb 0xC06CC426 0x24" $AASH 2>/dev/null
  773. if [ $? -eq 0 ]; then RES=3; FPS=1; fi
  774. grep -q "writeb 0xC06CC426 0x0D" $AASH 2>/dev/null
  775. if [ $? -eq 0 ]; then RES=3; FPS=2; fi
  776. grep -q "writeb 0xC06CC426 0x23" $AASH 2>/dev/null
  777. if [ $? -eq 0 ]; then RES=3; FPS=3; fi
  778. grep -q "writeb 0xC06CC426 0x0C" $AASH 2>/dev/null
  779. if [ $? -eq 0 ]; then RES=3; FPS=4; fi
  780. grep -q "writeb 0xC06CC426 0x21" $AASH 2>/dev/null
  781. if [ $? -eq 0 ]; then RES=4; FPS=1; fi
  782. grep -q "writeb 0xC06CC426 0x06" $AASH 2>/dev/null
  783. if [ $? -eq 0 ]; then RES=4; FPS=2; fi
  784. grep -q "writeb 0xC06CC426 0x20" $AASH 2>/dev/null
  785. if [ $? -eq 0 ]; then RES=4; FPS=3; fi
  786. grep -q "writeb 0xC06CC426 0x03" $AASH 2>/dev/null
  787. if [ $? -eq 0 ]; then RES=4; FPS=4; fi
  788. fi
  789.  
  790. grep -q "writel 0xC05C2CB4" $AASH 2>/dev/null
  791. if [ $? -eq 0 ]; then
  792. grep -q "writel 0xC05C2CB4 0x05100900" $AASH 2>/dev/null
  793. if [ $? -eq 0 ]; then RES=5; FPS=2; fi
  794. grep -q "writel 0xC05C2CB4 0x05A00A00" $AASH 2>/dev/null
  795. if [ $? -eq 0 ]; then RES=6; FPS=2; fi
  796. fi
  797.  
  798. grep -q "writel 0xC05C2D7C 0x04380780" $AASH 2>/dev/null
  799. if [ $? -eq 0 ]; then SVIEW="1080p@60"; fi
  800. grep -q "writel 0xC05C2D90 0x05100900" $AASH 2>/dev/null
  801. if [ $? -eq 0 ]; then SVIEW="1296p@30"; fi
  802. grep -q "writel 0xC05C2D90 0x05A00A00" $AASH 2>/dev/null
  803. if [ $? -eq 0 ]; then SVIEW="1440p@30"; fi
  804.  
  805. grep -q "0x41A0" $AASH 2>/dev/null
  806. if [ $? -eq 0 ]; then BIT="0x41A0"; fi
  807. grep -q "0x41C8" $AASH 2>/dev/null
  808. if [ $? -eq 0 ]; then BIT="0x41C8"; fi
  809. grep -q "0x41F0" $AASH 2>/dev/null
  810. if [ $? -eq 0 ]; then BIT="0x41F0"; fi
  811. grep -q "0x420C" $AASH 2>/dev/null
  812. if [ $? -eq 0 ]; then BIT="0x420C"; fi
  813. grep -q "0x4220" $AASH 2>/dev/null
  814. if [ $? -eq 0 ]; then BIT="0x4220"; fi
  815. grep -q "0x4234" $AASH 2>/dev/null
  816. if [ $? -eq 0 ]; then BIT="0x4234"; fi
  817. grep -q "0x4248" $AASH 2>/dev/null
  818. if [ $? -eq 0 ]; then BIT="0x4248"; fi
  819.  
  820. grep -q "writew 0xC03A8520 0x2004" $AASH 2>/dev/null
  821. if [ $? -eq 0 ]; then BIG_FILE=${XYC_Y}; fi
  822. }
  823.  
  824. resetCameraSettings ()
  825. {
  826. unset EXP ISO AWB RAW JPEG
  827. unset NR AAA GAMMA RES FPS SVIEW BIT BIG_FILE
  828. unset SHR FIR COR
  829. unset AUTOKNEE VIBSAT SCENE
  830. unset TLMODE TLDELAY TLNUM TLONCE TLOFF
  831. unset AUTAN HDR1 HDR2 HDR3
  832. unset INC_USER BAT VOL
  833. setMissingValues
  834. }
  835.  
  836. setMissingValues ()
  837. {
  838. expView $EXP
  839. setRESView
  840. setBITView
  841. }
  842.  
  843. getExposureInput ()
  844. {
  845. clear
  846. echo " |-> ${XYC_EXPOSURE} ${XYC_MENU}"
  847. echo " |- 1: ${XYC_LONG_EXPOSURE}"
  848. echo " |- 2: ${XYC_SHORT_EXPOSURE}"
  849. local REPLY
  850. read -p " -> " REPLY
  851. case $REPLY in
  852. 1) getLongExposureInput;;
  853. 2) getShortExposureInput;;
  854. esac
  855. }
  856.  
  857. getLongExposureInput ()
  858. {
  859. clear
  860. echo " |- ${XYC_EXPOSURE} ${XYC_MENU}"
  861. echo " |-> ${XYC_LONG_EXPOSURE} ${XYC_MENU}"
  862. echo " |- 0: ${XYC_AUTO}"
  863. echo " |- 1: 7.9 ${XYC_SEC}"
  864. echo " |- 2: 7.7 ${XYC_SEC}"
  865. echo " |- 3: 6.1 ${XYC_SEC}"
  866. echo " |- 4: 4.6 ${XYC_SEC}"
  867. echo " |- 5: 2.7 ${XYC_SEC}"
  868. echo " |- 6: 1.0 ${XYC_SEC}"
  869. read -p " -> " REPLY
  870. case $REPLY in
  871. 0) unset EXP;;
  872. 1) EXP=1;;
  873. 2) EXP=8;;
  874. 3) EXP=50;;
  875. 4) EXP=100;;
  876. 5) EXP=200;;
  877. 6) EXP=300;;
  878. esac
  879. }
  880.  
  881.  
  882. getShortExposureInput ()
  883. {
  884. clear
  885. echo " |- ${XYC_EXPOSURE} ${XYC_MENU}"
  886. echo " |-> ${XYC_SHORT_EXPOSURE} ${XYC_MENU}"
  887. echo " |- 0: ${XYC_AUTO}"
  888. echo " |- 1: 1/3 ${XYC_SEC}"
  889. echo " |- 2: 1/5 ${XYC_SEC}"
  890. echo " |- 3: 1/10 ${XYC_SEC}"
  891. echo " |- 4: 1/15 ${XYC_SEC}"
  892. echo " |- 5: 1/30 ${XYC_SEC}"
  893. echo " |- 6: 1/50 ${XYC_SEC}"
  894. echo " |- 7: 1/60 ${XYC_SEC}"
  895. echo " |- 8: 1/80 ${XYC_SEC}"
  896. echo " |- 9: 1/125 ${XYC_SEC}"
  897. echo " |- 10: 1/140 ${XYC_SEC}"
  898. echo " |- 11: 1/250 ${XYC_SEC}"
  899. echo " |- 12: 1/320 ${XYC_SEC}"
  900. echo " |- 13: 1/500 ${XYC_SEC}"
  901. echo " |- 14: 1/752 ${XYC_SEC}"
  902. echo " |- 15: 1/1244 ${XYC_SEC}"
  903. echo " |- 16: 1/2138 ${XYC_SEC}"
  904. echo " |- 17: 1/3675 ${XYC_SEC}"
  905. echo " |- 18: 1/6316 ${XYC_SEC}"
  906. echo " |- 19: 1/8147 ${XYC_SEC}"
  907. local REPLY=$EXP
  908. read -p " -> " REPLY
  909. case $REPLY in
  910. 0) unset EXP;;
  911. 1) EXP=590;;
  912. 2) EXP=700;;
  913. 3) EXP=800;;
  914. 4) EXP=900;;
  915. 5) EXP=1000;;
  916. 6) EXP=1100;;
  917. 7) EXP=1145;;
  918. 8) EXP=1200;;
  919. 9) EXP=1275;;
  920. 10) EXP=1300;;
  921. 11) EXP=1405;;
  922. 12) EXP=1450;;
  923. 13) EXP=1531;;
  924. 14) EXP=1607;;
  925. 15) EXP=1700;;
  926. 16) EXP=1800;;
  927. 17) EXP=1900;;
  928. 18) EXP=2000;;
  929. 19) EXP=2047;;
  930. esac
  931. }
  932.  
  933. expView ()
  934. {
  935. case ${1} in
  936. 1) EXPVIEW="7.9 ${XYC_SEC}";;
  937. 8) EXPVIEW="7.7 ${XYC_SEC}";;
  938. 50) EXPVIEW="6.1 ${XYC_SEC}";;
  939. 100) EXPVIEW="4.6 ${XYC_SEC}";;
  940. 200) EXPVIEW="2.7 ${XYC_SEC}";;
  941. 300) EXPVIEW="1 ${XYC_SEC}";;
  942. 590) EXPVIEW="1/3 ${XYC_SEC}";;
  943. 700) EXPVIEW="1/5 ${XYC_SEC}";;
  944. 800) EXPVIEW="1/10 ${XYC_SEC}";;
  945. 900) EXPVIEW="1/15 ${XYC_SEC}";;
  946. 1000) EXPVIEW="1/30 ${XYC_SEC}";;
  947. 1100) EXPVIEW="1/50 ${XYC_SEC}";;
  948. 1145) EXPVIEW="1/60 ${XYC_SEC}";;
  949. 1200) EXPVIEW="1/80 ${XYC_SEC}";;
  950. 1275) EXPVIEW="1/125 ${XYC_SEC}";;
  951. 1300) EXPVIEW="1/140 ${XYC_SEC}";;
  952. 1405) EXPVIEW="1/250 ${XYC_SEC}";;
  953. 1450) EXPVIEW="1/320 ${XYC_SEC}";;
  954. 1531) EXPVIEW="1/500 ${XYC_SEC}";;
  955. 1607) EXPVIEW="1/752 ${XYC_SEC}";;
  956. 1700) EXPVIEW="1/1244 ${XYC_SEC}";;
  957. 1800) EXPVIEW="1/2138 ${XYC_SEC}";;
  958. 1900) EXPVIEW="1/3675 ${XYC_SEC}";;
  959. 2000) EXPVIEW="1/6316 ${XYC_SEC}";;
  960. 2047) EXPVIEW="1/8147 ${XYC_SEC}";;
  961. *) EXPVIEW="${XYC_AUTO}";;
  962. esac
  963. }
  964.  
  965. getISOInput ()
  966. {
  967. clear
  968. echo " |-> ${XYC_ISO} ${XYC_MENU}"
  969. echo " |- 0: ${XYC_AUTO}"
  970. echo " |- 1: 100"
  971. echo " |- 2: 200"
  972. echo " |- 3: 400"
  973. echo " |- 4: 800"
  974. echo " |- 5: 1600"
  975. echo " |- 6: 3200"
  976. echo " |- 7: 6400"
  977. echo " |- 8: 12800 ${XYC_WARNING}"
  978. echo " |- 9: 25600 ${XYC_WARNING}"
  979. local REPLY
  980. read -p " -> " REPLY
  981. case $REPLY in
  982. 0) unset ISO;;
  983. 1) ISO=100;;
  984. 2) ISO=200;;
  985. 3) ISO=400;;
  986. 4) ISO=800;;
  987. 5) ISO=1600;;
  988. 6) ISO=3200;;
  989. 7) ISO=6400;;
  990. 8) ISO=12800;;
  991. 9) ISO=25600;;
  992. esac
  993. }
  994.  
  995. getAWBInput ()
  996. {
  997. clear
  998. local REPLY
  999. read -p "${XYC_ENTER_AWB_PROMPT} (${XYC_Y}/${XYC_N}) [${XYC_ENTER}]: " REPLY
  1000. if [[ "$REPLY" == ${XYC_Y} || "$REPLY" == ${XYC_N} ]]; then AWB=$REPLY; fi
  1001. }
  1002.  
  1003. getNRInput ()
  1004. {
  1005. clear
  1006. echo " |-> ${XYC_NOISE_REDUCTION} ${XYC_MENU}"
  1007. echo " |- 0: ${XYC_DEFAULT}"
  1008. echo " |- 1: ${XYC_DISABLE}"
  1009. echo " |- 2: 500"
  1010. echo " |- 3: 1024"
  1011. echo " |- 4: 2048"
  1012. echo " |- 5: ${XYC_MAX}"
  1013. echo " |- 6: ${XYC_CUSTOM}"
  1014. local REPLY
  1015. read -p " -> " REPLY
  1016. case $REPLY in
  1017. 0) unset NR;;
  1018. 1) NR=-1;;
  1019. 2) NR=500;;
  1020. 3) NR=1024;;
  1021. 4) NR=2048;;
  1022. 5) NR=16383;;
  1023. 6) getCustomNRInput;;
  1024. esac
  1025. }
  1026.  
  1027. getCustomNRInput ()
  1028. {
  1029. clear
  1030. local REPLY=$NR
  1031. read -p "${XYC_CUSTOM_NR_PROMPT} (0-16383) [${XYC_ENTER}=$NR]: " REPLY
  1032. if [ -n "$REPLY" ]; then
  1033. if [[ $REPLY -le 16383 && $REPLY -ge 0 ]]; then NR=$REPLY; fi
  1034. fi
  1035. }
  1036.  
  1037. getAAAInput ()
  1038. {
  1039. clear
  1040. local REPLY
  1041. read -p "${XYC_AAA_PROMPT} (${XYC_Y}/${XYC_N}) [${XYC_ENTER}]: " REPLY
  1042. if [[ "$REPLY" == ${XYC_Y} || "$REPLY" == ${XYC_N} ]]; then AAA=$REPLY; fi
  1043. }
  1044.  
  1045. getGammaInput ()
  1046. {
  1047. clear
  1048. echo " |-> ${XYC_GAMMA} ${XYC_MENU}"
  1049. echo " |- 0: ${XYC_DEFAULT}"
  1050. echo " |- 1: ${XYC_MIN}"
  1051. echo " |- 2: 180"
  1052. echo " |- 3: 200"
  1053. echo " |- 4: 220"
  1054. echo " |- 5: ${XYC_MAX}"
  1055. echo " |- 6: ${XYC_CUSTOM}"
  1056. local REPLY
  1057. read -p " -> " REPLY
  1058. case $REPLY in
  1059. 0) unset GAMMA;;
  1060. 1) GAMMA=0;;
  1061. 2) GAMMA=180;;
  1062. 3) GAMMA=200;;
  1063. 4) GAMMA=220;;
  1064. 5) GAMMA=255;;
  1065. 6) getCustomGammaInput;;
  1066. esac
  1067. }
  1068.  
  1069. getCustomGammaInput ()
  1070. {
  1071. clear
  1072. local REPLY=$GAMMA
  1073. read -p "${XYC_GAMMA_PROMPT} (0-255) [${XYC_ENTER}=$GAMMA]: " REPLY
  1074. if [ -n "$REPLY" ]; then
  1075. if [[ $REPLY -le 255 && $REPLY -ge 0 ]]; then GAMMA=$REPLY; fi
  1076. fi
  1077. }
  1078.  
  1079. getAutoKneeInput ()
  1080. {
  1081. clear
  1082. echo " |-> ${XYC_AUTOKNEE} ${XYC_MENU}"
  1083. echo " |- 0: ${XYC_DEFAULT}"
  1084. echo " |- 1: ${XYC_MAX}"
  1085. echo " |- 2: ${XYC_CUSTOM}"
  1086. local REPLY
  1087. read -p " -> " REPLY
  1088. case $REPLY in
  1089. 0) unset AUTOKNEE;;
  1090. 1) AUTOKNEE=255;;
  1091. 2) getCustomAutoKneeInput;;
  1092. esac
  1093. }
  1094.  
  1095. getCustomAutoKneeInput ()
  1096. {
  1097. clear
  1098. local REPLY=$AUTOKNEE
  1099. read -p "${XYC_AUTOKNEE_PROMPT} (0-255) [${XYC_ENTER}=$AUTOKNEE]: " REPLY
  1100. if [ -n "$REPLY" ]; then
  1101. if [[ $REPLY -le 255 && $REPLY -ge 0 ]]; then AUTOKNEE=$REPLY; fi
  1102. fi
  1103. }
  1104.  
  1105. getSaturationInput ()
  1106. {
  1107. clear
  1108. echo " |-> ${XYC_VIBSAT} ${XYC_MENU}"
  1109. echo " |- 0: ${XYC_DEFAULT}"
  1110. echo " |- 1: ${XYC_SUPER_HIGH}"
  1111. echo " |- 2: ${XYC_HIGH}"
  1112. echo " |- 3: ${XYC_NORMAL}"
  1113. echo " |- 4: ${XYC_LOW}"
  1114. echo " |- 5: ${XYC_GRAY}"
  1115. local REPLY
  1116. read -p " -> " REPLY
  1117. case $REPLY in
  1118. 0) unset VIBSAT;;
  1119. 1) VIBSAT=1;;
  1120. 2) VIBSAT=2;;
  1121. 3) VIBSAT=3;;
  1122. 4) VIBSAT=4;;
  1123. 5) VIBSAT=5;;
  1124. esac
  1125. }
  1126.  
  1127. getSceneInput ()
  1128. {
  1129. clear
  1130. echo " |-> ${XYC_SCENE} ${XYC_MENU}"
  1131. echo " |- 0: ${XYC_DEFAULT}"
  1132. echo " |- 1: ${XYC_AUTO}"
  1133. echo " |- 2: ${XYC_LANDSCAPE}"
  1134. echo " |- 3: ${XYC_PORTRAIT}"
  1135. echo " |- 4: ${XYC_THROUGH_GLASS}"
  1136. echo " |- 5: ${XYC_CAR_DV}"
  1137. local REPLY
  1138. read -p " -> " REPLY
  1139. case $REPLY in
  1140. 0) unset SCENE;;
  1141. 1) SCENE=1;;
  1142. 2) SCENE=13;;
  1143. 3) SCENE=14;;
  1144. 4) SCENE=34;;
  1145. 5) SCENE=38;;
  1146. esac
  1147. }
  1148.  
  1149. getRawInput ()
  1150. {
  1151. clear
  1152. local REPLY
  1153. read -p "${XYC_CREATE_RAW_PROMPT} (${XYC_Y}/${XYC_N}) [${XYC_ENTER}]: " REPLY
  1154. if [[ "$REPLY" == ${XYC_Y} || "$REPLY" == ${XYC_N} ]]; then RAW=$REPLY; fi
  1155. }
  1156.  
  1157. getJpegInput ()
  1158. {
  1159. clear
  1160. local REPLY
  1161. read -p "${XYC_JPEG_QUALITY_PROMPT} (${XYC_Y}/${XYC_N}) [${XYC_ENTER}]: " REPLY
  1162. if [[ "$REPLY" == ${XYC_Y} || "$REPLY" == ${XYC_N} ]]; then JPEG=$REPLY; fi
  1163. }
  1164.  
  1165. getSharpnessInput ()
  1166. {
  1167. clear
  1168. local REPLY
  1169. while true
  1170. do
  1171. echo " |-> ${XYC_SHARPNESS} ${XYC_MENU}"
  1172. echo " |- 0: ${XYC_DEFAULT}"
  1173. printf " |- 1: ${XYC_MODE}: "
  1174. if [ -z "$SHR" ]; then
  1175. echo "${XYC_DEFAULT}"
  1176. elif [ $SHR -eq 0 ]; then
  1177. echo "${XYC_SHR_MODE_VIDEO}"
  1178. elif [ $SHR -eq 1 ]; then
  1179. echo "${XYC_SHR_MODE_FAST}"
  1180. elif [ $SHR -eq 2 ]; then
  1181. echo "${XYC_SHR_MODE_LOWISO}"
  1182. elif [ $SHR -eq 3 ]; then
  1183. echo "${XYC_SHR_MODE_HIGHISO}"
  1184. fi
  1185. printf " |- 2: ${XYC_SHARPNESS_FIR}: "
  1186. if [ -n "$FIR" ]; then
  1187. echo "$FIR"
  1188. else
  1189. echo "${XYC_DEFAULT}"
  1190. fi
  1191. printf " |- 3: ${XYC_SHARPNESS_COR}: "
  1192. if [ -n "$COR" ]; then
  1193. echo "$COR"
  1194. else
  1195. echo "${XYC_DEFAULT}"
  1196. fi
  1197. read -p " -> " REPLY
  1198. case $REPLY in
  1199. 0) unset SHR FIR COR; return;;
  1200. 1) getSharpModeInput; clear;;
  1201. 2) getSharpFirInput; clear;;
  1202. 3) getSharpCorInput; clear;;
  1203. *) clear; echo "${XYC_INVALID_CHOICE}";;
  1204. esac
  1205. if [ -n "$SHR" ]; then
  1206. if [[ -n "$FIR" || -n "$COR" ]]; then
  1207. return;
  1208. fi
  1209. fi
  1210. done
  1211. }
  1212.  
  1213. getSharpModeInput ()
  1214. {
  1215. clear
  1216. echo " |- ${XYC_SHARPNESS} ${XYC_MENU}"
  1217. echo " |-> ${XYC_SHARPNESS} ${XYC_MODE} ${XYC_MENU}"
  1218. echo " |- 0: ${XYC_SHR_MODE_VIDEO}"
  1219. echo " |- 1: ${XYC_SHR_MODE_FAST}"
  1220. echo " |- 2: ${XYC_SHR_MODE_LOWISO}"
  1221. echo " |- 3: ${XYC_SHR_MODE_HIGHISO}"
  1222. local REPLY
  1223. read -p " -> " REPLY
  1224. case $REPLY in
  1225. 0) SHR=0;;
  1226. 1) SHR=1;;
  1227. 2) SHR=2;;
  1228. 3) SHR=3;;
  1229. esac
  1230. getSharpnessInput
  1231. }
  1232.  
  1233. getSharpFirInput ()
  1234. {
  1235. clear
  1236. local REPLY=$FIR
  1237. read -p "${XYC_SHARPNESS_FIR_PROMPT} (0-255) [${XYC_ENTER}=$FIR]: " REPLY
  1238. if [ -n "$REPLY" ]; then
  1239. if [[ $REPLY -le 255 && $REPLY -ge 0 ]]; then FIR=$REPLY; fi
  1240. fi
  1241. }
  1242.  
  1243. getSharpCorInput ()
  1244. {
  1245. clear
  1246. local REPLY=$COR
  1247. read -p "${XYC_SHARPNESS_COR_PROMPT} (0-255) [${XYC_ENTER}=$COR]: " REPLY
  1248. if [ -n "$REPLY" ]; then
  1249. if [[ $REPLY -le 255 && $REPLY -ge 0 ]]; then COR=$REPLY; fi
  1250. fi
  1251. }
  1252.  
  1253. getVideoResolutionInput ()
  1254. {
  1255. clear
  1256. echo " |-> ${XYC_RESOLUTION} ${XYC_MENU}"
  1257. echo " |- 0: ${XYC_DEFAULT}"
  1258. echo " |- 1: 1280x720"
  1259. echo " |- 2: 1280x960"
  1260. echo " |- 3: 1600x1200"
  1261. echo " |- 4: 1920x1080"
  1262. echo " |- 5: 2304x1296"
  1263. echo " |- 6: 2560x1440"
  1264. local REPLY
  1265. read -p " -> " REPLY
  1266. if [ -n "$REPLY" ]; then
  1267. unset SVIEW
  1268. fi
  1269. case $REPLY in
  1270. 0) unset RES FPS; return;;
  1271. 1) RES=1; getVideoFrequencyInput;;
  1272. 2) RES=2; getVideoFrequencyInput;;
  1273. 3) RES=3; getVideoFrequencyInput;;
  1274. 4) RES=4; getVideoFrequencyInput;;
  1275. 5) RES=5; FPS=2;;
  1276. 6) RES=6; FPS=2;;
  1277. esac
  1278. setRESView
  1279. }
  1280.  
  1281. getVideoFrequencyInput ()
  1282. {
  1283. clear
  1284. echo " |- ${XYC_RESOLUTION} ${XYC_MENU}"
  1285. echo " |-> ${XYC_FREQUENCY} ${XYC_MENU}"
  1286. echo " |- 0: ${XYC_DEFAULT}"
  1287. echo " |- 1: 24 ${XYC_FPS}"
  1288. echo " |- 2: 30 ${XYC_FPS}"
  1289. echo " |- 3: 48 ${XYC_FPS}"
  1290. echo " |- 4: 60 ${XYC_FPS}"
  1291. if [ $RES -eq 1 ]; then
  1292. echo " |- 5: 120 ${XYC_FPS}"
  1293. fi
  1294. local REPLY
  1295. read -p " -> " REPLY
  1296. case $REPLY in
  1297. 1) FPS=1;;
  1298. 3) FPS=3;;
  1299. 4) FPS=4;;
  1300. 5) if [ $RES -eq 1 ]; then
  1301. FPS=5
  1302. else
  1303. FPS=2
  1304. fi;;
  1305. *) FPS=2;;
  1306. esac
  1307. }
  1308.  
  1309. getSuperViewInput ()
  1310. {
  1311. clear
  1312. echo " |-> ${XYC_SUPERVIEW} ${XYC_MENU}"
  1313. echo " |- 0: ${XYC_DISABLE}"
  1314. echo " |- 1: 1920x1080 60 ${XYC_FPS}"
  1315. echo " |- 2: 2304x1296 30 ${XYC_FPS}"
  1316. echo " |- 3: 2560x1440 30 ${XYC_FPS}"
  1317. local REPLY
  1318. read -p " -> " REPLY
  1319. case $REPLY in
  1320. 0) unset SVIEW RES FPS; return;;
  1321. 1) SVIEW="1080p@60"; RES=3; FPS=4;;
  1322. 2) SVIEW="1296p@30"; RES=3; FPS=2;;
  1323. 3) SVIEW="1440p@30"; RES=3; FPS=2;;
  1324. esac
  1325. setRESView
  1326. }
  1327.  
  1328. getVideoBitrateInput ()
  1329. {
  1330. clear
  1331. echo " |-> ${XYC_BITRATE} ${XYC_MENU}"
  1332. echo " |- 0: ${XYC_DEFAULT}"
  1333. echo " |- 1: 20 ${XYC_MBS}"
  1334. echo " |- 2: 25 ${XYC_MBS}"
  1335. echo " |- 3: 30 ${XYC_MBS}"
  1336. echo " |- 4: 35 ${XYC_MBS}"
  1337. echo " |- 5: 40 ${XYC_MBS}"
  1338. echo " |- 6: 45 ${XYC_MBS}"
  1339. echo " |- 7: 50 ${XYC_MBS}"
  1340. local REPLY
  1341. read -p " -> " REPLY
  1342. case $REPLY in
  1343. 0) unset BIT; return;;
  1344. 1) BIT="0x41A0";;
  1345. 2) BIT="0x41C8";;
  1346. 3) BIT="0x41F0";;
  1347. 4) BIT="0x420C";;
  1348. 5) BIT="0x4220";;
  1349. 6) BIT="0x4234";;
  1350. 7) BIT="0x4248";;
  1351. esac
  1352. setBITView
  1353. }
  1354.  
  1355. setRESView ()
  1356. {
  1357. if [ -z "$RES" ]; then return; fi
  1358. if [ $RES -eq 1 ]; then
  1359. RESVIEW="720p"
  1360. if [ $FPS -eq 1 ]; then
  1361. RESVIEW="$RESVIEW@24"
  1362. elif [ $FPS -eq 2 ]; then
  1363. RESVIEW="$RESVIEW@30"
  1364. elif [ $FPS -eq 3 ]; then
  1365. RESVIEW="$RESVIEW@48"
  1366. elif [ $FPS -eq 4 ]; then
  1367. RESVIEW="$RESVIEW@60"
  1368. elif [ $FPS -eq 5 ]; then
  1369. RESVIEW="$RESVIEW@120"
  1370. fi
  1371. elif [ $RES -eq 2 ]; then
  1372. RESVIEW="960p"
  1373. if [ $FPS -eq 1 ]; then
  1374. RESVIEW="$RESVIEW@24"
  1375. elif [ $FPS -eq 2 ]; then
  1376. RESVIEW="$RESVIEW@30"
  1377. elif [ $FPS -eq 3 ]; then
  1378. RESVIEW="$RESVIEW@48"
  1379. elif [ $FPS -eq 4 ]; then
  1380. RESVIEW="$RESVIEW@60"
  1381. fi
  1382. elif [ $RES -eq 3 ]; then
  1383. RESVIEW="HD"
  1384. if [ $FPS -eq 1 ]; then
  1385. RESVIEW="$RESVIEW@24"
  1386. elif [ $FPS -eq 2 ]; then
  1387. RESVIEW="$RESVIEW@30"
  1388. elif [ $FPS -eq 3 ]; then
  1389. RESVIEW="$RESVIEW@48"
  1390. elif [ $FPS -eq 4 ]; then
  1391. RESVIEW="$RESVIEW@60"
  1392. fi
  1393. elif [ $RES -eq 4 ]; then
  1394. RESVIEW="1080p"
  1395. if [ $FPS -eq 1 ]; then
  1396. RESVIEW="$RESVIEW@24"
  1397. elif [ $FPS -eq 2 ]; then
  1398. RESVIEW="$RESVIEW@30"
  1399. elif [ $FPS -eq 3 ]; then
  1400. RESVIEW="$RESVIEW@48"
  1401. elif [ $FPS -eq 4 ]; then
  1402. RESVIEW="$RESVIEW@60"
  1403. fi
  1404. elif [ $RES -eq 5 ]; then
  1405. RESVIEW="1296p"
  1406. if [ $FPS -eq 2 ]; then
  1407. RESVIEW="$RESVIEW@30"
  1408. fi
  1409. elif [ $RES -eq 6 ]; then
  1410. RESVIEW="1440p"
  1411. if [ $FPS -eq 2 ]; then
  1412. RESVIEW="$RESVIEW@30"
  1413. fi
  1414. fi
  1415. }
  1416.  
  1417. setBITView ()
  1418. {
  1419. if [ -z "$BIT" ]; then return; fi
  1420. if [ "$BIT" == "0x41A0" ]; then
  1421. BITVIEW="20Mb"
  1422. elif [ "$BIT" == "0x41C8" ]; then
  1423. BITVIEW="25Mb"
  1424. elif [ "$BIT" == "0x41F0" ]; then
  1425. BITVIEW="30Mb"
  1426. elif [ "$BIT" == "0x420C" ]; then
  1427. BITVIEW="35Mb"
  1428. elif [ "$BIT" == "0x4220" ]; then
  1429. BITVIEW="40Mb"
  1430. elif [ "$BIT" == "0x4234" ]; then
  1431. BITVIEW="45Mb"
  1432. elif [ "$BIT" == "0x4248" ]; then
  1433. BITVIEW="50Mb"
  1434. fi
  1435. }
  1436.  
  1437. getBigFileInput ()
  1438. {
  1439. clear
  1440. local REPLY
  1441. read -p "${XYC_BIG_FILE_PROMPT} (${XYC_Y}/${XYC_N}) [${XYC_ENTER}]: " REPLY
  1442. if [[ "$REPLY" == ${XYC_Y} || "$REPLY" == ${XYC_N} ]]; then BIG_FILE=$REPLY; fi
  1443. }
  1444.  
  1445. getIncludeUserSettings ()
  1446. {
  1447. clear
  1448. if [[ -f "$USER_SETTINGS_FILE" && -r "$USER_SETTINGS_FILE" ]]; then
  1449. local REPLY
  1450. read -p "${XYC_INCLUDE_USER_SETTINGS_PROMPT} (${XYC_Y}/${XYC_N}) [${XYC_ENTER}]: " REPLY
  1451. if [[ "$REPLY" == ${XYC_Y} || "$REPLY" == ${XYC_N} ]]; then
  1452. INC_USER=$REPLY;
  1453. clear; writeAutoexec;
  1454. return;
  1455. fi
  1456. else
  1457. echo "${XYC_CANNOT_READ} $USER_SETTINGS_FILE"
  1458. echo "${XYC_CREATE_FILE} $USER_SETTINGS_FILE"
  1459. echo ""
  1460. read -p "[${XYC_ENTER}]"
  1461. fi
  1462. clear
  1463. }
  1464.  
  1465. getSaveBatteryInput ()
  1466. {
  1467. clear
  1468. local REPLY
  1469. read -p "${XYC_SAVE_BATTERY_PROMPT} (${XYC_Y}/${XYC_N}) [${XYC_ENTER}]: " REPLY
  1470. if [[ "$REPLY" == ${XYC_Y} || "$REPLY" == ${XYC_N} ]]; then BAT=$REPLY; fi
  1471. }
  1472.  
  1473. getBuzzerVolumeInput ()
  1474. {
  1475. clear
  1476. local REPLY=$VOL
  1477. read -p "${XYC_BUZZER_VOLUME_PROMPT} (1-150) [${XYC_ENTER}=$VOL]: " REPLY
  1478. if [ -n "$REPLY" ]; then
  1479. if [[ $REPLY -le 150 && $REPLY -ge 1 ]]; then VOL=$REPLY; fi
  1480. fi
  1481. }
  1482.  
  1483. getTLModeInput()
  1484. {
  1485. clear
  1486. echo " |- ${XYC_TIME_LAPSE_SETTINGS} ${XYC_MENU}"
  1487. echo " |-> ${XYC_TIME_LAPSE_MODE} ${XYC_MENU}"
  1488. echo " |- 0: ${XYC_CUSTOM}"
  1489. echo " |- 1: ${XYC_INVINITY}"
  1490. echo " |- 2: ${XYC_HDR}"
  1491. local REPLY
  1492. read -p " -> " REPLY
  1493. case $REPLY in
  1494. 0) TLMODE=0;;
  1495. 1) TLMODE=1;;
  1496. 2) TLMODE=2;;
  1497. esac
  1498. }
  1499.  
  1500. getTLDelayInput()
  1501. {
  1502. clear
  1503. local REPLY=$TLDELAY
  1504. read -p "${XYC_CYCLES_INTERVAL_PROMPT} (1-3600) [${XYC_ENTER}=$REPLY]: " REPLY
  1505. if [[ $REPLY -le 3600 && $REPLY -ge 1 ]]; then
  1506. TLDELAY=$REPLY
  1507. fi
  1508. }
  1509.  
  1510. getTLNumShotsInput()
  1511. {
  1512. clear
  1513. local REPLY=$TLNUM
  1514. read -p "${XYC_NUM_CYCLES_PROMPT} (1-360) [${XYC_ENTER}=$REPLY]: " REPLY
  1515. if [[ $REPLY -le 360 && $REPLY -ge 1 ]]; then
  1516. TLNUM=$REPLY
  1517. TLMODE=0
  1518. fi
  1519. }
  1520.  
  1521. getTLOnceInput()
  1522. {
  1523. clear
  1524. local REPLY
  1525. read -p "${XYC_RUN_ONCE_ONLY_PROMPT} (${XYC_Y}/${XYC_N}) [${XYC_ENTER}]: " REPLY
  1526. if [ "$REPLY" == ${XYC_Y} ]; then
  1527. TLONCE=${XYC_Y}
  1528. TLMODE=0
  1529. elif [ "$REPLY" == ${XYC_N} ]; then
  1530. TLONCE=${XYC_N}
  1531. fi
  1532. }
  1533.  
  1534. getTLOffInput()
  1535. {
  1536. clear
  1537. local REPLY
  1538. read -p "${XYC_POWEROFF_WHEN_COMPLETE_PROMPT} (${XYC_Y}/${XYC_N}) [${XYC_ENTER}]: " REPLY
  1539. if [ "$REPLY" == ${XYC_Y} ]; then
  1540. TLOFF=${XYC_Y}
  1541. TLMODE=0
  1542. elif [ "$REPLY" == ${XYC_N} ]; then
  1543. TLOFF=${XYC_N}
  1544. fi
  1545. }
  1546.  
  1547. getHDRInput ()
  1548. {
  1549. clear
  1550. local REPLY=0
  1551. while [ $REPLY -eq 0 ]
  1552. do
  1553. echo " |- ${XYC_HDR_SETTINGS} ${XYC_MENU}"
  1554. echo " |- ${XYC_CUSTOM} ${XYC_HDR} ${XYC_MENU}"
  1555. echo " |-> ${XYC_HDR}1"
  1556. echo " |- 1: 4.6 ${XYC_SEC}"
  1557. echo " |- 2: 2.7 ${XYC_SEC}"
  1558. echo " |- 3: 1.0 ${XYC_SEC}"
  1559. echo " |- 4: 1/3 ${XYC_SEC}"
  1560. echo " |- 5: 1/5 ${XYC_SEC}"
  1561. echo " |- 6: 1/10 ${XYC_SEC}"
  1562. echo " |- ${XYC_HDR}2"
  1563. echo " |- ${XYC_HDR}3"
  1564. read -p " -> " REPLY
  1565. case $REPLY in
  1566. 1) HDR1=100; HEHE1=1;;
  1567. 2) HDR1=200; HEHE1=2;;
  1568. 3) HDR1=300; HEHE1=3;;
  1569. 4) HDR1=590; HEHE1=4;;
  1570. 5) HDR1=700; HEHE1=5;;
  1571. 6) HDR1=800; HEHE1=6;;
  1572. *) clear; echo "${XYC_INVALID_CHOICE}"; REPLY=0;;
  1573. esac
  1574. done
  1575. clear
  1576. expView $HDR1
  1577. HDR1VIEW=$EXPVIEW
  1578. local REPLY=0
  1579. while [ $REPLY -eq 0 ]
  1580. do
  1581. echo " |- ${XYC_HDR_SETTINGS} ${XYC_MENU}"
  1582. echo " |- ${XYC_CUSTOM} ${XYC_HDR} ${XYC_MENU}"
  1583. echo " |- ${XYC_HDR}1: $HDR1VIEW"
  1584. echo " |-> ${XYC_HDR}2"
  1585. echo " |- 1: 1.15 ${XYC_SEC}"
  1586. echo " |- 2: 1/30 ${XYC_SEC}"
  1587. echo " |- 3: 1/50 ${XYC_SEC}"
  1588. echo " |- 4: 1/80 ${XYC_SEC}"
  1589. echo " |- 5: 1/140 ${XYC_SEC}"
  1590. echo " |- 6: 1/250 ${XYC_SEC}"
  1591. echo " |- ${XYC_HDR}3"
  1592. read -p " -> " REPLY
  1593. case $REPLY in
  1594. 1) HDR2=900; HEHE2=1;;
  1595. 2) HDR2=1000; HEHE2=2;;
  1596. 3) HDR2=1100; HEHE2=3;;
  1597. 4) HDR2=1200; HEHE2=4;;
  1598. 5) HDR2=1300; HEHE2=5;;
  1599. 6) HDR2=1405; HEHE2=6;;
  1600. *) clear; echo "${XYC_INVALID_CHOICE}"; REPLY=0;;
  1601. esac
  1602. done
  1603. clear
  1604. expView $HDR2
  1605. HDR2VIEW=$EXPVIEW
  1606. local REPLY=0
  1607. while [ $REPLY -eq 0 ]
  1608. do
  1609. echo " |- ${XYC_HDR_SETTINGS} ${XYC_MENU}"
  1610. echo " |- ${XYC_CUSTOM} ${XYC_HDR} ${XYC_MENU}"
  1611. echo " |- ${XYC_HDR}1: $HDR1VIEW"
  1612. echo " |- ${XYC_HDR}2: $HDR2VIEW"
  1613. echo " |-> ${XYC_HDR}3"
  1614. echo " |- 1: 1/500 ${XYC_SEC}"
  1615. echo " |- 2: 1/752 ${XYC_SEC}"
  1616. echo " |- 3: 1/1244 ${XYC_SEC}"
  1617. echo " |- 4: 1/2138 ${XYC_SEC}"
  1618. echo " |- 5: 1/3675 ${XYC_SEC}"
  1619. echo " |- 6: 1/6316 ${XYC_SEC}"
  1620. read -p " -> " REPLY
  1621. case $REPLY in
  1622. 1) HDR3=1531; HEHE3=1;;
  1623. 2) HDR3=1607; HEHE3=2;;
  1624. 3) HDR3=1700; HEHE3=3;;
  1625. 4) HDR3=1800; HEHE3=4;;
  1626. 5) HDR3=1900; HEHE3=5;;
  1627. 6) HDR3=2000; HEHE3=6;;
  1628. *) clear; echo "${XYC_INVALID_CHOICE}"; REPLY=0;;
  1629. esac
  1630. done
  1631. clear
  1632. }
  1633.  
  1634. getCreatePresetInput ()
  1635. {
  1636. clear
  1637. local NAME
  1638. while [ -z "$NAME" ]
  1639. do
  1640. local REPLY
  1641. read -p "${XYC_NEW_PRESET_PROMPT} [${XYC_ENTER}]: " REPLY
  1642. if [ -z "$REPLY" ]; then
  1643. clear; return;
  1644. else
  1645. REPLY=${REPLY//[[:space:]]/}
  1646. fi
  1647. if [[ ! -f "$PRESETS_FILE" ]]; then
  1648. echo "Creating $PRESETS_FILE"
  1649. echo "# Created by XYC $VERS" > $PRESETS_FILE
  1650. echo "# https://github.com/alex-agency/XYC" >> $PRESETS_FILE
  1651. echo "# XYC Presets config" >> $PRESETS_FILE
  1652. NAME=$REPLY
  1653. else
  1654. if grep -Rq "^$REPLY." $PRESETS_FILE; then
  1655. clear;
  1656. echo "${XYC_NAME_EXIST}: $REPLY"
  1657. else
  1658. NAME=$REPLY
  1659. fi
  1660. fi
  1661. done
  1662. clear
  1663. echo "Writing $PRESETS_FILE"
  1664. echo "" >> $PRESETS_FILE
  1665. echo "#Start $NAME" >> $PRESETS_FILE
  1666. writePreset $NAME "ISO" "ISO"
  1667. writePreset $NAME "EXP" "Exposure"
  1668. writePreset $NAME "AWB" "AWB"
  1669. writePreset $NAME "NR" "NR"
  1670. writePreset $NAME "RAW" "RAW"
  1671. writePreset $NAME "JPEG" "JPEG 100%"
  1672. writePreset $NAME "AUTAN" "HDR Mode"
  1673. writePreset $NAME "HDR1" "HDR1"
  1674. writePreset $NAME "HDR2" "HDR2"
  1675. writePreset $NAME "HDR3" "HDR3"
  1676. writePreset $NAME "SHR" "Sharpness Mode"
  1677. writePreset $NAME "FIR" "Sharpness Digital Filter"
  1678. writePreset $NAME "COR" "Sharpness Coring"
  1679. writePreset $NAME "AAA" "AAA"
  1680. writePreset $NAME "GAMMA" "Gamma"
  1681. writePreset $NAME "AUTOKNEE" "Auto Knee"
  1682. writePreset $NAME "VIBSAT" "Saturation"
  1683. writePreset $NAME "SCENE" "Scene mode"
  1684. writePreset $NAME "RES" "Resolution"
  1685. writePreset $NAME "FPS" "FPS"
  1686. writePreset $NAME "BIT" "Bitrate"
  1687. writePreset $NAME "SVIEW" "SuperView"
  1688. writePreset $NAME "BIG_FILE" "4Gb files"
  1689. writePreset $NAME "INC_USER" "Import User settings"
  1690. writePreset $NAME "BAT" "Save battery"
  1691. writePreset $NAME "VOL" "Buzzer volume"
  1692. writePreset $NAME "TLMODE" "Time-lapse Mode"
  1693. writePreset $NAME "TLDELAY" "Time-lapse Interval"
  1694. writePreset $NAME "TLNUM" "Time-lapse Cycles"
  1695. writePreset $NAME "TLONCE" "Time-lapse run once"
  1696. writePreset $NAME "TLOFF" "Time-lapse poweroff"
  1697. echo "#End $NAME" >> $PRESETS_FILE
  1698.  
  1699. echo ""
  1700. echo "${XYC_PRESET_CREATED}: $NAME"
  1701. echo ""
  1702. read -p "[${XYC_ENTER}]"
  1703. }
  1704.  
  1705. writePreset ()
  1706. {
  1707. local VALUE
  1708. eval VALUE="\$${2}"
  1709. if [ -n "$VALUE" ]; then
  1710. echo "${3}: $VALUE"
  1711. echo "${1}.${2}=$VALUE #${3}" >> $PRESETS_FILE
  1712. fi
  1713. }
  1714.  
  1715. showPresetsList ()
  1716. {
  1717. clear
  1718. local PRESET=$(grep -F '=' $PRESETS_FILE | cut -d '.' -f1 | sort -u )
  1719. if [ -n "$PRESET" ]; then
  1720. echo " |- ${XYC_PRESETS} ${XYC_MENU}"
  1721. if [ "${1}" == "load" ]; then
  1722. echo " |-> ${XYC_LOAD_PRESET} ${XYC_MENU}"
  1723. else
  1724. echo " |-> ${XYC_REMOVE_PRESET} ${XYC_MENU}"
  1725. fi
  1726. local i=1
  1727. for item in $PRESET; do
  1728. echo " |- $((i++)): $item "
  1729. done
  1730. local REPLY
  1731. read -p " -> " REPLY
  1732. if [[ $REPLY -lt $i && $REPLY -ge 1 ]]; then
  1733. local NAME=$(echo $PRESET | cut -d ' ' -f$REPLY)
  1734. if [ "${1}" == "load" ]; then
  1735. loadPreset $NAME
  1736. return;
  1737. else
  1738. removePreset $NAME
  1739. fi
  1740. fi
  1741. else
  1742. echo ""
  1743. echo "${XYC_NO_PRESETS}"
  1744. echo ""
  1745. read -p "[${XYC_ENTER}]"
  1746. fi
  1747. return 1;
  1748. }
  1749.  
  1750. loadPreset ()
  1751. {
  1752. clear
  1753. echo "Reading $PRESETS_FILE"
  1754. while read line
  1755. do
  1756. if echo $line | grep "${1}\." >/dev/null; then
  1757. local PARAM=$(echo "$line" | cut -d '.' -f 2)
  1758. local INFO=$(echo "$PARAM" | cut -d '#' -f 2)
  1759. local VALUE=$(echo "$PARAM" | cut -d '=' -f 2 | cut -d ' ' -f 1)
  1760.  
  1761. eval $(echo "$PARAM" | cut -d ' ' -f 1)
  1762. echo "$INFO: $VALUE"
  1763. fi
  1764. done < $PRESETS_FILE
  1765. setMissingValues
  1766. echo ""
  1767. echo "${XYC_PRESET_LOADED}: $NAME"
  1768. echo ""
  1769. read -p "[${XYC_ENTER}]"
  1770. clear
  1771. }
  1772.  
  1773. removePreset ()
  1774. {
  1775. clear
  1776. echo "Writing $PRESETS_FILE"
  1777. echo "$(grep -v "^${1}\." $PRESETS_FILE)" > $PRESETS_FILE
  1778. echo "$(grep -v " ${1}$" $PRESETS_FILE)" > $PRESETS_FILE
  1779. echo ""
  1780. echo "${XYC_PRESET_REMOVED}: $NAME"
  1781. echo ""
  1782. read -p "[${XYC_ENTER}]"
  1783. clear
  1784. }
  1785.  
  1786. showSpaceUsage ()
  1787. {
  1788. clear
  1789. local JPEG_COUNT=`find ${FUSED} -name *.jpg | wc -l`
  1790. local RAW_COUNT=`find ${FUSED} -name *.RAW | wc -l`
  1791. local MP4_COUNT=`find ${FUSED} -name *.mp4 | wc -l`
  1792. local THM_COUNT=`find ${FUSED} -name *.THM -o -name *thm.mp4 | wc -l`
  1793.  
  1794. local SPACE_TOTAL=`df -h ${FUSED} | awk -F " " '/tmp/ {print $2}'`
  1795. local SPACE_USED=`df -h ${FUSED} | awk -F " " '/tmp/ {print $3}'`
  1796. local SPACE_FREE=`df -h ${FUSED} | awk -F " " '/tmp/ {print $4}'`
  1797. local USED_PCT=`df -h ${FUSED} | awk -F " " '/tmp/ {print $5}'`
  1798.  
  1799. local SPACE_FREE_KB=`df -k ${FUSED} | awk -F " " '/tmp/ {print $4}'`
  1800.  
  1801. local JPEG_LEFT=`expr $SPACE_FREE_KB / 5500`
  1802. local RAW_LEFT=`expr $SPACE_FREE_KB / 31000`
  1803. local MP4_LEFT=`expr $SPACE_FREE_KB / 88000`
  1804.  
  1805. echo "${XYC_SD_CARD_SPACE}:"
  1806. echo " ${XYC_TOTAL}=$SPACE_TOTAL, ${XYC_USED}=$SPACE_USED ($USED_PCT), ${XYC_FREE}=$SPACE_FREE"
  1807. echo ""
  1808. echo "${XYC_FILE_COUNTS}:"
  1809. echo " JPEG=$JPEG_COUNT, RAW=$RAW_COUNT, MP4=$MP4_COUNT, THM=$THM_COUNT"
  1810. echo ""
  1811. echo "${XYC_ESTIMATED_REMAINING}:"
  1812. echo " JPEG=$JPEG_LEFT, RAW=$RAW_LEFT, MP4=$MP4_LEFT ${XYC_MINUTES}"
  1813. echo ""
  1814. read -p "[${XYC_ENTER}]"
  1815. }
  1816.  
  1817. getCleanUpInput ()
  1818. {
  1819. clear
  1820. read -p "${XYC_DELETE_VIDEO_PREVIEW_PROMPT} (${XYC_Y}/${XYC_N}) [${XYC_ENTER}=n]: " REPLY
  1821. if [ "$REPLY" == ${XYC_Y} ]; then
  1822. echo "${XYC_REMOVING} ${FUSED}/DCIM/**/*.THM"
  1823. rm -f ${FUSED}/DCIM/**/*.THM
  1824. echo "${XYC_REMOVING} ${FUSED}/DCIM/**/*thm.mp4"
  1825. rm -f ${FUSED}/DCIM/**/*thm.mp4
  1826. echo ""
  1827. fi
  1828. read -p "${XYC_DELETE_RAW_PROMPT} (${XYC_Y}/${XYC_N}) [${XYC_ENTER}=n]: " REPLY
  1829. if [ "$REPLY" == ${XYC_Y} ]; then
  1830. echo "${XYC_REMOVING} ${FUSED}/DCIM/**/*.RAW"
  1831. rm -f ${FUSED}/DCIM/**/*.RAW
  1832. echo ""
  1833. read -p "[${XYC_ENTER}]"
  1834. fi
  1835. }
  1836.  
  1837. getDelaySuggestion ()
  1838. {
  1839. #Delay should be sum of file write time (WT) and exposure time (ET)
  1840. #if delay is too short, then the camera doesn't write the RAW file...
  1841. #make delay longer as necessary, depending on shutter speed and SD card
  1842. #performance
  1843. local WT=10
  1844. local ET=0
  1845. if [ ${1} -ge 0 2> /dev/null ]; then
  1846. if [ ${1} -eq 0 ]; then ET=1;
  1847. elif [ ${1} -lt 30 ]; then ET=8;
  1848. elif [ ${1} -lt 50 ]; then ET=7;
  1849. elif [ ${1} -lt 90 ]; then ET=6;
  1850. elif [ ${1} -lt 150 ]; then ET=5;
  1851. elif [ ${1} -lt 200 ]; then ET=4;
  1852. elif [ ${1} -lt 300 ]; then ET=3;
  1853. elif [ ${1} -lt 400 ]; then ET=2;
  1854. elif [ ${1} -lt 1000 ]; then ET=1;
  1855. else ET=0;
  1856. fi
  1857. fi
  1858. return $(expr $WT + $ET)
  1859. }
  1860.  
  1861. removeAutoexec ()
  1862. {
  1863. echo "${XYC_DELETING} $AASH"
  1864. rm -f $AASH
  1865. if [[ -f "$CORCONF" && -w "$CORCONF" ]]; then
  1866. echo "${XYC_DELETING} $CORCONF"
  1867. rm -f $CORCONF
  1868. fi
  1869. echo ${XYC_RESTART_TO_APPLY}
  1870. echo ""
  1871. }
  1872.  
  1873. writeAutoexec ()
  1874. {
  1875. OUTFILE=${1:-$AASH}
  1876. SCRIPT_TYPE=${2:-"settings"}
  1877. echo "${XYC_WRITING} $OUTFILE"
  1878.  
  1879. #Write any necessary script commands to autoexec.ash
  1880. echo "# Generated by XYC $VERS, `date`" > $OUTFILE
  1881. echo "# https://github.com/alex-agency/XYC" >> $OUTFILE
  1882. echo "" >> $OUTFILE
  1883.  
  1884. if [ $VIBSAT -ge 1 2> /dev/null ]; then
  1885. echo "#vibrance/saturation adjustments" >> $OUTFILE
  1886. if [ $VIBSAT -eq 1 ]; then
  1887. echo "t ia2 -adj ev 0 0 160 0 0 190 0" >> $OUTFILE
  1888. elif [ $VIBSAT -eq 2 ]; then
  1889. echo "t ia2 -adj ev 0 0 140 0 0 150 0" >> $OUTFILE
  1890. elif [ $VIBSAT -eq 3 ]; then
  1891. echo "t ia2 -adj ev 10 0 70 0 0 150 0" >> $OUTFILE
  1892. elif [ $VIBSAT -eq 4 ]; then
  1893. echo "t ia2 -adj ev 10 0 70 0 0 100 0" >> $OUTFILE
  1894. elif [ $VIBSAT -eq 5 ]; then
  1895. echo "t ia2 -adj ev 10 0 70 0 0 50 0" >> $OUTFILE
  1896. fi
  1897. echo "" >> $OUTFILE
  1898. fi
  1899.  
  1900. if [ -n "$SCENE" ]; then
  1901. echo "#enable scene mode" >> $OUTFILE
  1902. echo "# [1/13/14]: auto/landscape/portrait" >> $OUTFILE
  1903. echo "# [34/38]: through_glass/car_DV" >> $OUTFILE
  1904. echo "t cal -sc $SCENE" >> $OUTFILE
  1905. echo "" >> $OUTFILE
  1906. fi
  1907.  
  1908. if [ "$JPEG" == ${XYC_Y} ]; then
  1909. echo "#set JPEG quality to 100%" >> $OUTFILE
  1910. echo "t cal -jqlt 100" >> $OUTFILE
  1911. echo "" >> $OUTFILE
  1912. fi
  1913.  
  1914. if [ -n "$AUTOKNEE" ]; then
  1915. echo "#shadow/highlight clipping adjustments" >> $OUTFILE
  1916. echo "#this makes blacks not crushed" >> $OUTFILE
  1917. echo "#set long exposure level [0~255]" >> $OUTFILE
  1918. echo "t ia2 -adj l_expo 163" >> $OUTFILE
  1919. echo "#this gets back the highlights" >> $OUTFILE
  1920. echo "#set Auto Knee level [0~255]" >> $OUTFILE
  1921. echo "t ia2 -adj autoknee $AUTOKNEE" >> $OUTFILE
  1922. echo "" >> $OUTFILE
  1923. fi
  1924.  
  1925. if [ -n "$GAMMA" ]; then
  1926. echo "#set gamma level [0~255]" >> $OUTFILE
  1927. echo "t ia2 -adj gamma $GAMMA" >> $OUTFILE
  1928. echo "" >> $OUTFILE
  1929. fi
  1930.  
  1931. if [[ -n "$ISO" || -n "$EXP" ]]; then
  1932. echo "#set ISO and Exposure" >> $OUTFILE
  1933. echo "# exp: [iso_idx][exp_idx][gain_idx], 0 auto" >> $OUTFILE
  1934. if [ -z "$ISO" ]; then #ISO (Auto)
  1935. echo "t ia2 -ae exp 0 $EXP 0" >> $OUTFILE
  1936. elif [ -z "$EXP" ]; then #Exposure (Auto)
  1937. echo "t ia2 -ae exp $ISO 0 0" >> $OUTFILE
  1938. else
  1939. echo "t ia2 -ae exp $ISO $EXP 0" >> $OUTFILE
  1940. fi
  1941. echo "" >> $OUTFILE
  1942. fi
  1943.  
  1944. if [ "$AWB" == ${XYC_N} ]; then
  1945. echo "#disable Auto White Balance" >> $OUTFILE
  1946. echo "t ia2 -awb off" >> $OUTFILE
  1947. echo "" >> $OUTFILE
  1948. fi
  1949.  
  1950. if [ -n "$NR" ]; then
  1951. echo "#set Noise Reduction" >> $OUTFILE
  1952. echo "# tidx: [ev_idx][nf_idx][shutter_idx], -1 disable" >> $OUTFILE
  1953. echo "# [nf_idx]: 0-16383" >> $OUTFILE
  1954. echo "t ia2 -adj tidx -1 $NR -1" >> $OUTFILE
  1955. echo "" >> $OUTFILE
  1956. fi
  1957.  
  1958. if [ -n "$SHR" ]; then
  1959. echo "#Sharpness: $SHR $FIR $COR" >> $OUTFILE
  1960. echo "#set sharpness" >> $OUTFILE
  1961. echo "t is2 -shp mode $SHR" >> $OUTFILE
  1962. if [ -n "$FIR" ]; then
  1963. echo "t is2 -shp fir $FIR 0 0 0 0 0 0" >> $OUTFILE
  1964. fi
  1965. echo "t is2 -shp max_change 5 5" >> $OUTFILE
  1966. if [ -n "$COR" ]; then
  1967. echo "t is2 -shp cor d:\sharpening.config" >> $OUTFILE
  1968. echo "sleep 1" >> $OUTFILE
  1969.  
  1970. echo "Writing $CORCONF"
  1971. #Write any necessary script commands to sharpening.config
  1972. echo "# Generated by XYC $VERS, `date`" > $CORCONF
  1973. echo "# https://github.com/alex-agency/XYC" >> $CORCONF
  1974. echo "# Sharpening Coring script" >> $CORCONF
  1975. echo "$COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR $COR" >> $CORCONF
  1976. echo "" >> $CORCONF
  1977. fi
  1978. echo "" >> $OUTFILE
  1979. fi
  1980.  
  1981. if [ $RES -eq 1 2> /dev/null ]; then
  1982. echo "#set video $RESVIEW" >> $OUTFILE
  1983. if [ $FPS -eq 1 ]; then #1280x720 24fps
  1984. echo "writeb 0xC06CC426 0x28" >> $OUTFILE
  1985. echo "writel 0xC05C2FAC 0x02D00500" >> $OUTFILE
  1986. elif [ $FPS -eq 2 ]; then #1280x720 30fps
  1987. echo "writeb 0xC06CC426 0x11" >> $OUTFILE
  1988. echo "writel 0xC05C2DE0 0x02D00500" >> $OUTFILE
  1989. elif [ $FPS -eq 3 ]; then #1280x720 48fps
  1990. echo "writeb 0xC06CC426 0x27" >> $OUTFILE
  1991. echo "writel 0xC05C2F98 0x02D00500" >> $OUTFILE
  1992. elif [ $FPS -eq 4 ]; then #1280x720 60fps
  1993. echo "writeb 0xC06CC426 0x0F" >> $OUTFILE
  1994. echo "writel 0xC05C2DB8 0x02D00500" >> $OUTFILE
  1995. elif [ $FPS -eq 5 ]; then #1280x720 120fps
  1996. echo "writeb 0xC06CC426 0x34" >> $OUTFILE
  1997. echo "writel 0xC05C309C 0x02D00500" >> $OUTFILE
  1998. fi
  1999. echo "" >> $OUTFILE
  2000. elif [ $RES -eq 2 2> /dev/null ]; then
  2001. echo "#set video $RESVIEW" >> $OUTFILE
  2002. if [ $FPS -eq 1 ]; then #1280x960 24fps
  2003. echo "writeb 0xC06CC426 0x26" >> $OUTFILE
  2004. echo "writel 0xC05C2F84 0x03C00500" >> $OUTFILE
  2005. elif [ $FPS -eq 2 ]; then #1280x960 30fps
  2006. echo "writeb 0xC06CC426 0x17" >> $OUTFILE
  2007. echo "writel 0xC05C2E58 0x03C00500" >> $OUTFILE
  2008. elif [ $FPS -eq 3 ]; then #1280x960 48fps
  2009. echo "writeb 0xC06CC426 0x25" >> $OUTFILE
  2010. echo "writel 0xC05C2F70 0x03C00500" >> $OUTFILE
  2011. elif [ $FPS -eq 4 ]; then #1280x960 60fps
  2012. echo "writeb 0xC06CC426 0x16" >> $OUTFILE
  2013. echo "writel 0xC05C2E44 0x03C00500" >> $OUTFILE
  2014. fi
  2015. echo "" >> $OUTFILE
  2016. elif [ $RES -eq 3 2> /dev/null ]; then
  2017. echo "#set video $RESVIEW" >> $OUTFILE
  2018. if [ $FPS -eq 1 ]; then #1600x1200 24fps
  2019. echo "writeb 0xC06CC426 0x24" >> $OUTFILE
  2020. echo "writel 0xC05C2F5C 0x04B00640" >> $OUTFILE
  2021. echo "" >> $OUTFILE
  2022. elif [ $FPS -eq 2 ]; then #1600x1200 30fps
  2023. echo "writeb 0xC06CC426 0x0D" >> $OUTFILE
  2024. if [ -z "$SVIEW" ]; then
  2025. echo "writel 0xC05C2D90 0x04B00640" >> $OUTFILE
  2026. echo "" >> $OUTFILE
  2027. fi
  2028. elif [ $FPS -eq 3 ]; then #1600x1200 48fps
  2029. echo "writeb 0xC06CC426 0x23" >> $OUTFILE
  2030. echo "writel 0xC05C2F48 0x04B00640" >> $OUTFILE
  2031. echo "" >> $OUTFILE
  2032. elif [ $FPS -eq 4 ]; then #1600x1200 60fps
  2033. echo "writeb 0xC06CC426 0x0C" >> $OUTFILE
  2034. if [ -z "$SVIEW" ]; then
  2035. echo "writel 0xC05C2D7C 0x04B00640" >> $OUTFILE
  2036. echo "" >> $OUTFILE
  2037. fi
  2038. fi
  2039. elif [ $RES -eq 4 2> /dev/null ]; then
  2040. echo "#set video $RESVIEW" >> $OUTFILE
  2041. if [ $FPS -eq 1 ]; then #1920x1080 24fps
  2042. echo "writeb 0xC06CC426 0x21" >> $OUTFILE
  2043. echo "writel 0xC05C2F20 0x04380780" >> $OUTFILE
  2044. elif [ $FPS -eq 2 ]; then #1920x1080 30fps
  2045. echo "writeb 0xC06CC426 0x06" >> $OUTFILE
  2046. echo "writel 0xC05C2D04 0x04380780" >> $OUTFILE
  2047. elif [ $FPS -eq 3 ]; then #1920x1080 48fps
  2048. echo "writeb 0xC06CC426 0x20" >> $OUTFILE
  2049. echo "writel 0xC05C2F0C 0x04380780" >> $OUTFILE
  2050. elif [ $FPS -eq 4 ]; then #1920x1080 60fps
  2051. echo "writeb 0xC06CC426 0x03" >> $OUTFILE
  2052. echo "writel 0xC05C2CC8 0x04380780" >> $OUTFILE
  2053. fi
  2054. echo "" >> $OUTFILE
  2055. elif [ $RES -eq 5 2> /dev/null ]; then
  2056. echo "#set video $RESVIEW" >> $OUTFILE
  2057. if [ $FPS -eq 2 ]; then #2304x1296 30fps
  2058. echo "writeb 0xC06CC426 0x02" >> $OUTFILE
  2059. echo "writel 0xC05C2CB4 0x05100900" >> $OUTFILE
  2060. fi
  2061. echo "" >> $OUTFILE
  2062. elif [ $RES -eq 6 2> /dev/null ]; then
  2063. echo "#set video $RESVIEW" >> $OUTFILE
  2064. if [ $FPS -eq 2 ]; then #2560x1440 30fps
  2065. echo "writeb 0xC06CC426 0x02" >> $OUTFILE
  2066. echo "writel 0xC05C2CB4 0x05A00A00" >> $OUTFILE
  2067. fi
  2068. echo "" >> $OUTFILE
  2069. fi
  2070.  
  2071. if [ -n "$SVIEW" ]; then
  2072. echo "#stretch SuperView $SVIEW" >> $OUTFILE
  2073. if [ "$SVIEW" == "1080p@60" ]; then
  2074. echo "writel 0xC05C2D7C 0x04380780" >> $OUTFILE
  2075. elif [ "$SVIEW" == "1296p@30" ]; then
  2076. echo "writel 0xC05C2D90 0x05100900" >> $OUTFILE
  2077. elif [ "$SVIEW" == "1440p@30" ]; then
  2078. echo "writel 0xC05C2D90 0x05A00A00" >> $OUTFILE
  2079. fi
  2080. echo "" >> $OUTFILE
  2081. fi
  2082.  
  2083. if [ -n "$BIT" ]; then
  2084. echo "#set $BITVIEW bitrate for all resolutions" >> $OUTFILE
  2085. echo "#1280x720 24fps" >> $OUTFILE
  2086. echo "writew 0xC05C25D2 $BIT" >> $OUTFILE
  2087. echo "#1280x720 30fps" >> $OUTFILE
  2088. echo "writew 0xC05C2182 $BIT" >> $OUTFILE
  2089. echo "#1280x720 48fps" >> $OUTFILE
  2090. echo "writew 0xC05C25A2 $BIT" >> $OUTFILE
  2091. echo "#1280x720 60fps" >> $OUTFILE
  2092. echo "writew 0xC05C2122 $BIT" >> $OUTFILE
  2093. echo "#1280x720 120fps" >> $OUTFILE
  2094. echo "writew 0xC05C2812 $BIT" >> $OUTFILE
  2095. echo "#1280x960 24fps" >> $OUTFILE
  2096. echo "writew 0xC05C2572 $BIT" >> $OUTFILE
  2097. echo "#1280x960 30fps" >> $OUTFILE
  2098. echo "writew 0xC05C22A2 $BIT" >> $OUTFILE
  2099. echo "#1280x960 48fps" >> $OUTFILE
  2100. echo "writew 0xC05C2542 $BIT" >> $OUTFILE
  2101. echo "#1280x960 60fps" >> $OUTFILE
  2102. echo "writew 0xC05C2272 $BIT" >> $OUTFILE
  2103. echo "#1600x1200 24fps" >> $OUTFILE
  2104. echo "writew 0xC05C2512 $BIT" >> $OUTFILE
  2105. echo "#1600x1200 30fps" >> $OUTFILE
  2106. echo "writew 0xC05C20C2 $BIT" >> $OUTFILE
  2107. echo "#1600x1200 48fps" >> $OUTFILE
  2108. echo "writew 0xC05C24E2 $BIT" >> $OUTFILE
  2109. echo "#1600x1200 60fps" >> $OUTFILE
  2110. echo "writew 0xC05C2092 $BIT" >> $OUTFILE
  2111. echo "#1920x1080 24fps" >> $OUTFILE
  2112. echo "writew 0xC05C2482 $BIT" >> $OUTFILE
  2113. echo "#1920x1080 30fps" >> $OUTFILE
  2114. echo "writew 0xC05C1F72 $BIT" >> $OUTFILE
  2115. echo "#1920x1080 48fps" >> $OUTFILE
  2116. echo "writew 0xC05C2452 $BIT" >> $OUTFILE
  2117. echo "#1920x1080 60fps" >> $OUTFILE
  2118. echo "writew 0xC05C1EE2 $BIT" >> $OUTFILE
  2119. echo "#2304x1296 30fps" >> $OUTFILE
  2120. echo "writew 0xC05C1EB2 $BIT" >> $OUTFILE
  2121. echo "" >> $OUTFILE
  2122. fi
  2123.  
  2124. if [ "$RAW" == ${XYC_Y} ]; then
  2125. echo "#create RAW files" >> $OUTFILE
  2126. echo "t app test debug_dump 14" >> $OUTFILE
  2127. echo "" >> $OUTFILE
  2128. fi
  2129.  
  2130. if [ "$BIG_FILE" == ${XYC_Y} ]; then
  2131. echo "#set 4GB file weight limit" >> $OUTFILE
  2132. echo "writew 0xC03A8520 0x2004" >> $OUTFILE
  2133. echo "" >> $OUTFILE
  2134. fi
  2135.  
  2136. if [ "$AAA" == ${XYC_Y} ]; then
  2137. echo "#set AAA function" >> $OUTFILE
  2138. echo "# -3a [ae][awb][af][adj]: turn on/off ae/awb/af/adj" >> $OUTFILE
  2139. echo "# ae = [0|1], 0:on 1:off AE" >> $OUTFILE
  2140. echo "# awb = [0|1], 0:on 1:off AWB" >> $OUTFILE
  2141. echo "# af = [0|1], 0:on 1:off AF" >> $OUTFILE
  2142. echo "# adj = [0|1], 0:on 1:off ADJ" >> $OUTFILE
  2143. echo "t ia2 -3a 1 1 0 1" >> $OUTFILE
  2144. echo "" >> $OUTFILE
  2145. fi
  2146.  
  2147. if [ "$BAT" == ${XYC_Y} ]; then
  2148. echo "#save battery" >> $OUTFILE
  2149. echo "sleep 1" >> $OUTFILE
  2150. echo "t app lowbatt 100 10000000" >> $OUTFILE
  2151. echo "" >> $OUTFILE
  2152. fi
  2153.  
  2154. if [ -n "$VOL" ]; then
  2155. echo "#set buzzer volume [1~150]" >> $OUTFILE
  2156. echo "t pwm 1 set_level $VOL" >> $OUTFILE
  2157. echo "" >> $OUTFILE
  2158. fi
  2159.  
  2160. if [ "$INC_USER" == ${XYC_Y} ]; then
  2161. if [[ -f "$USER_SETTINGS_FILE" && -r "$USER_SETTINGS_FILE" ]]; then
  2162. echo "#User settings imported from $USER_SETTINGS_FILE" >> $OUTFILE
  2163. cat $USER_SETTINGS_FILE >> $OUTFILE
  2164. echo "#End user settings" >> $OUTFILE
  2165. echo "" >> $OUTFILE
  2166. else
  2167. echo "${XYC_CANNOT_READ} $USER_SETTINGS_FILE"
  2168. echo "#${XYC_CANNOT_READ} $USER_SETTINGS_FILE" >> $OUTFILE
  2169. fi
  2170. fi
  2171.  
  2172. echo "#Greeting script" >> $OUTFILE
  2173. echo "#front led blink" >> $OUTFILE
  2174. echo "t gpio 6 sw out1" >> $OUTFILE #front blue on
  2175. echo "sleep 1" >> $OUTFILE
  2176. echo "t gpio 6 sw out0" >> $OUTFILE #front blue off
  2177. echo "t gpio 54 sw out1" >> $OUTFILE #front red on
  2178. echo "sleep 1" >> $OUTFILE
  2179. echo "t gpio 54 sw out0" >> $OUTFILE #front red off
  2180. echo "#short beep & front leds" >> $OUTFILE
  2181. echo "t gpio 6 sw out1" >> $OUTFILE #front blue on
  2182. echo "t gpio 54 sw out1" >> $OUTFILE #front red on
  2183. echo "t pwm 1 enable" >> $OUTFILE #beep on
  2184. echo "sleep 1" >> $OUTFILE
  2185. echo "t gpio 6 sw out0" >> $OUTFILE #front blue off
  2186. echo "t gpio 54 sw out0" >> $OUTFILE #front red off
  2187. echo "t pwm 1 disable" >> $OUTFILE #beep off
  2188. echo "" >> $OUTFILE
  2189.  
  2190. if [ -n "$AUTAN" ]; then
  2191. if [ $TLMODE -eq 2 2> /dev/null ]; then
  2192. echo "#Time-lapse: $TLMODE $TLDELAY" >> $OUTFILE
  2193. echo "while true; do" >> $OUTFILE
  2194. echo "" >> $OUTFILE
  2195. fi
  2196.  
  2197. echo "#HDRParams: $AUTAN $HDR1 $HDR2 $HDR3" >> $OUTFILE
  2198. echo "sleep 10" >> $OUTFILE
  2199. echo "t ia2 -ae still_shutter $HDR1" >> $OUTFILE
  2200. echo "sleep 1" >> $OUTFILE
  2201. echo "t app key shutter" >> $OUTFILE
  2202. echo "t app key shutter_rel" >> $OUTFILE
  2203. getDelaySuggestion $HDR1
  2204. echo "sleep $?" >> $OUTFILE
  2205. if [ $AUTAN -eq 1 ]; then
  2206. echo "t ia2 -ae still_shutter 1100" >> $OUTFILE
  2207. echo "sleep 1" >> $OUTFILE
  2208. echo "t app key shutter" >> $OUTFILE
  2209. echo "t app key shutter_rel" >> $OUTFILE
  2210. getDelaySuggestion 1100
  2211. echo "sleep $?" >> $OUTFILE
  2212. echo "t ia2 -ae still_shutter 1405" >> $OUTFILE
  2213. echo "sleep 1" >> $OUTFILE
  2214. echo "t app key shutter" >> $OUTFILE
  2215. echo "t app key shutter_rel" >> $OUTFILE
  2216. getDelaySuggestion 1405
  2217. echo "sleep $?" >> $OUTFILE
  2218. elif [ $AUTAN -eq 2 ]; then
  2219. echo "t ia2 -ae still_shutter 100" >> $OUTFILE
  2220. echo "sleep 1" >> $OUTFILE
  2221. echo "t app key shutter" >> $OUTFILE
  2222. echo "t app key shutter_rel" >> $OUTFILE
  2223. getDelaySuggestion 100
  2224. echo "sleep $?" >> $OUTFILE
  2225. echo "t ia2 -ae still_shutter 200" >> $OUTFILE
  2226. echo "sleep 1" >> $OUTFILE
  2227. echo "t app key shutter" >> $OUTFILE
  2228. echo "t app key shutter_rel" >> $OUTFILE
  2229. getDelaySuggestion 200
  2230. echo "sleep $?" >> $OUTFILE
  2231. fi
  2232. echo "t ia2 -ae still_shutter $HDR2" >> $OUTFILE
  2233. echo "sleep 1" >> $OUTFILE
  2234. echo "t app key shutter" >> $OUTFILE
  2235. echo "t app key shutter_rel" >> $OUTFILE
  2236. getDelaySuggestion $HDR2
  2237. echo "sleep $?" >> $OUTFILE
  2238. if [ $AUTAN -eq 1 ]; then
  2239. echo "t ia2 -ae still_shutter 1700" >> $OUTFILE
  2240. echo "sleep 1" >> $OUTFILE
  2241. echo "t app key shutter" >> $OUTFILE
  2242. echo "t app key shutter_rel" >> $OUTFILE
  2243. getDelaySuggestion 1700
  2244. echo "sleep $?" >> $OUTFILE
  2245. elif [ $AUTAN -eq 2 ]; then
  2246. echo "t ia2 -ae still_shutter 590" >> $OUTFILE
  2247. echo "sleep 1" >> $OUTFILE
  2248. echo "t app key shutter" >> $OUTFILE
  2249. echo "t app key shutter_rel" >> $OUTFILE
  2250. getDelaySuggestion 590
  2251. echo "sleep $?" >> $OUTFILE
  2252. fi
  2253. echo "t ia2 -ae still_shutter $HDR3" >> $OUTFILE
  2254. echo "sleep 1" >> $OUTFILE
  2255. echo "t app key shutter" >> $OUTFILE
  2256. echo "t app key shutter_rel" >> $OUTFILE
  2257. echo "sleep 1" >> $OUTFILE
  2258. echo "" >> $OUTFILE
  2259.  
  2260. if [ $TLMODE -eq 2 2> /dev/null ]; then
  2261. echo " sleep $TLDELAY" >> $OUTFILE
  2262. echo "done" >> $OUTFILE
  2263. echo "" >> $OUTFILE
  2264. fi
  2265. fi
  2266.  
  2267. if [ $TLMODE -eq 1 2> /dev/null ]; then
  2268. echo "#Time-lapse: $TLMODE $TLDELAY" >> $OUTFILE
  2269. echo "sleep 10" >> $OUTFILE
  2270. echo "while true; do" >> $OUTFILE
  2271. echo " t app key shutter" >> $OUTFILE
  2272. echo " t app key shutter_rel" >> $OUTFILE
  2273. echo " sleep $TLDELAY" >> $OUTFILE
  2274. echo "done" >> $OUTFILE
  2275. echo "" >> $OUTFILE
  2276. elif [ $TLMODE -eq 0 2> /dev/null ]; then
  2277. echo "#Time-lapse: $TLMODE $TLDELAY $TLNUM $TLONCE $TLOFF" >> $OUTFILE
  2278. echo "sleep 10" >> $OUTFILE
  2279. for i in $(seq 1 $TLNUM); do
  2280. echo "t app key shutter" >> $OUTFILE
  2281. echo "t app key shutter_rel" >> $OUTFILE
  2282. echo "sleep $TLDELAY" >> $OUTFILE
  2283. done
  2284. if [ "$TLONCE" == ${XYC_Y} ]; then
  2285. echo "#remove time-lapse after first usage" >> $OUTFILE
  2286. echo "lu_util exec '$THIS_SCRIPT -t'" >> $OUTFILE
  2287. fi
  2288. if [ "$TLOFF" == ${XYC_Y} ]; then
  2289. echo "poweroff yes" >> $OUTFILE
  2290. fi
  2291. echo "" >> $OUTFILE
  2292. fi
  2293.  
  2294. echo ${XYC_RESTART_TO_APPLY}
  2295. echo ""
  2296. }
  2297.  
  2298. updateXYC ()
  2299. {
  2300. local REPLY
  2301. read -p "${XYC_UPDATE_NOW_PROMPT} (${XYC_Y}/${XYC_N}) [${XYC_ENTER}=n]: " REPLY
  2302. if [[ -z "$REPLY" || "$REPLY" == ${XYC_N} ]]; then
  2303. return 1;
  2304. fi
  2305. echo ""
  2306. echo " *********************************** "
  2307. echo " * * "
  2308. echo " * ${XYC_UPDATING_NOW}... * "
  2309. echo " * * "
  2310. echo " *********************************** "
  2311. echo ""
  2312. sleep 1
  2313. clear
  2314. cd $SCRIPT_DIR
  2315. local URL="https://raw.githubusercontent.com/alex-agency/XYC/master/xyc.sh"
  2316. if which wget >/dev/null; then
  2317. if wget -S --spider $URL 2>&1 | grep 'HTTP/1.1 200 OK'; then
  2318. wget -O xyc.sh $URL
  2319. return;
  2320. else
  2321. echo ""
  2322. echo " ${XYC_NO_INTERNET}"
  2323. echo " ${XYC_UPDATE_ERROR}"
  2324. fi
  2325. elif which curl >/dev/null; then
  2326. if curl -sSf $URL >/dev/null; then
  2327. curl $URL > xyc.sh
  2328. return;
  2329. else
  2330. echo ""
  2331. echo " ${XYC_NO_INTERNET}"
  2332. echo " ${XYC_UPDATE_ERROR}"
  2333. fi
  2334. else
  2335. echo ""
  2336. echo " wget: command not found "
  2337. echo " curl: command not found "
  2338. echo " ${XYC_UPDATE_ERROR}"
  2339. fi
  2340. return 1;
  2341. }
  2342.  
  2343.  
  2344. #Main program
  2345. parseExistingAutoexec
  2346. parseCommandLine $*
  2347. setMissingValues
  2348. welcome
  2349. showMainMenu
  2350.  
  2351. if [ "$EXITACTION" == "update" ]; then
  2352. if updateXYC; then
  2353. echo ""
  2354. echo " ${XYC_UPDATE_COMPLETE}"
  2355. else
  2356. echo ""
  2357. echo " ${XYC_UPDATE_MANUAL}:"
  2358. echo " https://github.com/alex-agency/XYC.git "
  2359. fi
  2360. echo ""
  2361. read -p "[${XYC_ENTER}]"
  2362. sh $SCRIPT_DIR/xyc.sh
  2363. elif [ "$EXITACTION" == "reboot" ]; then
  2364. echo "The camera might be freezed after restart via telnet."
  2365. echo "If you have this issue restart camera manualy."
  2366. echo ""
  2367. read -p "[${XYC_ENTER}]"
  2368. clear
  2369. echo ""
  2370. echo " *********************************** "
  2371. echo " * * "
  2372. echo " * ${XYC_REBOOTING_NOW}... * "
  2373. echo " * * "
  2374. echo " *********************************** "
  2375. echo ""
  2376. sleep 1
  2377. reboot yes
  2378. elif [ "$EXITACTION" == "poweroff" ]; then
  2379. echo ""
  2380. echo " *********************************** "
  2381. echo " * * "
  2382. echo " * ${XYC_SHUTTING_DOWN_NOW}... * "
  2383. echo " * * "
  2384. echo " *********************************** "
  2385. echo ""
  2386. sleep 1
  2387. poweroff yes
  2388. fi
RAW Paste Data