Button Combination Mode Switching (via *.ash scripts)

Q1: what is does station/ap mode diffrent from the 1st post? (my computer doesnt have wifi, can it help me anyway?)
A1:
station/ap mode, all resolution set to 1296p & RAW+jpg (same as advanced mode in 1st post);
in station mode, you can connect more than one Yi Cam;

Q2: why does code have so much "sleep" command?
A2:
nothing, just for seperate diff. commands;


Q3: does this scrip waste much more battery?
A3:
don't waste more battery, since I've been testing these scrips for weeks;

Q4: i have 10 seconds to do "picture picure picture wifi off" and if more then 10 seconds pass it wont swtich mode?
A4:
no, you just need to take 3 pictures within the wifi is on, then turn off the wifi; even the gap over 10secs, still can switch mode.
 
Q1: what is does station/ap mode diffrent from the 1st post? (my computer doesnt have wifi, can it help me anyway?)
A1:
station/ap mode, all resolution set to 1296p & RAW+jpg (same as advanced mode in 1st post);
in station mode, you can connect more than one Yi Cam;

Q2: why does code have so much "sleep" command?
A2:
nothing, just for seperate diff. commands;


Q3: does this scrip waste much more battery?
A3:
don't waste more battery, since I've been testing these scrips for weeks;

Q4: i have 10 seconds to do "picture picure picture wifi off" and if more then 10 seconds pass it wont swtich mode?
A4:
no, you just need to take 3 pictures within the wifi is on, then turn off the wifi; even the gap over 10secs, still can switch mode.
Thanks alot for explaining helps me understand alittle more :)

i dont need to connect more then 1 yi camera so im using beta 0.2 scrip

just to be sure tho this is advnace mode:

Code:
#advanced mode
sleep 3
lu_util exec 'rm /tmp/fuse_a/custom/mode.log'
sleep 1
# video resolution 1296p
writeb 0xC06CE446 0x02
sleep 1
# bitrate 35Mbps
writew 0xC05C1006 0x420C
sleep 1
while true
do
  lu_util exec '/tmp/fuse_a/custom/mode.sh advanced'
  sleep 9
done

and this is normall:

Code:
#normal mode
sleep 3
lu_util exec 'rm /tmp/fuse_a/custom/mode.log'
sleep 1
# video resolution 720p @ 120fps
writeb 0xC06CE446 0x34
sleep 1
# bitrate 35Mbps
writew 0xC05C1966 0x420C
sleep 1
while true
do
  sleep 9
  lu_util exec '/tmp/fuse_a/custom/mode.sh normal'
done

is there any mistakes?
 
I would love to use this to switch to my timelapse script when I need it.
But when timelapse runs, the only way to stop it, is to turn the camera off.
Can you make a version, that starts in normal mode all the time, and then can switch to advanced mode?
So that if you remove the power in advanced mode, next time it is in normal mode again?

That would be awesome :) Thanks for all your work on this, I think it is a great idea!
 
@luckylz can you check my scrip 2 posts up? i dont want to ruin my camera if somethings wrong..
 
Hi @itzik your code sure be no problem, just rename the file to advanced.ash & normal.ash, using my install.ash.

Further, I suggest:
1.you put some beep in different mode, in order to identify what mode you are in;
2.the "sleep 9" better after the "lu_util exec"
 
I would love to use this to switch to my timelapse script when I need it.
But when timelapse runs, the only way to stop it, is to turn the camera off.
Can you make a version, that starts in normal mode all the time, and then can switch to advanced mode?
So that if you remove the power in advanced mode, next time it is in normal mode again?

That would be awesome :) Thanks for all your work on this, I think it is a great idea!

Actually I've be able to make YiCam timelapse for some picture (e.g. 100pics, 200pics), and stop. but quite a busy now, so can not test the scripts. I'll give you the example script as soon as I'm free.
 
Hi @itzik your code sure be no problem, just rename the file to advanced.ash & normal.ash, using my install.ash.

Further, I suggest:
1.you put some beep in different mode, in order to identify what mode you are in;
2.the "sleep 9" better after the "lu_util exec"

thanks alot,
i tryed using google to serach the command to adding a beep, got a guide? or remmber by heart how to add?
and 1 more question, after chaning the install to "autocash..." do i need to remove it? or does it need to install each time i turn on camera?
 
Last edited:
it's all in the customode.zip file in the first post, you can just download and modify the scripts inside.
 
it's all in the customode.zip file in the first post, you can just download and modify the scripts inside.
this is beep sound command?
t pwm 1 enable
sleep 1
t pwm 1 disable
sleep 1
t pwm 1 enable
sleep 1
t pwm 1 disable
sleep 1
t pwm 1 enable
sleep 1

what does enable mean and what does disable mean?
 
Beep 1sec and then stop
 
can this script work on FW 1.2.6 ?
 
First of all, thanks @Andy_S ! He shares many many good script examples in python, linux shell, autoexec.ash, So I can finally make scripts in this thread. And also I need to thank many other guys who share their experiences on Yi Cam --- sorry I can't name them all here.

What's mean "Button Combination - Mode Switching" ? I explain it via my scripts.

Updated scripts for firmware version 1.2.10
customode(fw ver 1.2.10).zip

No.1 [Custom Mode] (beta version 0.0.2)
Code:
[Normal Mode]
---> with wifi on
---> take 3 pictures
---> turn off wifi
---> auto reboot
---> change to [Advanced Mode]
[Advanced Mode]
---> with wifi on
---> take 3 pictures
---> turn off wifi
---> auto reboot
---> change to [Normal Mode]
[Normal Mode]
...
and so on
...

In this way, when you go outside without laptop or mobile phone, you can still access to the [Advanced Mode] which you have already setup at home.

In my example, the [Advanced Mode] (fw 1.2.6 only) means: Video mode(1296p @30fps 35Mbps) & Photo mode(RAW+jpg)

[How to install]
Just download the zip file and unzip to the root of SD Card, rename the [install.ash] to [autoexec.ash], then power on Yi Cam with this SD Card inserted. If Yi Cam boots with a 2-seconds long beep, means install successfully.

[How to uninstall]
Rename the [uninstall.ash] to [autoexec.ash], then power on Yi Cam with this SD Card inserted. . If Yi Cam boots with a 2-seconds long beep, means uninstall successfully.

[Mode Status]
[Normal Mode] - Yi Cam normally power on without special beep, enter to this mode;
[Advaned Mode] - Yi Cam normally power on with 3 times 1-second beep, enter to this mode.

[Importance]
I only tested with my Yi Cam, to use this with your own decision.

I CAN NOT GUARANTEE IT WILL DAMAGE YOUR CAMERA OR NOT !
I can't download the script for the firmware 1.2.10. Can you upload it?.
Thanks for sharing!!
 
Pls use Andy_S mirror site
 
Hi, I'm trying to switch between "normal", "1080p60fps" and "720p120fps" modes just by switching twice Wifi On and Off, but it is not working:
Code:
...
if [ ${WIFI} -eq 1 ]; then
    t pwm 1 set_level 120
    sleep 1
    t pwm 1 enable
    sleep 2
    t pwm 1 disable
    if [ ${WIFI} -eq 0 ]; then
        sleep 1
        t pwm 1 enable
        sleep 2
        t pwm 1 disable
        if [ ${WIFI} -eq 1 ]; then
            sleep 1
            t pwm 1 enable
            sleep 2
            t pwm 1 disable
            if [ ${WIFI} -eq 0 ]; then
                sleep 1
                t pwm 1 enable
                sleep 2
                t pwm 1 disable
                if [ "${MODE}" == "normal" ]; then
                    cp -f /tmp/fuse_a/custom/modo1080p60fps.ash /tmp/fuse_d/autoexec.ash
                else if [ "${MODE}" == "modo1080p60fps" ]; then
                    cp -f /tmp/fuse_a/custom/modo720p120fps.ash /tmp/fuse_d/autoexec.ash
                    else
                        cp -f /tmp/fuse_a/custom/normal.ash /tmp/fuse_d/autoexec.ash
                    fi
                fi
                sleep 1
                reboot yes
            fi
        fi
    fi
fi
Does anybody know what am i doing wrong?

Thanks in advance!
 
Last edited:
t-command can't run in shell, only can run in the autoexec.ash
That's why need to reboot the camera
 
t-command can't run in shell, only can run in the autoexec.ash
That's why need to reboot the camera
After quitting the beeps it does not work neither, and if I leave just the first "if [ ${WIFI} -eq 1 ]; then" and i press the wifi button, then the camera keeps rebooting. Any idea?
 
Great little scripts luckylz!
Is there a reason why you install everything onto fuse_a ?
I put everything on the SD card (and changed the scripts to fuse_d accordingly + created enable_info_display.script manually) and it works like a charm without installing.

Can you give me a hint where I can find more information about the GPIOs?
What is the ID of the shutter button for example?
 
I liked the idea of swapping between different autoexec without an extra device so much that I digged myself a bit into it.

Using the idea and scripts of @luckylz I came up with the following:
- two different autoexec.ash on the SD card (autoexec.ash and autoexec2.ash)
- a small script that checks for press&hold of the shutter button, interchanges the two autoexec and reboots the cam (swap.sh)

HowTo:
- place the three files in the root of the SD card (and put your own code into the two autoexec)
- power on the cam
- to swap between different autoexec press and hold the shutter button until the cam reboots (may take up to 10 seconds)
- to remove this hack just delete the three files from the SD card

USE ON YOUR OWN RISK! Tested it on my cam (22) with FW 1.2.10!

Known issues:
- not working in video mode
- if cam is busy (saving RAW files for example) and you press the shutter button too often it might trigger the swapping and reboot
- will take a photo when press&hold ;)

Please let me know what you think about this.
 

Attachments

  • autoexec_swap.zip
    1.5 KB · Views: 18
save to fuse_a, if change card or format, I won't lose the config file. Only need the autoexec.ash copy back to the new card
 
Back
Top