Commit a97aecd2 authored by a1ex's avatar a1ex
Browse files

User guide integrated into ML menu, with context-sensitive help.

--HG--
branch : unified
parent 1a8d16e39134
......@@ -38,7 +38,9 @@ ML_OBJS-y = \
chdk-gui_draw.o \
movtweaks.o \
tweaks.o \
my_memset.o
my_memset.o \
menuhelp.o \
menuindex.o \
#include generic rules and definitions
......
......@@ -34,7 +34,9 @@ ML_OBJS-y = \
chdk-gui_draw.o \
movtweaks.o \
tweaks.o \
my_memset.o
my_memset.o \
menuhelp.o \
menuindex.o \
#include generic rules and definitions
......
......@@ -35,7 +35,9 @@ ML_OBJS-y = \
chdk-gui_draw.o \
movtweaks.o \
tweaks.o \
my_memset.o
my_memset.o \
menuhelp.o \
menuindex.o \
#include generic rules and definitions
......
......@@ -29,6 +29,7 @@ HOST_CFLAGS=-g -O3 -W -Wall
#~ VERSION=0.2.0.rc1.550d.fw109
BUILDVER=$(shell whoami)
VERSION:=$(shell LC_TIME=EN date +'%Y%b%d').$(MODEL).fw$(FW_VERSION).$(BUILDVER)
CONFIG_PYMITE = n
CONFIG_RELOC = n
......@@ -82,21 +83,17 @@ ptpinstall: autoexec.bin
cat ptpcam.txt | ptpcam --chdk
diff autoexec.bin autoexec.test
%.pdf:
cp doc/*.pdf .
# zip.txt must be the first item on the list!
magiclantern-$(VERSION).zip: \
zip.txt \
magiclantern.fir \
autoexec.bin \
README \
INSTALL.pdf \
UserGuide.pdf \
UserGuide-diff.pdf \
doc/INSTALL.pdf \
doc/UserGuide.pdf \
make_bootable.sh\
logo.bmp\
cropmks/* \
doc/cam/* \
-rm $@
chmod -x autoexec.bin
......@@ -144,8 +141,6 @@ AFLAGS=\
%.bin: %
$(call build,OBJCOPY,$(OBJCOPY) -O binary $< $@)
VERSION:=$(shell LC_TIME=EN date +'%Y%b%d').$(MODEL).fw$(FW_VERSION).$(BUILDVER)
zip: magiclantern-$(VERSION).zip
......
......@@ -7,11 +7,8 @@
If you are not comfortable with this, stop reading and delete the
software before you are tempted to try running it on your camera.
Especially with this early release for the Canon 60D, there is no
guarantee that things will work.
Please see the LICENSE file for additional terms that cover
distribution of this software.
Please read the user guide carefully before installing this software.
To repeat this important point:
......
......@@ -986,9 +986,9 @@ audio_monitoring_toggle( void * priv)
static struct menu_entry audio_menus[] = {
{
.name = "Audio Meters",
.priv = &cfg_draw_meters,
.select = menu_binary_toggle,
.select_reverse = menu_ternary_toggle_reverse,
.display = audio_meter_display,
.help = "Meters show average value and peaks, from -40 dB to 0 dB."
},
......@@ -1000,6 +1000,7 @@ static struct menu_entry audio_menus[] = {
},
#endif
{
.name = "Analog Gain (dB)",
.priv = &mgain,
.select = audio_mgain_toggle,
.select_reverse = audio_mgain_toggle_reverse,
......@@ -1007,6 +1008,7 @@ static struct menu_entry audio_menus[] = {
.help = "Gain applied to both inputs in analog domain (preferred)."
},
{
.name = "L-DigitalGain",
.priv = &dgain_l,
.select = audio_dgain_toggle,
.select_reverse = audio_dgain_toggle_reverse,
......@@ -1014,6 +1016,7 @@ static struct menu_entry audio_menus[] = {
.help = "Digital gain applied only to the LEFT channel."
},
{
.name = "L-DigitalGain", // hack
.priv = &dgain_r,
.select = audio_dgain_toggle,
.select_reverse = audio_dgain_toggle_reverse,
......@@ -1021,6 +1024,7 @@ static struct menu_entry audio_menus[] = {
.help = "Digital gain applied only to the RIGHT channel."
},
{
.name = "AGC",
.priv = &alc_enable,
.select = audio_binary_toggle,
.display = audio_alc_display,
......@@ -1044,6 +1048,7 @@ static struct menu_entry audio_menus[] = {
},
#endif
{
.name = "Input source",
.priv = &input_choice,
.select = audio_input_toggle,
.select_reverse = audio_input_toggle_reverse,
......@@ -1056,12 +1061,14 @@ static struct menu_entry audio_menus[] = {
.display = audio_loopback_display,
},*/
{
.name = "Mic Power",
.priv = &mic_power,
.select = audio_binary_toggle,
.display = audio_micpower_display,
.help = "Needed for int. and some other mics, but lowers impedance."
},
{
.name = "Output volume (dB)",
.priv = &lovl,
.select = audio_3bit_toggle,
.select_reverse = audio_3bit_toggle_reverse,
......@@ -1069,6 +1076,7 @@ static struct menu_entry audio_menus[] = {
.help = "Output volume for audio monitoring (headphones only)."
},
{
.name = "Monitoring-USB",
.priv = &audio_monitoring,
.select = audio_monitoring_toggle,
.display = audio_monitoring_display,
......
......@@ -313,6 +313,7 @@ void show_mvr_buffer_status()
static struct menu_entry mov_menus[] = {
{
.name = "Bit Rate",
.priv = &bitrate_mode,
.display = bitrate_print,
.select = bitrate_toggle_mode,
......@@ -321,12 +322,14 @@ static struct menu_entry mov_menus[] = {
.help = "H.264 bitrate. Use with care! [Q/PLAY]: change value."
},
{
.name = "BuffWarnLevel",
.select = buffer_warning_level_toggle_forward,
.select_reverse = buffer_warning_level_toggle_reverse,
.display = buffer_warning_level_display,
.help = "ML will pause CPU-intensive graphics if buffer gets full."
},
{
.name = "Time Indicator",
.priv = &time_indicator,
.select = menu_quaternary_toggle,
.select_reverse = menu_quaternary_toggle_reverse,
......
......@@ -503,12 +503,14 @@ spy_print(
struct menu_entry debug_menus[] = {
{
.name = "Draw palette",
.priv = "Draw palette",
.select = (void(*)(void*))bmp_draw_palette,
.display = menu_print,
.help = "Display a test pattern to see the color palette."
},
{
.name = "Screenshot (10 s)",
.priv = "Screenshot (10 s)",
.select = screenshot_start,
.select_auto = take_screenshot,
......@@ -516,6 +518,7 @@ struct menu_entry debug_menus[] = {
.help = "Take a screenshot after 10 seconds [SET] or right now [Q]."
},
{
.name = "Debug logging",
.priv = &dm_enable,
.select = dm_toggle,
.select_auto = (void*) dumpf,
......@@ -523,6 +526,7 @@ struct menu_entry debug_menus[] = {
.help = "While ON, debug messages are saved. [Q] => LOGnnn.LOG."
},
{
.name = "Spy prop/evt/mem",
.select = draw_prop_select,
.select_reverse = toggle_draw_event,
.select_auto = mem_spy_select,
......@@ -567,18 +571,21 @@ struct menu_entry debug_menus[] = {
static struct menu_entry cfg_menus[] = {
{
.name = "Config AutoSave",
.priv = &config_autosave,
.display = config_autosave_display,
.select = config_autosave_toggle,
.help = "If enabled, ML settings are saved automatically at shutdown."
},
{
.name = "Save config now",
.priv = "Save config now",
.display = menu_print,
.select = save_config,
.help = "Save ML settings to MAGIC.CFG"
},
{
.name = "Delete config file",
.priv = "Delete config file",
.display = menu_print,
.select = delete_config,
......@@ -763,6 +770,7 @@ CONFIG_INT( "debug.timed-dump", timed_dump, 0 );
CONFIG_INT( "magic.disable_bootdiskf", disable_bootdiskf, 0 );
/*
struct bmp_file_t * logo = (void*) -1;
void load_logo()
{
......@@ -783,7 +791,7 @@ void show_logo()
"...loading...\n"
);
}
}
}*/
void
debug_init_stuff( void )
......
Magic Lantern 0.2 for Canon 550D, Firmware 1.0.9
================================================
.. _magic.cfg:
......@@ -19,12 +17,3 @@ These settings can not be changed from the ML menu::
# Delay between clearing the overlay in Clear Preview mode
clear.preview.delay = 500
# Threshold for audio trigger
audio.release.level = 700
# Delay between two sub-pics in hi-res silent pic mode
silent.pic.sweepdelay = 350
# Zebra density: 0, 1 or 2
zebra.density = 2
Epilogue
--------
If you find this software useful, please help Magic Lantern development by:
* Sharing tips and tricks with ML user community;
* Reporting bugs on the issue tracker;
* Sending patches and suggesting improvements;
* Creating or improving tutorials and cropmarks;
* Keeping the wiki and this user guide up-to-date;
* Making a donation.
.. raw:: latex
\begin{flushright}
\vspace{-1.5cm}
\includegraphics[width=1.5cm]{Logo.png}
Thank you!
Magic Lantern development team
\end{flushright}
This diff is collapsed.
This diff is collapsed.
import os,sys,string
f = open("menuindex.txt").readlines()
o = open("cam/menuidx.dat", "w")
menu = open("../menuindex.c", "w")
print >> menu, """
// Auto-generated; do not edit this file.
// Edit doc/menuindex.py instead.
#include "dryos.h"
#include "version.h"
#include "bmp.h"
#include "menu.h"
#include "menuhelp.h"
struct menu_entry help_menus[] = {
{
.name = "About Magic Lantern",
.priv = 1,
.select = menu_help_go_to_page,
.display = menu_help_section_print,
},"""
print >> o, "001 About Magic Lantern"
sections = 0
#~ idx = {}
#~ idxp = {}
for l in f[1:]:
l = l.strip("\n").split(" ")
page, type, name = l[0], l[1], string.join(l[2:], " ")
page = int(page)
if type == "subsubsection": # each menu entry is a subsection
item = name.split(":")[0]
item = item.split(" and ")[0] # hacks, to be removed
item = item.split(" / ")[0]
item = item.split(" X sec")[0]
item = item.strip()
#~ idx[item] = page
#~ idxp[page] = item
print page, item
print >> o, "%03d %s" % (page, item)
if type == "section": # main sections in menu
sections += 1
item = name
print page, item
print >> o, "%03d %s" % (page, item)
print >> menu, """ {
.name = "%s",
.priv = %s,
.select = menu_help_go_to_page,
.display = menu_help_section_print,
},""" % (item, page)
if type == "end":
lastpage = page - 1
print >> o, "%03d end" % lastpage
print >> menu, """};
static void
help_menu_init( void* unused )
{
menu_add(" (i)", help_menus, COUNT(help_menus));
}
INIT_FUNC( "help_menu", help_menu_init );
int help_pages = %d;
int help_menus_num = %d;
""" % (lastpage, sections+1);
#~ print idxp
o.close()
menu.close()
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Render the user guide in BMP format (with RLE compression)
# in order to use it as a help system in the camera menu.
# Outputs: a lot of files in cam/ subdirectory
# (page-%03d.bmp for each page, and menuidx.dat)
# Author: Alex Dumitrache <broscutamaker@gmail.com>
# License: GPL
import os, re, time
import urllib
m = open("MANUAL.txt").readlines();
c = open("CONFIG.txt").readlines();
e = open("EPILOGUE.txt").readlines();
o = open("userguide.rst", "w")
print >> o, """Magic Lantern 0.2.1
==================================
"""
for l in m:
o.write(l)
for l in c:
o.write(l)
for l in e:
o.write(l)
o.close()
def sub(file, fr, to):
txt = open(file).read()
txt = re.sub(fr, to, txt);
f = open(file,"w")
f.write(txt)
f.close()
def fixwikilinks(file):
txt = open(file).read()
while 1:
m = re.search(r"\[\[([^]|]+)([^]]*)\]\]", txt, re.MULTILINE)
if not m: break
origstr = "[[" + m.groups()[0] + m.groups()[1] + "]]"
print origstr
x = m.groups()[0]
x = x.replace("_", " ")
txt = txt.replace(origstr, "`%s <http://magiclantern.wikia.com/wiki/%s>`_" % (x, urllib.quote(x)))
#~ sub("INSTALL.rst", , ")
f = open(file,"w")
f.write(txt)
f.close()
def labelhack(file): # bug in rst2latex? it forgets to place labels in tex source
txt = ""
for l in open(file).readlines():
txt += l
m = re.match(".. _(.*):", l)
if m:
label = m.groups()[0]
txt += r""".. raw:: latex
\vspace{-10mm}\subsubsection*{}\label{%s}
""" % label.lower().replace("/"," ").replace(" ", " ").replace(" ", " ").replace(" ", "-").replace(".", "-")
f = open(file,"w")
f.write(txt)
f.close()
nonewlineitems = ['Output volume', 'WBShift','Aperture','PictureStyle','Contrast','Focus delay', 'Focus A', 'Rack Focus', 'Hyperfocal', 'DOF', 'Lockup', 'ISO selection', 'Screenshot', 'Spy', 'Save config', 'Delete config', 'Movie REC', 'Movie Restart', 'Zebra when REC', 'Gain', 'AGC', 'Zoom in PLAY']
def should_add_newline(l):
for it in nonewlineitems:
if it in l:
return 0
return 1
def add_menu_items_to_contents(file):
txt = ""
for l in open(file).readlines():
m = re.match("^\*\*(.*)\*\*\ *$", l)
if m and should_add_newline(l):
txt += r"""
.. raw:: latex
\newpage
"""
txt += l
if m:
item = m.groups()[0]
txt += r"""
.. raw:: latex
\addcontentsline{toc}{subsubsection}{%s}
""" % item.replace("**","").replace("_", r"\_")
f = open(file,"w")
f.write(txt)
f.close()
os.system("pandoc -f rst -t latex -o credits.tex CREDITS.txt")
fixwikilinks("userguide.rst")
labelhack("userguide.rst")
add_menu_items_to_contents("userguide.rst")
#os.system("pandoc -f rst -t latex -o userguide-body.tex userguide.rst")
os.system("rst2latex.py userguide.rst --output-encoding=utf8 --template=ug-template-cam.tex --table-style booktabs > UserGuide-cam.tex")
os.system(r"sed -i -e 's/\\{\\{clr\\}\\}//g' UserGuide-cam.tex")
os.system(r"sed -i -e 's/⬜/$\\square$/g' UserGuide-cam.tex")
os.system(r"sed -i -e 's/⨂/$\\otimes$/g' UserGuide-cam.tex")
os.system(r"sed -i -e 's/⨀/$\\odot$/g' UserGuide-cam.tex")
os.system(r"sed -i -e 's/〰/$\\wave$/g' UserGuide-cam.tex")
os.system(r"sed -i -e 's/↷/$\\curvearrowright$/g' UserGuide-cam.tex")
os.system(r"sed -i -e 's/↶/$\\curvearrowleft$/g' UserGuide-cam.tex")
os.system(r"sed -i -e 's/⤿/$\\rcurvearrowup$/g' UserGuide-cam.tex")
os.system(r"sed -i -e 's/⤸/$\\lcurvearrowdown$/g' UserGuide-cam.tex")
os.system(r"sed -i -e 's/<->/$\\leftrightarrow$/g' UserGuide-cam.tex")
os.system(r"sed -i -e 's/->/$\\rightarrow$/g' UserGuide-cam.tex")
os.system(r"sed -i -e 's/kOhm/$\\textrm k\\Omega$/g' UserGuide-cam.tex")
#~ os.system(r"sed -i -e 's/\\addcontentsline{toc}{section}{Features}//g' UserGuide-cam.tex")
os.system("lualatex UserGuide-cam.tex")
#~ os.system("lualatex UserGuide-cam.tex")
#os.system(r"sed -i 's/\\{\\{clr\\}\\}//g' userguide-body.tex")
#os.system("pdflatex UserGuide-cam.tex")
#os.system("pdflatex UserGuide-cam.tex")
#~ raise SystemExit # from this point it's very slow
os.system("rm cam/*")
os.system("mkdir cam")
os.system("python menuindex.py")
print 'pdf to png...'
os.system("pdftoppm -r 152.2 -png UserGuide-cam.pdf cam/page")
# from remap.py
from pylab import *
import Image
def read_ch(f):
M = zeros([16,16])[:,:,1]
im = imread(f)
h,w = im.shape
lw = w/16
lh = h/16
for i in range(16):
for j in range(16):
ia = i*lh+5
ib = (i+1)*lh-5
ja = i*lw+5
jb = (i+1)*lw-5
M[i,j] = mean(im[ia:ib,ja:jb])
return M
def read_rgb(f):
M = zeros([16,16,3])
im = flipud(imread(f))
h,w,c = im.shape
assert c==3
lw = w/16
lh = h/16
for c in range(3):
for i in range(16):
for j in range(16):
ia = i*lh+5
ib = (i+1)*lh-5
ja = j*lw+5
jb = (j+1)*lw-5
M[i,j,c] = mean(im[ia:ib,ja:jb,c])
return M
rgb2ind_cache = {}
def rgb2ind(rgb, mf):
trgb = tuple(rgb)
if trgb in rgb2ind_cache: return rgb2ind_cache[trgb]
dif = mf - rgb*ones((256,1))
dif = (dif**2).sum(1)
dif[0] = 1e10
dif[3] = 1e10
dif[0x14] = 1e10
ind = argmin(dif[:80]) # only first 80 entries are safe
rgb2ind_cache[trgb] = ind
return ind
def remap_rgb(im,M):
h,w,c = im.shape
assert c==3
newim = zeros((h,w))
mf = M.flatten().reshape((256,3))
for i in range(h):
for j in range(w):
rgb = im[i,j]
ind = rgb2ind(rgb, mf)
newim[i,j] = ind
return newim
def save_img(im,M,file):
ix = Image.fromarray(flipud(im.astype(uint8)))
mf = M.flatten().reshape((256,3))
ix.putpalette(mf.flatten().astype(uint8))
ix.save(file)
M = read_rgb("../vram/Palette.jpg")
for i in range(3):
print M[:,:,i].astype(uint8)
def convert_page(k):
png = "cam/page-%03d.png" % k
if not os.path.isfile(png): png = "cam/page-%02d.png" % k
if not os.path.isfile(png):
print "done?"
raise SystemExit
bmp = "cam/page-%03d.bmp" % k
print "remapping %s..." % png
im = flipud(imread(png))
if im.max() <= 1: im *= 255
imr = remap_rgb(im,M)
#print imr
save_img(imr,M,bmp)
os.system("ruby ../convertrle.rb %s" % bmp)
os.system("rm %s" % bmp)
os.system("rm %s" % png)
os.system("mv %s.rle %s" % (bmp, bmp))
for i in range(1,1000):
convert_page(i)
......@@ -11,8 +11,9 @@ import urllib
os.system("montage ../cropmks/16x9_blk.bmp ../cropmks/hd_ta.bmp ../cropmks/CineSco2.bmp ../cropmks/fish8r.bmp -tile 4x1 -geometry 300x200+5+5 Cropmarks550D.png")
f = open("FEATURES.txt").readlines()[3:];
c = open("CONFIG.txt").readlines()[2:];
f = open("FEATURES.txt").readlines();