% one of mik's old latex files...

% Reference card for MegaSquirtAVR
% config-section is auto generated by perl script


\documentclass[11pt,a4paper]{scrartcl}
\usepackage[american]{babel} 

\usepackage[latin1]{inputenc}
\usepackage{url}
\usepackage{scrtime}

\title{VEMS GenBoard}
%\date{\today~@~\thistime} 
\date{\today} 
\author{{\url{www.vems-group.org}}}

\setcounter{secnumdepth}{0} % no numbering of sections

\parindent 0pt
%  \hsize 4in
%  \vsize 10in
%  \voffset -.7in


%\DeclareFontShape{OT1}{cmtt}{bx}{n}
%{<5><6><7><8>cmbtt8%
%<9>cmbtt9%
%<10><10.95>cmbtt10%
%<12><14.4><17.28><20.74><24.88>cmbtt10%
%}{}


\newcommand{\key}[2]
{\leavevmode
  \hbox to \hsize{
    \vtop{
      \hsize=.75
      \hsize
      \rightskip=1em
%      \hskip
%      \keyindent
      \relax #1
    }
    \tt{#2}
    \hfil
  }
}


\begin{document}       
\maketitle

%Website:~ {\small\url{http://www.squirrelpf.com/msavr/index.php?page=MS-AVR}}


\section{Basics}

\begin{itemize}
\item Menu-mmm is the entry point in the menu, all commands start from here.
\item Commands followed by \texttt{xx} (ex. {\texttt{mttc xx}}) expects a hexadecimal
argument, most significant nibble first.
\item Pressing \texttt{m} three times (in some cases less) will return to menu-mmm.
\item A command that expects an argument can be cancelled by pressing ESC (ex. {\texttt{mttc ESC}}).
\item When a command \textit{sends} something, the \textsc{GenBoard} sends data via. rs232 to the PC.
\end{itemize}
\vspace{10pt}

\key{enter menu-mmm (PS2-menu are initially entered)}{Man}
\key{leave menu-mmm (MegaTune compatibility mode)}{bye}

\section{Menu-mmm {\small{(\textsc{Man / m})}}}

\key{switch runtime display left}{left arrow}
\key{switch runtime display right}{right arrow}
\key{goto tune-menu}{F3}
\key{send lcd-cache}{F11}

\section{Intermediate Tune menu {\small{(\textsc{mt})}}}

\key{fool MegaTune}{f}
\key{goto tune-menu}{t or F3}

%why do we have this menu? Why not move all the mtt-commands into mt-?

\section{Tune {\small{(\textsc{mtt / F3})}}}

\key{return to menu-zero}{m}
\key{navigate table/config}{up arrow}
\key{navigate table/config}{down arrow}
\key{navigate table/config}{left arrow}
\key{navigate table/config}{right arrow}
\key{goto position}{g xx}
\key{goto current rpm/kpa position}{p}
\key{enable rpm/kpa follow mode}{f}
\key{bookmarks to config structure}{F1-F12}
\key{increase current ve/config element}{q}
\key{decrease current ve/config element}{z}
\key{increase current ignition element}{w}
\key{decrease current ignition element}{x}
\key{modify hardware map}{h xx}
\key{modify config}{c xx}
\key{modify ve table}{j xx}
\key{modify lambdacorr table}{l xx}
\key{modify ignition table}{n xx}
\key{modify rpm table}{r xx}
\key{modify kpa table}{k xx}
\key{revert change at current position, \textit{experimental}}{DEL}
\key{display ve learn changes (diff table)}{d}
\key{show current rpm/kpa/temp bins}{b}

\section{Experiments {\small{(\textsc{mx})}}}

\key{enable autodump of runtime variables}{A}
\key{disable autodump of runtime variables}{a}
\key{send rs232 test string}{c}
\key{initialize iac}{i}
\key{send lcd-cache, \textit{deprecated}}{l}
\key{send menu\_ps2 structure}{k}
\key{send ps2 menu char}{d}
\key{send ps2 scan char}{s}
\key{simulate events with OCR0}{o xx}
\key{send rpm\_rx21 array}{v}
\key{send kpa\_rx21 array}{w}
\key{reset low/high rpm\_p counters}{t}
\key{specify wbo2 heater dc}{h xx}
\key{activate first knock channel}{q}
\key{activate second knock channel}{Q}
\key{read knock}{z}
\key{send knock structure}{Z}

\section{Lcd {\small{(\textsc{ml})}}}

\key{start address test}{a}
\key{dirty all addresses in lcd-cache}{d}
\key{send lcd-cache}{l}
\key{initialize lcd display}{i}
\key{select lcd page number}{p xx}
\key{set display parameters (do twice)}{s xx}

\section{Debug {\small{(\textsc{md})}}}

\key{disable features (see table)}{d xx}
\key{enable features (see code)}{e xx}
\hspace{1in}
\hspace*{1.5mm}\begin{tabular}{l|l} \hline
  bit & functionality \\ \hline
  0 & disable lcd\\
  1 & ... \\ \hline
\end{tabular}\\

\key{comm auto dump frequency (ff is oneshot)}{f xx}
\key{comm auto dump mask (see table)}{k xx}
\hspace*{1.5mm}\begin{tabular}{l|l} \hline
bit & functionality \\ \hline
  0 & lcd cache \\
  1 & ps2\_stat\_commbytes \\
  2 & h1 \\
  3 & h2 \\
  4 & pw2comm \\
  5 & benchstats \\
  6 & evqhistogram \\
  7 & ic3histogram \\  \hline
\end{tabular}\\

\key{force ignition advance [0.25\(^\circ\)]}{a xx}
\key{force injector pulsewidth [64 us]}{p xx}
\key{force iac position}{i xx}
\key{test ignition sequence}{n}
\key{test injection sequence}{j}
\key{hardware test, state 1}{h xx}
\key{send engine\_t structure}{r}
\key{send raw sensor readings}{s}
\key{send firmware time/date of compilation}{v}
\key{send firmware version number}{V}
\key{send 32 bytes starting from address xx}{x xx}

\section{Config {\small{(\textsc{mc})}}}

\key{enter bootloader}{b xx}
\key{change baud rate}{B xx}
\key{send config}{d}
\key{send tables}{t}
\key{send hardware serial number}{i}
\key{save all variables}{s}

%\section{Information {\small{(\textsc{mi})}}}
%move to debug instead?\\
%\key{send raw sensor readings}{r}

\section{VE autotune {\small{(\textsc{mv})}}}

\key{reset learning (discards all changes)}{r}
\key{copy learned ve table to reference ve table}{s}

\section{Simulation {\small{(\textsc{ms})}}}

\key{stim\_period [256 usec]}{p xx}
\key{stim\_tooth [bit 7:6 missing tooth, bit 5:0 tooth count]}{t xx}

\section{Config structure}
address[array length], variable name, variable comment\\
\textit{address and array length are both hexadecimal.}\\

\input{config.ltx}

\end{document}


