tarina

git clone https://git.tarina.org/tarina
Log | Files | Refs | README | LICENSE

commit 8846bf89800cb29f42a3e2d910119e005086743d
parent 58b0366b6c92929341d31396f21439b7aad2cdee
Author: rob <rob@tarina.org>
Date:   Fri, 10 Nov 2023 00:22:29 +0200

Merge branch 'master' of https://git.tarina.org/tarina

Diffstat:
MVERSION | 2+-
Mgui/src/main.c | 80++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------
Mgui/tarinagui.bin | 0
Minstall.sh | 42+++++++++++++++++++++++-------------------
Mtarina.py | 278++++++++++++++++++++++++++++++++++++++++++++++++++++++++-----------------------
5 files changed, 274 insertions(+), 128 deletions(-)

diff --git a/VERSION b/VERSION @@ -1,2 +1,2 @@ -1.40 +1.41 Jackson diff --git a/gui/src/main.c b/gui/src/main.c @@ -36,7 +36,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "bcm_host.h" #include "vgfont.h" -int32_t render_subtitle(GRAPHICS_RESOURCE_HANDLE img, const char *text, const uint32_t text_size, const uint32_t x_offset, const uint32_t y_offset, uint32_t fontcolor) +int32_t render_subtitle(GRAPHICS_RESOURCE_HANDLE img, const char *text, const uint32_t text_size, const uint32_t text_size_selected, const uint32_t x_offset, const uint32_t y_offset, uint32_t fontcolor) { uint32_t height=0; uint32_t img_w, img_h; @@ -98,7 +98,7 @@ int32_t render_subtitle(GRAPHICS_RESOURCE_HANDLE img, const char *text, const ui GRAPHICS_RESOURCE_HEIGHT, GRAPHICS_RGBA32(0,0,0,0xff), /* fg */ GRAPHICS_RGBA32(30,255,255,0xff), /* bg */ - text, 90, 16); + text, 90, text_size_selected); } return 0; } @@ -126,6 +126,7 @@ int main(void) graphics_display_resource(img, 0, LAYER, 0, 0, GRAPHICS_RESOURCE_WIDTH, GRAPHICS_RESOURCE_HEIGHT, VC_DISPMAN_ROT0, 1); uint32_t text_size = 15; + uint32_t text_size_selected = 16; FILE * fp; FILE * fp2; FILE * fp3; @@ -141,6 +142,38 @@ int main(void) char newread[500]; char oldread[500]; char vumeter[130]; + uint32_t y_offset2 = 0; + uint32_t y_offset3 = 21; + uint32_t y_offset4 = 42; + uint32_t y_offset5 = 421; + uint32_t y_offset6 = 442; + uint32_t y_offset = 466; + int space = 10; + int morespace = 12; + int rectime = 700; + int color = 3; + int row1 = 0; + int row2 = 0; + int row3 = 0; + int row4 = 0; + int row5 = 0; + if (width == 1920){ + y_offset2 = 5; + y_offset3 = 45; + y_offset4 = 85; + y_offset5 = 960; + y_offset6 = 1000; + y_offset = 1040; + rectime = 1600; + text_size = 30; + text_size_selected = 32; + space = 23; + morespace = 27; + } + else { + space = 10; + morespace = 12; + } while (1) { // char ch; linenr = 0; @@ -156,22 +189,16 @@ int main(void) if (strcmp(newread, oldread) != 0) { strcpy(oldread, newread); //const char *text = "Never give up on your dreams"; - uint32_t y_offset2 = 0; - uint32_t y_offset3 = 21; - uint32_t y_offset4 = 42; - uint32_t y_offset5 = 421; - uint32_t y_offset6 = 442; + color = 3; + row1 = 0; + row2 = 0; + row3 = 0; + row4 = 0; + row5 = 0; graphics_resource_fill(img, 0, 0, width, height, GRAPHICS_RGBA32(0,0,0,0x00)); // blue, at the top (y=40) // selected 0 1 2 3 4 5 6 7 8 - int space = 10; - int morespace = 12; - int color = 3; - int row1 = 0; - int row2 = 0; - int row3 = 0; - int row4 = 0; - int row5 = 0; + // draw the text if updated fp2 = fopen("/dev/shm/interface", "r"); if (fp2 != NULL){ @@ -201,46 +228,46 @@ int main(void) header = 1; if (selected == 420){ if (linenr == 1) - render_subtitle(img, line, text_size, 0, y_offset2, 5); + render_subtitle(img, line, text_size, text_size_selected, 0, y_offset2, 5); if (linenr > 1) { - render_subtitle(img, line, text_size, row1, y_offset3, 5); + render_subtitle(img, line, text_size, text_size_selected, row1, y_offset3, 5); row1 += read * space + morespace; } } if (header == 0){ //check if normal menu or header menu if (selected < 420){ if ((linenr == 6+menuadd) && (read > 0)){ //show recording time if there is any - render_subtitle(img, line, text_size, 700, y_offset2, 3); + render_subtitle(img, line, text_size, text_size_selected, rectime, y_offset2, 3); } if (linenr >= 2+menuadd && linenr <= 5+menuadd){ if (color == 6) color = 5; - render_subtitle(img, line, text_size, row1, y_offset2, color); + render_subtitle(img, line, text_size, text_size_selected, row1, y_offset2, color); row1 += read * space + morespace; } if (linenr >= 7+menuadd && linenr <= 12+menuadd){ - render_subtitle(img, line, text_size, row2, y_offset3, color); + render_subtitle(img, line, text_size, text_size_selected, row2, y_offset3, color); row2 += read * space + morespace; } if (linenr >= 13+menuadd && linenr <= 20+menuadd){ - render_subtitle(img, line, text_size, row3, y_offset4, color); + render_subtitle(img, line, text_size, text_size_selected, row3, y_offset4, color); row3 += read * space + morespace; } if (linenr >= 21+menuadd && linenr <= 27+menuadd){ - render_subtitle(img, line, text_size, row4, y_offset5, color); + render_subtitle(img, line, text_size, text_size_selected, row4, y_offset5, color); row4 += read * space + morespace; } if (linenr >= 28+menuadd && linenr <= 40+menuadd){ - render_subtitle(img, line, text_size, row5, y_offset6, color); + render_subtitle(img, line, text_size, text_size_selected, row5, y_offset6, color); row5 += read * space + morespace; } } } else { // header menu if (linenr == 1+menuadd) - render_subtitle(img, line, text_size, 0, y_offset2, 5); + render_subtitle(img, line, text_size, text_size_selected, 0, y_offset2, 5); if (linenr > 1+menuadd){ - render_subtitle(img, line, text_size, row1, y_offset3, color); + render_subtitle(img, line, text_size, text_size_selected, row1, y_offset3, color); row1 += read * space + morespace; } } @@ -254,7 +281,6 @@ int main(void) } //graphics_update_displayed_resource(img, 0, 0, 0, 0); } - uint32_t y_offset = 466; char s_vol1 = vumeter[85]; char s_vol2 = vumeter[86]; char s_vol[1]; @@ -269,7 +295,7 @@ int main(void) vucolor = 2; if (vol >= 99) vucolor = 3; - render_subtitle(img, vumeter, text_size, 0, y_offset, vucolor); + render_subtitle(img, vumeter, text_size, text_size_selected , 0, y_offset, vucolor); graphics_update_displayed_resource(img, 0, 0, 0, 0); usleep(20000); } diff --git a/gui/tarinagui.bin b/gui/tarinagui.bin Binary files differ. diff --git a/install.sh b/install.sh @@ -83,30 +83,13 @@ echo "Tarina configuration seems to be in order in /boot/config.txt" echo "Adding to /boot/config.txt" cat <<'EOF' >> /boot/config.txt #-----Tarina configuration starts here------- -#tarina-rpi-configuration-1.0 -#Rpi-hd-tft -dtoverlay=dpi18 -overscan_left=0 -overscan_right=0 -overscan_top=0 -overscan_bottom=0 -framebuffer_width=800 -framebuffer_height=480 -enable_dpi_lcd=1 -display_default_lcd=1 -dpi_group=2 -dpi_mode=87 -dpi_output_format=0x6f015 -hdmi_timings=480 0 16 16 24 800 0 4 2 2 0 0 0 60 0 32000000 6 -dtoverlay=pi3-disable-bt-overlay -dtoverlay=i2c-gpio,i2c_gpio_scl=24,i2c_gpio_sda=23framebuffer_height=480 -display_rotate=3 +#tarina-rpi-configuration-1.1 +#hyperpixel start_x=1 gpu_mem=256 disable_splash=1 force_turbo=1 boot_delay=1 -dtparam=i2c_arm=on # dtparam=sd_overclock=90 # Disable the ACT LED. dtparam=act_led_trigger=none @@ -114,6 +97,27 @@ dtparam=act_led_activelow=off # Disable the PWR LED. dtparam=pwr_led_trigger=none dtparam=pwr_led_activelow=off +framebuffer_width=800 +framebuffer_height=480 +#hdmi_force_hotplug=1 +hdmi_group=1 +hdmi_mode=3 +[EDID=N/A-] ##Hyperpixel HD CONFIG + +dtoverlay=hyperpixel4 +overscan_left=0 +overscan_right=0 +overscan_top=0 +overscan_bottom=0 +enable_dpi_lcd=1 +display_default_lcd=1 +display_rotate=1 +dpi_group=2 +hdmi_group=2 +dpi_mode=87 +dpi_output_format=0x7f216 +hdmi_timings=480 0 10 16 59 800 0 15 113 15 0 0 0 60 0 32000000 6 + #--------Tarina configuration end here--------- EOF elif [ "$screen" = "hyperpixel4" ] diff --git a/tarina.py b/tarina.py @@ -48,7 +48,7 @@ print('running debian ' + debianversion) #I2CBUTTONS probei2c = 0 -while probei2c < 10: +while probei2c < 3: try: if debianversion == "stretch": os.system('sudo modprobe i2c-dev') @@ -76,18 +76,17 @@ while probei2c < 10: i2cbuttons = False probei2c += 1 time.sleep(1) + bus='' #MAIN def main(): - global headphoneslevel, miclevel, tarinafolder, screen, loadfilmsettings, plughw, channels, filmfolder, scene, showmenu, rendermenu, quality, profilelevel, i2cbuttons, menudone, soundrate, soundformat, process, serverstate, que, port, recording, onlysound, camera_model, fps_selection, fps_selected, fps, db, selected, cammode, newfilmname, camera_recording + global headphoneslevel, miclevel, tarinafolder, screen, loadfilmsettings, plughw, channels, filmfolder, scene, showmenu, rendermenu, quality, profilelevel, i2cbuttons, menudone, soundrate, soundformat, process, serverstate, que, port, recording, onlysound, camera_model, fps_selection, fps_selected, fps, db, selected, cammode, newfilmname, camera_recording, abc # Get path of the current dir, then use it as working directory: rundir = os.path.dirname(__file__) if rundir != '': os.chdir(rundir) - filmfolder = "/home/pi/Videos/" - picfolder = "/home/pi/Pictures/" - if os.path.isdir(filmfolder) == False: - os.makedirs(filmfolder) + #filmfolder = "/home/pi/Videos/" + #picfolder = "/home/pi/Pictures/" tarinafolder = os.getcwd() #MENUS @@ -125,6 +124,7 @@ def main(): rendermenu = True showmenu = 1 showmenu_settings = True + showhelp = False overlay = None underlay = None reclenght = 0 @@ -171,9 +171,15 @@ def main(): tarinavername = f.readline() db='' + #FIRE UP CAMERA + camera = startcamera(lens,fps) + #GET FILMFOLDER AND CAMERA VERSION + camera_model, camera_revision , filmfolder = getconfig(camera) + if os.path.isdir(filmfolder) == False: + os.makedirs(filmfolder) #SYSTEM CONFIGS (turn off hdmi) - run_command('tvservice -o') + #run_command('tvservice -o') #Kernel page cache optimization for sd card run_command('sudo ' + tarinafolder + '/extras/sdcardhack.sh') #Make screen shut off work and run full brightness @@ -184,7 +190,6 @@ def main(): diskleft = str(int(disk.f_bavail * disk.f_frsize / 1024 / 1024 / 1024)) + 'Gb' #START INTERFACE startinterface() - camera = startcamera(lens,fps) #LOAD FILM AND SCENE SETTINGS try: @@ -249,7 +254,7 @@ def main(): serverstate_old='off' wifistate_old='off' - camera_model, camera_revision = getconfig(camera) + camera_model, camera_revision, filmfolder= getconfig(camera) #--------------MAIN LOOP---------------# while True: @@ -257,8 +262,6 @@ def main(): if pressagain != '': pressed = pressagain pressagain = '' - if buttonpressed == True: - flushbutton() #event = screen.getch() if wifistate != wifistate_old: if wifistate == 'on': @@ -313,14 +316,18 @@ def main(): #SHOWHELP elif pressed == 'showhelp': vumetermessage('Button layout') - overlay = removeimage(camera, overlay) - overlay = displayimage(camera, tarinafolder+'/extras/buttons.png', overlay, 4) - while holdbutton == 'showhelp' or pressed == 'H': - pressed, buttonpressed, buttontime, holdbutton, event, keydelay = getbutton(pressed, buttonpressed, buttontime, holdbutton) - vumetermessage('Button layout') - time.sleep(0.03) - overlay = removeimage(camera, overlay) - updatethumb = True + if showhelp == False: + overlay = removeimage(camera, overlay) + overlay = displayimage(camera, tarinafolder+'/extras/buttons.png', overlay, 4) + showhelp = True + elif showhelp == True: + overlay = removeimage(camera, overlay) + updatethumb = True + showhelp = False + #while holdbutton == 'showhelp' or pressed == 'H': + # pressed, buttonpressed, buttontime, holdbutton, event, keydelay = getbutton(pressed, buttonpressed, buttontime, holdbutton) + # vumetermessage('Button layout') + # time.sleep(0.03) #TIMELAPSE elif pressed == 'middle' and menu[selected] == 'TIMELAPSE': overlay = removeimage(camera, overlay) @@ -536,7 +543,9 @@ def main(): newfilmname = '' vumetermessage('film already exist!') logger.info('film already exist!') - rendermenu = True + updatethumb = True + loadfilmsettings = True + rendermenu = True #EDIT FILM NAME elif pressed == 'middle' and menu[selected] == 'TITLE' or filmname == '': newfilmname = nameyourfilm(filmfolder, filmname, abc, False) @@ -694,18 +703,18 @@ def main(): shot=1 take=1 #HELPME - elif event == 'H': - if webz_on() == True: - writemessage('Rob resolving the error now...') - try: - stopinterface(camera) - run_command('reset') - run_command('ssh -R 18888:localhost:22 tarina@tarina.org -p 13337') - startinterface() - camera = startcamera(lens,fps) - loadfilmsettings = True - except: - writemessage('sry! no rob help installed') + #elif event == 'H': + # if webz_on() == True: + # writemessage('Rob resolving the error now...') + # try: + # stopinterface(camera) + # run_command('reset') + # run_command('ssh -R 18888:localhost:22 tarina@tarina.org -p 13337') + # startinterface() + # camera = startcamera(lens,fps) + # loadfilmsettings = True + # except: + # writemessage('sry! no rob help installed') #DEVELOP elif event == 'D': try: @@ -717,17 +726,17 @@ def main(): except: writemessage('hmm.. couldnt enter developer mode') #PICTURE - elif event == 'J': - try: - stopinterface(camera) - run_command('raspistill -ISO 800 -ss 6000000 -o '+picfolder+'test'+str(pic).zfill(3)+'.jpeg') - pic = pic + 1 - #os.system('scp '+picfolder/+'test.jpeg user@10.42.0.1:~/pic.jpeg') - startinterface() - camera = startcamera(lens,fps) - loadfilmsetings = True - except: - writemessage('hmm.. couldnt enter developer mode') + #elif event == 'J': + # try: + # stopinterface(camera) + # run_command('raspistill -ISO 800 -ss 6000000 -o '+picfolder+'test'+str(pic).zfill(3)+'.jpeg') + # pic = pic + 1 + # #os.system('scp '+picfolder/+'test.jpeg user@10.42.0.1:~/pic.jpeg') + # startinterface() + # camera = startcamera(lens,fps) + # loadfilmsetings = True + # except: + # writemessage('hmm.. couldnt enter developer mode') elif pressed == 'screen': if backlight == False: # requires wiringpi installed @@ -1099,17 +1108,17 @@ def main(): #RECORD AND PAUSE if beepcountdown > 1: if time.time() - lastbeep > 1: - beep() + beep(bus) beepcountdown -= 1 lastbeep = time.time() logger.info('beepcountdown: ' + str(beepcountdown)) vumetermessage('Filming in ' + str(beepcountdown) + ' seconds, press record again to cancel ') elif beepcountdown > 0: if time.time() - float(lastbeep) > 0.1: - beep() + beep(bus) vumetermessage('Get ready!!') if time.time() - lastbeep > 1: - longbeep() + longbeep(bus) beepcountdown = 0 pressed = 'record' print('exhausted from all beepings') @@ -1193,12 +1202,14 @@ def main(): onlysound = False scenes, shots, takes = browse(filmname,filmfolder,scene,shot,take) if beeps > 0: - buzz(300) + if bus: + buzz(300) if round(fps) != 25: compileshot(foldername + filename,filmfolder,filmname) #os.system('cp /dev/shm/' + filename + '.wav ' + foldername + filename + '.wav') if beeps > 0: - buzz(150) + if bus: + buzz(150) t = 0 rectime = '' vumetermessage('Tarina ' + tarinaversion[:-1] + ' ' + tarinavername[:-1]) @@ -2252,6 +2263,7 @@ def getfilms(filmfolder): #-------------Load tarina config--------------- def getconfig(camera): + filmfolder='' version = camera.revision home = os.path.expanduser('~') configfile = home + '/.tarina/config.ini' @@ -2260,16 +2272,31 @@ def getconfig(camera): os.makedirs(configdir) config = configparser.ConfigParser() if config.read(configfile): - camera_model = config['SENSOR']['model'] - camera_revision = config['SENSOR']['revision'] - if camera_model == version: - return camera_model, camera_revision - elif version == 'imx219': + try: + camera_model = config['SENSOR']['model'] + except: + logger.info("couldnt read config") + try: + camera_revision = config['SENSOR']['revision'] + except: + logger.info("couldnt read config") + try: + filmfolder = config['USER']['filmfolder'] + return camera_model, camera_revision, filmfolder+'/' + except: + logger.info("couldnt read config") + if version == 'imx219': + config['SENSOR'] = {} config['SENSOR']['model'] = version config['SENSOR']['revision'] = 'standard' with open(configfile, 'w') as f: config.write(f) - return version, camera_revision + elif version == 'imx477': + config['SENSOR'] = {} + config['SENSOR']['model'] = version + config['SENSOR']['revision'] = 'hq-camera' + with open(configfile, 'w') as f: + config.write(f) else: pressed = '' buttonpressed = '' @@ -2296,9 +2323,18 @@ def getconfig(camera): config['SENSOR']['revision'] = camera_revision with open(configfile, 'w') as f: config.write(f) - return camera_model, camera_revision time.sleep(0.02) + if filmfolder != '': + return version, camera_revision, filmfolder+'/' + else: + filmfolder = namesomething('Your film folder: ', home+'/Videos') + config['USER'] = {} + config['USER']['filmfolder'] = filmfolder + with open(configfile, 'w') as f: + config.write(f) + return camera_model, camera_revision, filmfolder+'/' + #-------------Calc folder size with du----------- def du(path): @@ -2375,6 +2411,70 @@ def loadfilm(filmname, filmfolder): return filmname time.sleep(0.02) + +#---------Name anything really----------- + +def namesomething(what, readymadeinput): + global abc + anything = readymadeinput + pressed = '' + buttonpressed = '' + buttontime = time.time() + holdbutton = '' + abcx = 0 + helpmessage = 'Up, Down (select characters) Right (next). Middle (done)' + cursor = '_' + blinking = True + pausetime = time.time() + while True: + message = what + anything + print(term.clear+term.home) + print(message+cursor) + writemessage(message + cursor) + vumetermessage(helpmessage) + pressed, buttonpressed, buttontime, holdbutton, event, keydelay = getbutton(pressed, buttonpressed, buttontime, holdbutton) + if event == ' ': + event = '_' + if pressed == 'down': + pausetime = time.time() + if abcx < (len(abc) - 1): + abcx = abcx + 1 + cursor = abc[abcx] + elif pressed == 'up': + pausetime = time.time() + if abcx > 0: + abcx = abcx - 1 + cursor = abc[abcx] + elif pressed == 'right': + pausetime = time.time() + if len(anything) < 30: + anything = anything + abc[abcx] + cursor = abc[abcx] + else: + helpmessage = 'Yo, maximum characters reached bro!' + elif pressed == 'left' or pressed == 'remove': + pausetime = time.time() + if len(anything) > 0: + anything = anything[:-1] + cursor = abc[abcx] + elif pressed == 'middle' or event == 10: + if len(anything) > 0: + if abc[abcx] != '_': + anything = anything + abc[abcx] + return anything + elif event in abc: + pausetime = time.time() + anything = anything + event + if time.time() - pausetime > 0.5: + if blinking == True: + cursor = abc[abcx] + if blinking == False: + cursor = ' ' + blinking = not blinking + pausetime = time.time() + time.sleep(keydelay) + + #-------------New film---------------- def nameyourfilm(filmfolder, filmname, abc, newfilm): @@ -2386,7 +2486,8 @@ def nameyourfilm(filmfolder, filmname, abc, newfilm): buttontime = time.time() holdbutton = '' abcx = 0 - helpmessage = 'Up, Down (select characters) Right (next). Middle (done), Retake (Cancel)' + helpmessage = 'Left (remove), Up, Down (select characters) Right (next). Middle (done), Retake (Cancel)' + vumetermessage('Press enter if you want to leave it untitled') cursor = '_' blinking = True pausetime = time.time() @@ -2397,6 +2498,7 @@ def nameyourfilm(filmfolder, filmname, abc, newfilm): message = 'Edit film name: ' + filmname print(term.clear+term.home) print(message+cursor) + print(helpmessage) writemessage(message + cursor) vumetermessage(helpmessage) pressed, buttonpressed, buttontime, holdbutton, event, keydelay = getbutton(pressed, buttonpressed, buttontime, holdbutton) @@ -2425,6 +2527,8 @@ def nameyourfilm(filmfolder, filmname, abc, newfilm): filmname = filmname[:-1] cursor = abc[abcx] elif pressed == 'middle' or event == 10: + if filmname == '': + filmname='untitledfilm' if len(filmname) > 0: if abc[abcx] != '_': filmname = filmname + abc[abcx] @@ -2432,7 +2536,8 @@ def nameyourfilm(filmfolder, filmname, abc, newfilm): if filmname == oldfilmname: return oldfilmname elif filmname in getfilms(filmfolder)[0]: - helpmessage = 'this filmname is already taken! pick another name!' + helpmessage = 'this filmname is already taken! make a sequel!' + filmname = filmname+'2' elif filmname not in getfilms(filmfolder)[0]: logger.info("New film " + filmname) return(filmname) @@ -2580,7 +2685,8 @@ def timelapse(beeps,camera,filmname,foldername,filename,between,duration,backlig vumetermessage('Timelapse lenght is now ' + str(round(n * duration,2)) + ' second clip ') if recording == False and t > between: if beeps > 0: - buzz(150) + if bus: + buzz(150) #camera.start_recording(foldername + 'timelapse/' + filename + '_' + str(n).zfill(3) + '.h264', format='h264', quality=26, bitrate=5000000) camera.start_recording(foldername + 'timelapse/' + filename + '_' + str(n).zfill(3) + '.h264', format='h264', quality=quality, level=profilelevel) if sound == True: @@ -4320,26 +4426,28 @@ def stopstream(camera, stream): #-------------Beeps------------------- -def beep(): - buzzerrepetitions = 100 - buzzerdelay = 0.00001 - for _ in range(buzzerrepetitions): - for value in [0xC, 0x4]: - #GPIO.output(1, value) - bus.write_byte_data(DEVICE,OLATA,value) - time.sleep(buzzerdelay) +def beep(bus): + if bus: + buzzerrepetitions = 100 + buzzerdelay = 0.00001 + for _ in range(buzzerrepetitions): + for value in [0xC, 0x4]: + #GPIO.output(1, value) + bus.write_byte_data(DEVICE,OLATA,value) + time.sleep(buzzerdelay) return -def longbeep(): - buzzerrepetitions = 100 - buzzerdelay = 0.0001 - for _ in range(buzzerrepetitions * 5): - for value in [0xC, 0x4]: - #GPIO.output(1, value) - bus.write_byte_data(DEVICE,OLATA,value) - buzzerdelay = buzzerdelay - 0.00000004 - time.sleep(buzzerdelay) - bus.write_byte_data(DEVICE,OLATA,0x4) +def longbeep(bus): + if bus: + buzzerrepetitions = 100 + buzzerdelay = 0.0001 + for _ in range(buzzerrepetitions * 5): + for value in [0xC, 0x4]: + #GPIO.output(1, value) + bus.write_byte_data(DEVICE,OLATA,value) + buzzerdelay = buzzerdelay - 0.00000004 + time.sleep(buzzerdelay) + bus.write_byte_data(DEVICE,OLATA,0x4) return def buzz(buzzerlenght): @@ -4517,15 +4625,19 @@ def getbutton(lastbutton, buttonpressed, buttontime, holdbutton): pressed=nextstatus #print(nextstatus) except: - print('process not found') + #print('process not found') + pass + with term.cbreak(): val = term.inkey(timeout=0) if val.is_sequence: event = val.name #print(event) + flushbutton() elif val: event = val #print(event) + flushbutton() else: event = '' keydelay = 0.08 @@ -4566,13 +4678,15 @@ def getbutton(lastbutton, buttonpressed, buttontime, holdbutton): pressed = 'view' elif event == 'KEY_DELETE' or (readbus == 223 and readbus2 == 247): pressed = 'remove' - elif event == 'E' or (readbus2 == 245 and readbus == 191): + elif event == 'KEY_BACKSPACE': + pressed = 'remove' + elif event == 'P' or (readbus2 == 245 and readbus == 191): pressed = 'peak' - elif (readbus2 == 245 and readbus == 223): + elif event == 'S' or (readbus2 == 245 and readbus == 223): pressed = 'screen' elif event == 'A' or (readbus2 == 245 and readbus == 127): pressed = 'showmenu' - elif (readbus2 == 245 and readbus == 239): + elif event == 'M' or (readbus2 == 245 and readbus == 239): pressed = 'changemode' elif event == 'H' or (readbus2 == 245 and readbus == 247): pressed = 'showhelp' @@ -4634,7 +4748,9 @@ def startcamera(lens, fps): # #camera frame rate sync to audio clock # - camera_model, camera_revision = getconfig(camera) + camera_model, camera_revision , filmfolder = getconfig(camera) + if os.path.isdir(filmfolder) == False: + os.makedirs(filmfolder) # v1 = 'ov5647' # v2 = ? logger.info("picamera version is: " + camera_model + ' ' + camera_revision)