Button Combination Mode Switching (via *.ash scripts)

I think that these scripts are complicated for most users but it's a great idea. It would be nice to figure out how to switch between two video modes without a camera wifi manipulations.
 
Last edited:
I have scripts for different resolutions etc., but I would like to switch them using only Xiaomi camera buttons without need for a mobile phone or PC.
 
i dont understand why this thread isnt the most alive one on the forum.. its like the best thing!

luckylz has produced some wonderfully logical code here. But his description and illustration of his work is awful -IMHO. The camera already has video MODE and photo MODE. Now, layered on top of that, we have normal MODE and advanced MODE. Then, layered in there somewhere, there's custom MODE and WiFi MODE - all in the first post! After 5 days, I'm still digging my way out of all these MODES. The code, "mode.sh" hasn't even been mentioned - not even as an afterthought.
 
Last edited:
I'm really sorry for my bad English. So if you want to more details, I can show you guys how to...
 
i dont understand why this thread isnt the most alive one on the forum.. its like the best thing!

anyway, what lines do i need to change so the "normall mode" and "station mode" change between 120fps 720 to 1080 30fps?

so you want like this ?
normal mode: 720p 120fps
station mode: 1080p 30fps
 
Would be possible to change video modes without need to press a wifi button?
 
I don't think so.
When you're in photo mode, it means you want to take many photos; if you don't use "wifi" as a trigger, after you take 3 photos, the Cam will restart; but actually you want to take more photos.
 
This is not a problem for me. I need a video only. My camera wifi interfere with my another transmitter then I need leave the camera network off all the time.
 
Last edited:
Understood. So just try modify the [Custom Mode] script mode.sh as the following:
Code:
#!/bin/sh

# Trigger Video Mode Switch Without WiFi
# I don't test this in YiCam, should be working.
MODE=$1
LOGS=/tmp/fuse_a/custom/mode.log

if [ ! -f $LOGS ]; then
  echo `ls -lR /tmp/fuse_d/DCIM/ | grep "YDXJ" | wc -l` > $LOGS
else
  OLD=`cat $LOGS`
  NEW=`ls -lR /tmp/fuse_d/DCIM/ | grep "YDXJ" | wc -l`
  if [ $NEW -ge $(($OLD + 3)) ]; then
    TOP=`ls -lcR /tmp/fuse_d/DCIM/ | grep "YDXJ" | head -6`
    JPG=`echo "${TOP}" | grep ".jpg" | wc -l`
    if [ $JPG -ge 3 ]; then
      MP4=`echo "${TOP}" | grep "YDXJ" | head -3 | grep ".mp4" | wc -l`
      if [ $MP4 -eq 0 ]; then
        if [ "${MODE}" == "normal" ]; then
          cp -f /tmp/fuse_a/custom/advanced.ash /tmp/fuse_d/autoexec.ash
        else
          cp -f /tmp/fuse_a/custom/normal.ash /tmp/fuse_d/autoexec.ash
        fi
        sleep 1
        rm $LOGS
        reboot
      fi
    fi
  fi
fi
 
Hey luckylz, great work!
I looked into /proc/ambarella/gpio and, as I can see, here is the status of all GPIO of the board: wouldn't be possible to check for a key combination?
Would be great to have modes switch with power/shutter for a given time (1-2 seconds) without changing foto/viedo mode (I assume it can be done via shell scripts)...
...if you have any suggestion I'm open and willing to try.

:D
 
Hi @Pappe, since I have already consider others GPIO, e.g. power led, status led.
But the status will not be fixed as wifi GPIO. So I can only use wifi GPIO for mode switch.
 
Ok, but I mean change mode with other button press reading the gpio file for changes in the relative bits...
 
The button press status is very short time, and my script run every 10 seconds, so can not detect the very short time status-change.
If set the script to run always, it will make the YiCam very slow, that's why wifi status is good for me.
 
Ok!
I'll try something in the next few day and let you all know ;)
 
im gonna ask some question, is possible to asnwer il be very gald:
1. what is does station/ap mode diffrent from the 1st post? (my computer doesnt have wifi, can it help me anyway?)
2. why does code have so much "sleep" command?
3. does this scrip waste much more battery?
4. i have 10 seconds to do "picture picure picture wifi off" and if more then 10 seconds pass it wont swtich mode?
5. it code i see:
Code:
# video resolution 1296p
writeb 0xC06CE446 0x02
sleep 1
# bitrate 35Mbps
writew 0xC05C1006 0x420C

now on site for 720 120fps i see
Code:
156    1280    720    119,88    4190    C05C1966
157    1280    720    119,88    4170    C05C1976
158    1280    720    119,88    4140    C05C1986

is 156 the "high quialty" with most bitrate?
and i got only "C05C1966" but in your code you have "0x02" what do i need to put?
 
ok, found for you:
Code:
# video resolution 720p @ 120fps
writeb 0xC06CE446 0x34
sleep 1
# bitrate 35Mbps
writew 0xC05C1966 0x420C

actual 156 is very very closed to 0x34;)
Code:
156 / 3 = 52 --> hex 0x34
 
Last edited:
ok, found for you:
Code:
# video resolution 720p @ 120fps
writeb 0xC06CE446 0x34
sleep 1
# bitrate 35Mbps
writew 0xC05C1966 0x420C

actual 156 is very very closed to 0x34;)
Code:
156 / 3 = 52 --> hex 0x34
thanks alot,
possible to answer this question?

1. what is does station/ap mode diffrent from the 1st post? (my computer doesnt have wifi, can it help me anyway?)
2. why does code have so much "sleep" command?
3. does this scrip waste much more battery?
4. i have 10 seconds to do "picture picure picture wifi off" and if more then 10 seconds pass it wont swtich mode?
 
Back
Top