/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/.cproject |
---|
0,0 → 1,2435 |
<?xml version="1.0" encoding="UTF-8" standalone="no"?> |
<?fileVersion 4.0.0?> |
<cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage"> |
<storageModule moduleId="org.eclipse.cdt.core.settings"> |
<cconfiguration id="de.innot.avreclipse.configuration.app.debug.2000056965"> |
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="de.innot.avreclipse.configuration.app.debug.2000056965" moduleId="org.eclipse.cdt.core.settings" name="Debug"> |
<macros> |
<stringMacro name="MKVERSION" type="VALUE_TEXT" value="088n"/> |
</macros> |
<externalSettings/> |
<extensions> |
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/> |
<extension id="org.eclipse.cdt.core.MakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> |
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> |
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> |
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> |
</extensions> |
</storageModule> |
<storageModule moduleId="cdtBuildSystem" version="4.0.0"> |
<configuration artifactName="${ProjName}" buildArtefactType="de.innot.avreclipse.buildArtefactType.app" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug,org.eclipse.cdt.build.core.buildArtefactType=de.innot.avreclipse.buildArtefactType.app" description="" id="de.innot.avreclipse.configuration.app.debug.2000056965" name="Debug" parent="de.innot.avreclipse.configuration.app.debug"> |
<folderInfo id="de.innot.avreclipse.configuration.app.debug.2000056965." name="/" resourcePath=""> |
<toolChain id="de.innot.avreclipse.toolchain.winavr.app.debug.1236844690" name="AVR-GCC Toolchain" superClass="de.innot.avreclipse.toolchain.winavr.app.debug"> |
<option id="de.innot.avreclipse.toolchain.options.toolchain.objcopy.flash.app.debug.1198076823" name="Generate HEX file for Flash memory" superClass="de.innot.avreclipse.toolchain.options.toolchain.objcopy.flash.app.debug"/> |
<option id="de.innot.avreclipse.toolchain.options.toolchain.objcopy.eeprom.app.debug.2002583651" name="Generate HEX file for EEPROM" superClass="de.innot.avreclipse.toolchain.options.toolchain.objcopy.eeprom.app.debug"/> |
<option id="de.innot.avreclipse.toolchain.options.toolchain.objdump.app.debug.1365066380" name="Generate Extended Listing (Source + generated Assembler)" superClass="de.innot.avreclipse.toolchain.options.toolchain.objdump.app.debug"/> |
<option id="de.innot.avreclipse.toolchain.options.toolchain.size.app.debug.1548907584" name="Print Size" superClass="de.innot.avreclipse.toolchain.options.toolchain.size.app.debug"/> |
<option id="de.innot.avreclipse.toolchain.options.toolchain.avrdude.app.debug.668179531" name="AVRDude" superClass="de.innot.avreclipse.toolchain.options.toolchain.avrdude.app.debug"/> |
<targetPlatform id="de.innot.avreclipse.targetplatform.winavr.app.debug.456217481" name="AVR Cross-Target" superClass="de.innot.avreclipse.targetplatform.winavr.app.debug"/> |
<builder buildPath="${workspace_loc:/GPL_Mikrokoptertool/Debug}" id="de.innot.avreclipse.target.builder.winavr.app.debug.14002817" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="AVR GNU Make Builder" superClass="de.innot.avreclipse.target.builder.winavr.app.debug"/> |
<tool id="de.innot.avreclipse.tool.assembler.winavr.app.debug.1155822459" name="AVR Assembler" superClass="de.innot.avreclipse.tool.assembler.winavr.app.debug"> |
<option id="de.innot.avreclipse.assembler.option.debug.level.1714829156" name="Generate Debugging Info" superClass="de.innot.avreclipse.assembler.option.debug.level"/> |
<inputType id="de.innot.avreclipse.tool.assembler.input.2027459826" superClass="de.innot.avreclipse.tool.assembler.input"/> |
</tool> |
<tool id="de.innot.avreclipse.tool.compiler.winavr.app.debug.1161577200" name="AVR Compiler" superClass="de.innot.avreclipse.tool.compiler.winavr.app.debug"> |
<option id="de.innot.avreclipse.compiler.option.debug.level.932022619" name="Generate Debugging Info" superClass="de.innot.avreclipse.compiler.option.debug.level"/> |
<option id="de.innot.avreclipse.compiler.option.optimize.1406693815" name="Optimization Level" superClass="de.innot.avreclipse.compiler.option.optimize" value="de.innot.avreclipse.compiler.optimize.size" valueType="enumerated"/> |
<option id="de.innot.avreclipse.compiler.option.omitfcpu.1875189497" name="Omit F_CPU" superClass="de.innot.avreclipse.compiler.option.omitfcpu" value="false" valueType="boolean"/> |
<option id="de.innot.avreclipse.compiler.option.optimize.other.2011741999" name="Other Optimization Flags" superClass="de.innot.avreclipse.compiler.option.optimize.other" value="-mcall-prologues" valueType="string"/> |
<option id="de.innot.avreclipse.compiler.option.std.408793995" name="Language Standard" superClass="de.innot.avreclipse.compiler.option.std" value="de.innot.avreclipse.compiler.option.std.c99" valueType="enumerated"/> |
<option id="de.innot.avreclipse.compiler.option.otherflags.433698861" name="Other flags" superClass="de.innot.avreclipse.compiler.option.otherflags" value="-Wstrict-prototypes -Wformat" valueType="string"/> |
<inputType id="de.innot.avreclipse.compiler.winavr.input.667334442" name="C Source Files" superClass="de.innot.avreclipse.compiler.winavr.input"/> |
</tool> |
<tool id="de.innot.avreclipse.tool.cppcompiler.app.debug.1906599067" name="AVR C++ Compiler" superClass="de.innot.avreclipse.tool.cppcompiler.app.debug"> |
<option id="de.innot.avreclipse.cppcompiler.option.debug.level.1755945135" name="Generate Debugging Info" superClass="de.innot.avreclipse.cppcompiler.option.debug.level"/> |
<option id="de.innot.avreclipse.cppcompiler.option.optimize.28999345" name="Optimization Level" superClass="de.innot.avreclipse.cppcompiler.option.optimize"/> |
</tool> |
<tool id="de.innot.avreclipse.tool.linker.winavr.app.debug.2019441965" name="AVR C Linker" superClass="de.innot.avreclipse.tool.linker.winavr.app.debug"> |
<option id="de.innot.avreclipse.linker.option.otherlinkargs.1199235149" name="Other Arguments" superClass="de.innot.avreclipse.linker.option.otherlinkargs" value="-lm" valueType="string"/> |
<inputType id="de.innot.avreclipse.tool.linker.input.260453186" name="OBJ Files" superClass="de.innot.avreclipse.tool.linker.input"> |
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/> |
<additionalInput kind="additionalinput" paths="$(LIBS)"/> |
</inputType> |
</tool> |
<tool id="de.innot.avreclipse.tool.cpplinker.app.debug.2042927031" name="AVR C++ Linker" superClass="de.innot.avreclipse.tool.cpplinker.app.debug"/> |
<tool id="de.innot.avreclipse.tool.archiver.winavr.base.762685064" name="AVR Archiver" superClass="de.innot.avreclipse.tool.archiver.winavr.base"/> |
<tool id="de.innot.avreclipse.tool.objdump.winavr.app.debug.1107051151" name="AVR Create Extended Listing" superClass="de.innot.avreclipse.tool.objdump.winavr.app.debug"/> |
<tool id="de.innot.avreclipse.tool.objcopy.flash.winavr.app.debug.1112080996" name="AVR Create Flash image" superClass="de.innot.avreclipse.tool.objcopy.flash.winavr.app.debug"/> |
<tool id="de.innot.avreclipse.tool.objcopy.eeprom.winavr.app.debug.423591241" name="AVR Create EEPROM image" superClass="de.innot.avreclipse.tool.objcopy.eeprom.winavr.app.debug"/> |
<tool id="de.innot.avreclipse.tool.size.winavr.app.debug.563536542" name="Print Size" superClass="de.innot.avreclipse.tool.size.winavr.app.debug"/> |
<tool id="de.innot.avreclipse.tool.avrdude.app.debug.1219663509" name="AVRDude" superClass="de.innot.avreclipse.tool.avrdude.app.debug"/> |
</toolChain> |
</folderInfo> |
<sourceEntries> |
<entry excluding="lcd/lcd|osd/osd2|tracking/servo.c|parameter087.c|Resourcen|Jerome|Tracking|Release|Koptertool 3.9|Koptertool 3.2|Koptertool 1.2 644P|Koptertool 1.2|Hardware1.3 Wi232|Koptertool 1.3|Koptertool 1.2 644|Debug|Hardware 1.2 644,Wi232|DatenblÀtter|voltmeter.c|Datenblätter|font8X6.c|Wegpunkte|FC087|V0.86a|volt.c|pwm.c|touchscreen.c|Harald|Bluetooth.c|motortestI2C.c|AVRSMS_com.c|AVRSMS_api.c|AVRSMS_tools.c|AVRSMS_zip.c|Atmel|Altastation|jeti.h|Hardware|Stefan Schulze|font8x8.h|jeti.c|Fehler|settings.c|Bootloader|displ_val.c|usart1.c|Backup" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/> |
</sourceEntries> |
</configuration> |
</storageModule> |
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/> |
<storageModule moduleId="org.eclipse.cdt.core.language.mapping"/> |
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"> |
<doc-comment-owner id="org.eclipse.cdt.ui.doxygen"> |
<path value=""/> |
</doc-comment-owner> |
</storageModule> |
<storageModule moduleId="scannerConfiguration"> |
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/> |
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="makefileGenerator"> |
<runAction arguments="-E -P -v -dD" command="" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/${specs_file}"'" command="sh" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-c 'g++ -E -P -v -dD "${plugin_state_location}/specs.cpp"'" command="sh" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/specs.c"'" command="sh" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="de.innot.avreclipse.core.AVRGCCManagedMakePerProjectProfileC"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="avr-gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="de.innot.avreclipse.core.AVRGCCManagedMakePerProjectProfileCPP"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="avr-g++" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<scannerConfigBuildInfo instanceId="de.innot.avreclipse.configuration.app.release.799832959.1517645312;de.innot.avreclipse.configuration.app.release.799832959.1517645312.;de.innot.avreclipse.tool.compiler.winavr.app.release.130890171;de.innot.avreclipse.compiler.winavr.input.106986704"> |
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="de.innot.avreclipse.core.AVRGCCManagedMakePerProjectProfileC"/> |
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="makefileGenerator"> |
<runAction arguments="-E -P -v -dD" command="" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/${specs_file}"'" command="sh" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-c 'g++ -E -P -v -dD "${plugin_state_location}/specs.cpp"'" command="sh" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/specs.c"'" command="sh" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="de.innot.avreclipse.core.AVRGCCManagedMakePerProjectProfileC"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="avr-gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="de.innot.avreclipse.core.AVRGCCManagedMakePerProjectProfileCPP"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="avr-g++" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
</scannerConfigBuildInfo> |
<scannerConfigBuildInfo instanceId="de.innot.avreclipse.configuration.app.debug.2000056965;de.innot.avreclipse.configuration.app.debug.2000056965.;de.innot.avreclipse.tool.compiler.winavr.app.debug.1161577200;de.innot.avreclipse.compiler.winavr.input.667334442"> |
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="de.innot.avreclipse.core.AVRGCCManagedMakePerProjectProfileC"/> |
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="makefileGenerator"> |
<runAction arguments="-E -P -v -dD" command="" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/${specs_file}"'" command="sh" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-c 'g++ -E -P -v -dD "${plugin_state_location}/specs.cpp"'" command="sh" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/specs.c"'" command="sh" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="de.innot.avreclipse.core.AVRGCCManagedMakePerProjectProfileC"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="avr-gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="de.innot.avreclipse.core.AVRGCCManagedMakePerProjectProfileCPP"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="avr-g++" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
</scannerConfigBuildInfo> |
<scannerConfigBuildInfo instanceId="de.innot.avreclipse.configuration.app.release.799832959.623565166;de.innot.avreclipse.configuration.app.release.799832959.623565166."> |
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="de.innot.avreclipse.core.AVRGCCManagedMakePerProjectProfileC"/> |
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="makefileGenerator"> |
<runAction arguments="-E -P -v -dD" command="" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/${specs_file}"'" command="sh" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-c 'g++ -E -P -v -dD "${plugin_state_location}/specs.cpp"'" command="sh" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/specs.c"'" command="sh" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="de.innot.avreclipse.core.AVRGCCManagedMakePerProjectProfileC"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="avr-gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="de.innot.avreclipse.core.AVRGCCManagedMakePerProjectProfileCPP"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="avr-g++" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
</scannerConfigBuildInfo> |
<scannerConfigBuildInfo instanceId="de.innot.avreclipse.configuration.app.release.799832959.1517645312;de.innot.avreclipse.configuration.app.release.799832959.1517645312."> |
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="de.innot.avreclipse.core.AVRGCCManagedMakePerProjectProfileC"/> |
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="makefileGenerator"> |
<runAction arguments="-E -P -v -dD" command="" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/${specs_file}"'" command="sh" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-c 'g++ -E -P -v -dD "${plugin_state_location}/specs.cpp"'" command="sh" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/specs.c"'" command="sh" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="de.innot.avreclipse.core.AVRGCCManagedMakePerProjectProfileC"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="avr-gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="de.innot.avreclipse.core.AVRGCCManagedMakePerProjectProfileCPP"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="avr-g++" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
</scannerConfigBuildInfo> |
<scannerConfigBuildInfo instanceId="de.innot.avreclipse.configuration.app.release.799832959.623565166;de.innot.avreclipse.configuration.app.release.799832959.623565166.;de.innot.avreclipse.tool.compiler.winavr.app.release.695648390;de.innot.avreclipse.compiler.winavr.input.71411405"> |
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="de.innot.avreclipse.core.AVRGCCManagedMakePerProjectProfileC"/> |
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="makefileGenerator"> |
<runAction arguments="-E -P -v -dD" command="" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/${specs_file}"'" command="sh" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-c 'g++ -E -P -v -dD "${plugin_state_location}/specs.cpp"'" command="sh" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/specs.c"'" command="sh" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="de.innot.avreclipse.core.AVRGCCManagedMakePerProjectProfileC"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="avr-gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="de.innot.avreclipse.core.AVRGCCManagedMakePerProjectProfileCPP"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="avr-g++" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
</scannerConfigBuildInfo> |
<scannerConfigBuildInfo instanceId="de.innot.avreclipse.configuration.app.release.799832959;de.innot.avreclipse.configuration.app.release.799832959."> |
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="de.innot.avreclipse.core.AVRGCCManagedMakePerProjectProfileC"/> |
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="makefileGenerator"> |
<runAction arguments="-E -P -v -dD" command="" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/${specs_file}"'" command="sh" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-c 'g++ -E -P -v -dD "${plugin_state_location}/specs.cpp"'" command="sh" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/specs.c"'" command="sh" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="de.innot.avreclipse.core.AVRGCCManagedMakePerProjectProfileC"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="avr-gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="de.innot.avreclipse.core.AVRGCCManagedMakePerProjectProfileCPP"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="avr-g++" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
</scannerConfigBuildInfo> |
<scannerConfigBuildInfo instanceId="de.innot.avreclipse.configuration.app.release.799832959.623565166.2071059632;de.innot.avreclipse.configuration.app.release.799832959.623565166.2071059632."> |
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="de.innot.avreclipse.core.AVRGCCManagedMakePerProjectProfileC"/> |
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="makefileGenerator"> |
<runAction arguments="-E -P -v -dD" command="" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/${specs_file}"'" command="sh" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-c 'g++ -E -P -v -dD "${plugin_state_location}/specs.cpp"'" command="sh" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/specs.c"'" command="sh" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="de.innot.avreclipse.core.AVRGCCManagedMakePerProjectProfileC"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="avr-gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="de.innot.avreclipse.core.AVRGCCManagedMakePerProjectProfileCPP"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="avr-g++" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
</scannerConfigBuildInfo> |
<scannerConfigBuildInfo instanceId="de.innot.avreclipse.configuration.app.release.799832959;de.innot.avreclipse.configuration.app.release.799832959.;de.innot.avreclipse.tool.compiler.winavr.app.release.1810413415;de.innot.avreclipse.compiler.winavr.input.2125782100"> |
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="de.innot.avreclipse.core.AVRGCCManagedMakePerProjectProfileC"/> |
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="makefileGenerator"> |
<runAction arguments="-E -P -v -dD" command="" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/${specs_file}"'" command="sh" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-c 'g++ -E -P -v -dD "${plugin_state_location}/specs.cpp"'" command="sh" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/specs.c"'" command="sh" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="de.innot.avreclipse.core.AVRGCCManagedMakePerProjectProfileC"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="avr-gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="de.innot.avreclipse.core.AVRGCCManagedMakePerProjectProfileCPP"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="avr-g++" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
</scannerConfigBuildInfo> |
<scannerConfigBuildInfo instanceId="de.innot.avreclipse.configuration.app.release.799832959.623565166.2071059632;de.innot.avreclipse.configuration.app.release.799832959.623565166.2071059632.;de.innot.avreclipse.tool.compiler.winavr.app.release.1087602969;de.innot.avreclipse.compiler.winavr.input.1885366176"> |
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="de.innot.avreclipse.core.AVRGCCManagedMakePerProjectProfileC"/> |
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="makefileGenerator"> |
<runAction arguments="-E -P -v -dD" command="" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/${specs_file}"'" command="sh" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-c 'g++ -E -P -v -dD "${plugin_state_location}/specs.cpp"'" command="sh" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/specs.c"'" command="sh" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="de.innot.avreclipse.core.AVRGCCManagedMakePerProjectProfileC"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="avr-gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="de.innot.avreclipse.core.AVRGCCManagedMakePerProjectProfileCPP"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="avr-g++" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
</scannerConfigBuildInfo> |
<scannerConfigBuildInfo instanceId="de.innot.avreclipse.configuration.app.debug.2000056965;de.innot.avreclipse.configuration.app.debug.2000056965."> |
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="de.innot.avreclipse.core.AVRGCCManagedMakePerProjectProfileC"/> |
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="makefileGenerator"> |
<runAction arguments="-E -P -v -dD" command="" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/${specs_file}"'" command="sh" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-c 'g++ -E -P -v -dD "${plugin_state_location}/specs.cpp"'" command="sh" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/specs.c"'" command="sh" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="de.innot.avreclipse.core.AVRGCCManagedMakePerProjectProfileC"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="avr-gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="de.innot.avreclipse.core.AVRGCCManagedMakePerProjectProfileCPP"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="avr-g++" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
</scannerConfigBuildInfo> |
</storageModule> |
</cconfiguration> |
<cconfiguration id="de.innot.avreclipse.configuration.app.release.799832959.623565166.2071059632"> |
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="de.innot.avreclipse.configuration.app.release.799832959.623565166.2071059632" moduleId="org.eclipse.cdt.core.settings" name="Koptertool 3.9"> |
<macros> |
<stringMacro name="HWVERSION" type="VALUE_TEXT" value="#define HWVERSION3_9"/> |
<stringMacro name="MKVERSION" type="VALUE_TEXT" value="088n"/> |
<stringMacro name="BuildArtifactFileBaseName" type="VALUE_TEXT" value="${ProjName}"/> |
<stringMacro name="Softwareversion" type="VALUE_TEXT" value="3.6.5g"/> |
<stringMacro name="MCU" type="VALUE_TEXT" value="atmega1284p"/> |
<stringMacro name="AVRTARGETMCU" type="VALUE_TEXT" value="atmega1284p"/> |
<stringMacro name="testvariable" type="VALUE_TEXT" value="1"/> |
</macros> |
<externalSettings/> |
<extensions> |
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/> |
<extension id="org.eclipse.cdt.core.MakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> |
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> |
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> |
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> |
</extensions> |
</storageModule> |
<storageModule moduleId="cdtBuildSystem" version="4.0.0"> |
<configuration artifactName="${ProjName}" buildArtefactType="de.innot.avreclipse.buildArtefactType.app" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.release,org.eclipse.cdt.build.core.buildArtefactType=de.innot.avreclipse.buildArtefactType.app" description="88n" id="de.innot.avreclipse.configuration.app.release.799832959.623565166.2071059632" name="Koptertool 3.9" parent="de.innot.avreclipse.configuration.app.release"> |
<folderInfo id="de.innot.avreclipse.configuration.app.release.799832959.623565166.2071059632." name="/" resourcePath=""> |
<toolChain id="de.innot.avreclipse.toolchain.winavr.app.release.1606310366" name="AVR-GCC Toolchain" resourceTypeBasedDiscovery="true" superClass="de.innot.avreclipse.toolchain.winavr.app.release"> |
<option id="de.innot.avreclipse.toolchain.options.toolchain.objcopy.flash.app.release.1069287281" name="Generate HEX file for Flash memory" superClass="de.innot.avreclipse.toolchain.options.toolchain.objcopy.flash.app.release"/> |
<option id="de.innot.avreclipse.toolchain.options.toolchain.objcopy.eeprom.app.release.1395198777" name="Generate HEX file for EEPROM" superClass="de.innot.avreclipse.toolchain.options.toolchain.objcopy.eeprom.app.release"/> |
<option id="de.innot.avreclipse.toolchain.options.toolchain.objdump.app.release.1943135107" name="Generate Extended Listing (Source + generated Assembler)" superClass="de.innot.avreclipse.toolchain.options.toolchain.objdump.app.release"/> |
<option id="de.innot.avreclipse.toolchain.options.toolchain.size.app.release.2109904530" name="Print Size" superClass="de.innot.avreclipse.toolchain.options.toolchain.size.app.release"/> |
<option id="de.innot.avreclipse.toolchain.options.toolchain.avrdude.app.release.1992664981" name="AVRDude" superClass="de.innot.avreclipse.toolchain.options.toolchain.avrdude.app.release"/> |
<targetPlatform id="de.innot.avreclipse.targetplatform.winavr.app.release.1528737441" name="AVR Cross-Target" superClass="de.innot.avreclipse.targetplatform.winavr.app.release"/> |
<builder buildPath="${workspace_loc:/GPL_Mikrokoptertool/Release}" id="de.innot.avreclipse.target.builder.winavr.app.release.1862080332" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="AVR GNU Make Builder" superClass="de.innot.avreclipse.target.builder.winavr.app.release"/> |
<tool id="de.innot.avreclipse.tool.assembler.winavr.app.release.1852553503" name="AVR Assembler" superClass="de.innot.avreclipse.tool.assembler.winavr.app.release"> |
<option id="de.innot.avreclipse.assembler.option.debug.level.1242179784" name="Generate Debugging Info" superClass="de.innot.avreclipse.assembler.option.debug.level" value="de.innot.avreclipse.assembler.option.debug.level.g2" valueType="enumerated"/> |
<option id="de.innot.avreclipse.asm.option.warnings.nowarn.1608753415" name="Suppress warnings (-W)" superClass="de.innot.avreclipse.asm.option.warnings.nowarn" value="false" valueType="boolean"/> |
<inputType id="de.innot.avreclipse.tool.assembler.input.396233498" superClass="de.innot.avreclipse.tool.assembler.input"/> |
</tool> |
<tool id="de.innot.avreclipse.tool.compiler.winavr.app.release.1087602969" name="AVR Compiler" superClass="de.innot.avreclipse.tool.compiler.winavr.app.release"> |
<option id="de.innot.avreclipse.compiler.option.debug.level.2016051807" name="Generate Debugging Info" superClass="de.innot.avreclipse.compiler.option.debug.level" value="de.innot.avreclipse.compiler.option.debug.level.g1" valueType="enumerated"/> |
<option id="de.innot.avreclipse.compiler.option.optimize.1652449165" name="Optimization Level" superClass="de.innot.avreclipse.compiler.option.optimize" value="de.innot.avreclipse.compiler.optimize.size" valueType="enumerated"/> |
<option id="de.innot.avreclipse.compiler.option.omitfcpu.232644227" name="Omit F_CPU" superClass="de.innot.avreclipse.compiler.option.omitfcpu" value="false" valueType="boolean"/> |
<option id="de.innot.avreclipse.compiler.option.otherflags.87881368" name="Other flags" superClass="de.innot.avreclipse.compiler.option.otherflags" value="-Wstrict-prototypes -Wformat" valueType="string"/> |
<option id="de.innot.avreclipse.compiler.option.std.1420800047" name="Language Standard" superClass="de.innot.avreclipse.compiler.option.std" value="de.innot.avreclipse.compiler.option.std.gnu99" valueType="enumerated"/> |
<option id="de.innot.avreclipse.compiler.option.def.174580993" name="Define Syms (-D)" superClass="de.innot.avreclipse.compiler.option.def" valueType="definedSymbols"> |
<listOptionValue builtIn="false" value="__AVR_ATmega1284P__"/> |
</option> |
<option id="de.innot.avreclipse.compiler.option.debug.type.1335593774" name="Debug Info Format" superClass="de.innot.avreclipse.compiler.option.debug.type" value="de.innot.avreclipse.compiler.option.debug.level.stabsplus" valueType="enumerated"/> |
<option id="de.innot.avreclipse.compiler.option.optimize.other.266970312" name="Other Optimization Flags" superClass="de.innot.avreclipse.compiler.option.optimize.other" value="-mcall-prologues" valueType="string"/> |
<option id="de.innot.avreclipse.compiler.option.warnerr.796997598" name="Warnings as Errors (-Werror)" superClass="de.innot.avreclipse.compiler.option.warnerr" value="false" valueType="boolean"/> |
<inputType id="de.innot.avreclipse.compiler.winavr.input.1885366176" name="C Source Files" superClass="de.innot.avreclipse.compiler.winavr.input"/> |
</tool> |
<tool id="de.innot.avreclipse.tool.cppcompiler.app.release.1241414384" name="AVR C++ Compiler" superClass="de.innot.avreclipse.tool.cppcompiler.app.release"> |
<option id="de.innot.avreclipse.cppcompiler.option.debug.level.519795832" name="Generate Debugging Info" superClass="de.innot.avreclipse.cppcompiler.option.debug.level" value="de.innot.avreclipse.cppcompiler.option.debug.level.none" valueType="enumerated"/> |
<option id="de.innot.avreclipse.cppcompiler.option.optimize.25088117" name="Optimization Level" superClass="de.innot.avreclipse.cppcompiler.option.optimize" value="de.innot.avreclipse.cppcompiler.optimize.size" valueType="enumerated"/> |
</tool> |
<tool id="de.innot.avreclipse.tool.linker.winavr.app.release.191727013" name="AVR C Linker" superClass="de.innot.avreclipse.tool.linker.winavr.app.release"> |
<option id="de.innot.avreclipse.linker.option.libs.745778707" name="Libraries (-l)" superClass="de.innot.avreclipse.linker.option.libs" valueType="libs"> |
<listOptionValue builtIn="false" value="m"/> |
</option> |
<option id="de.innot.avreclipse.linker.option.otherlinkargs.623435598" name="Other Arguments" superClass="de.innot.avreclipse.linker.option.otherlinkargs" value="-O2" valueType="string"/> |
<option id="de.innot.avreclipse.linker.option.nosyms.299444960" name="Omit Symbols (-s)" superClass="de.innot.avreclipse.linker.option.nosyms" value="true" valueType="boolean"/> |
<option id="de.innot.avreclipse.linker.option.libpath.1529109468" name="Libraries Path (-L)" superClass="de.innot.avreclipse.linker.option.libpath"/> |
<inputType id="de.innot.avreclipse.tool.linker.input.1916909513" name="OBJ Files" superClass="de.innot.avreclipse.tool.linker.input"> |
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/> |
<additionalInput kind="additionalinput" paths="$(LIBS)"/> |
</inputType> |
</tool> |
<tool id="de.innot.avreclipse.tool.cpplinker.app.release.1777649897" name="AVR C++ Linker" superClass="de.innot.avreclipse.tool.cpplinker.app.release"/> |
<tool id="de.innot.avreclipse.tool.archiver.winavr.base.499276008" name="AVR Archiver" superClass="de.innot.avreclipse.tool.archiver.winavr.base"/> |
<tool id="de.innot.avreclipse.tool.objdump.winavr.app.release.768856626" name="AVR Create Extended Listing" superClass="de.innot.avreclipse.tool.objdump.winavr.app.release"/> |
<tool id="de.innot.avreclipse.tool.objcopy.flash.winavr.app.release.1655349728" name="AVR Create Flash image" superClass="de.innot.avreclipse.tool.objcopy.flash.winavr.app.release"/> |
<tool id="de.innot.avreclipse.tool.objcopy.eeprom.winavr.app.release.698767043" name="AVR Create EEPROM image" superClass="de.innot.avreclipse.tool.objcopy.eeprom.winavr.app.release"/> |
<tool id="de.innot.avreclipse.tool.size.winavr.app.release.506627432" name="Print Size" superClass="de.innot.avreclipse.tool.size.winavr.app.release"/> |
<tool id="de.innot.avreclipse.tool.avrdude.app.release.1974837550" name="AVRDude" superClass="de.innot.avreclipse.tool.avrdude.app.release"/> |
</toolChain> |
</folderInfo> |
<sourceEntries> |
<entry excluding="lcd/lcd|osd/osd2|tracking/servo.c|parameter087.c|Resourcen|Jerome|Tracking|Release|Koptertool 3.9|Koptertool 3.2|Koptertool 1.2 644P|Koptertool 1.2|Hardware1.3 Wi232|Koptertool 1.3|Koptertool 1.2 644|Debug|Hardware 1.2 644,Wi232|DatenblÀtter|voltmeter.c|Datenblätter|font8X6.c|Wegpunkte|FC087|V0.86a|volt.c|pwm.c|touchscreen.c|Harald|Bluetooth.c|motortestI2C.c|AVRSMS_com.c|AVRSMS_api.c|AVRSMS_tools.c|AVRSMS_zip.c|Atmel|Altastation|jeti.h|Hardware|Stefan Schulze|font8x8.h|jeti.c|Fehler|settings.c|Bootloader|displ_val.c|usart1.c|Backup" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/> |
</sourceEntries> |
</configuration> |
</storageModule> |
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/> |
<storageModule moduleId="org.eclipse.cdt.core.language.mapping"/> |
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"> |
<doc-comment-owner id="org.eclipse.cdt.ui.doxygen"> |
<path value=""/> |
</doc-comment-owner> |
</storageModule> |
<storageModule moduleId="scannerConfiguration"> |
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/> |
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="makefileGenerator"> |
<runAction arguments="-E -P -v -dD" command="" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/${specs_file}"'" command="sh" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-c 'g++ -E -P -v -dD "${plugin_state_location}/specs.cpp"'" command="sh" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/specs.c"'" command="sh" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="de.innot.avreclipse.core.AVRGCCManagedMakePerProjectProfileC"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="avr-gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="de.innot.avreclipse.core.AVRGCCManagedMakePerProjectProfileCPP"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="avr-g++" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<scannerConfigBuildInfo instanceId="de.innot.avreclipse.configuration.app.release.799832959.1517645312;de.innot.avreclipse.configuration.app.release.799832959.1517645312.;de.innot.avreclipse.tool.compiler.winavr.app.release.130890171;de.innot.avreclipse.compiler.winavr.input.106986704"> |
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="de.innot.avreclipse.core.AVRGCCManagedMakePerProjectProfileC"/> |
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="makefileGenerator"> |
<runAction arguments="-E -P -v -dD" command="" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/${specs_file}"'" command="sh" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-c 'g++ -E -P -v -dD "${plugin_state_location}/specs.cpp"'" command="sh" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/specs.c"'" command="sh" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="de.innot.avreclipse.core.AVRGCCManagedMakePerProjectProfileC"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="avr-gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="de.innot.avreclipse.core.AVRGCCManagedMakePerProjectProfileCPP"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="avr-g++" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
</scannerConfigBuildInfo> |
<scannerConfigBuildInfo instanceId="de.innot.avreclipse.configuration.app.debug.2000056965;de.innot.avreclipse.configuration.app.debug.2000056965.;de.innot.avreclipse.tool.compiler.winavr.app.debug.1161577200;de.innot.avreclipse.compiler.winavr.input.667334442"> |
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="de.innot.avreclipse.core.AVRGCCManagedMakePerProjectProfileC"/> |
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="makefileGenerator"> |
<runAction arguments="-E -P -v -dD" command="" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/${specs_file}"'" command="sh" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-c 'g++ -E -P -v -dD "${plugin_state_location}/specs.cpp"'" command="sh" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/specs.c"'" command="sh" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="de.innot.avreclipse.core.AVRGCCManagedMakePerProjectProfileC"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="avr-gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="de.innot.avreclipse.core.AVRGCCManagedMakePerProjectProfileCPP"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="avr-g++" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
</scannerConfigBuildInfo> |
<scannerConfigBuildInfo instanceId="de.innot.avreclipse.configuration.app.release.799832959.623565166;de.innot.avreclipse.configuration.app.release.799832959.623565166."> |
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="de.innot.avreclipse.core.AVRGCCManagedMakePerProjectProfileC"/> |
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="makefileGenerator"> |
<runAction arguments="-E -P -v -dD" command="" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/${specs_file}"'" command="sh" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-c 'g++ -E -P -v -dD "${plugin_state_location}/specs.cpp"'" command="sh" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/specs.c"'" command="sh" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="de.innot.avreclipse.core.AVRGCCManagedMakePerProjectProfileC"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="avr-gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="de.innot.avreclipse.core.AVRGCCManagedMakePerProjectProfileCPP"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="avr-g++" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
</scannerConfigBuildInfo> |
<scannerConfigBuildInfo instanceId="de.innot.avreclipse.configuration.app.release.799832959.1517645312;de.innot.avreclipse.configuration.app.release.799832959.1517645312."> |
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="de.innot.avreclipse.core.AVRGCCManagedMakePerProjectProfileC"/> |
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="makefileGenerator"> |
<runAction arguments="-E -P -v -dD" command="" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/${specs_file}"'" command="sh" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-c 'g++ -E -P -v -dD "${plugin_state_location}/specs.cpp"'" command="sh" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/specs.c"'" command="sh" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="de.innot.avreclipse.core.AVRGCCManagedMakePerProjectProfileC"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="avr-gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="de.innot.avreclipse.core.AVRGCCManagedMakePerProjectProfileCPP"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="avr-g++" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
</scannerConfigBuildInfo> |
<scannerConfigBuildInfo instanceId="de.innot.avreclipse.configuration.app.release.799832959.623565166;de.innot.avreclipse.configuration.app.release.799832959.623565166.;de.innot.avreclipse.tool.compiler.winavr.app.release.695648390;de.innot.avreclipse.compiler.winavr.input.71411405"> |
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="de.innot.avreclipse.core.AVRGCCManagedMakePerProjectProfileC"/> |
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="makefileGenerator"> |
<runAction arguments="-E -P -v -dD" command="" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/${specs_file}"'" command="sh" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-c 'g++ -E -P -v -dD "${plugin_state_location}/specs.cpp"'" command="sh" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/specs.c"'" command="sh" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="de.innot.avreclipse.core.AVRGCCManagedMakePerProjectProfileC"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="avr-gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="de.innot.avreclipse.core.AVRGCCManagedMakePerProjectProfileCPP"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="avr-g++" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
</scannerConfigBuildInfo> |
<scannerConfigBuildInfo instanceId="de.innot.avreclipse.configuration.app.release.799832959;de.innot.avreclipse.configuration.app.release.799832959."> |
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="de.innot.avreclipse.core.AVRGCCManagedMakePerProjectProfileC"/> |
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="makefileGenerator"> |
<runAction arguments="-E -P -v -dD" command="" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/${specs_file}"'" command="sh" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-c 'g++ -E -P -v -dD "${plugin_state_location}/specs.cpp"'" command="sh" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/specs.c"'" command="sh" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="de.innot.avreclipse.core.AVRGCCManagedMakePerProjectProfileC"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="avr-gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="de.innot.avreclipse.core.AVRGCCManagedMakePerProjectProfileCPP"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="avr-g++" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
</scannerConfigBuildInfo> |
<scannerConfigBuildInfo instanceId="de.innot.avreclipse.configuration.app.release.799832959.623565166.2071059632;de.innot.avreclipse.configuration.app.release.799832959.623565166.2071059632."> |
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="de.innot.avreclipse.core.AVRGCCManagedMakePerProjectProfileC"/> |
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="makefileGenerator"> |
<runAction arguments="-E -P -v -dD" command="" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/${specs_file}"'" command="sh" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-c 'g++ -E -P -v -dD "${plugin_state_location}/specs.cpp"'" command="sh" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/specs.c"'" command="sh" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="de.innot.avreclipse.core.AVRGCCManagedMakePerProjectProfileC"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="avr-gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="de.innot.avreclipse.core.AVRGCCManagedMakePerProjectProfileCPP"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="avr-g++" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
</scannerConfigBuildInfo> |
<scannerConfigBuildInfo instanceId="de.innot.avreclipse.configuration.app.release.799832959;de.innot.avreclipse.configuration.app.release.799832959.;de.innot.avreclipse.tool.compiler.winavr.app.release.1810413415;de.innot.avreclipse.compiler.winavr.input.2125782100"> |
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="de.innot.avreclipse.core.AVRGCCManagedMakePerProjectProfileC"/> |
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="makefileGenerator"> |
<runAction arguments="-E -P -v -dD" command="" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/${specs_file}"'" command="sh" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-c 'g++ -E -P -v -dD "${plugin_state_location}/specs.cpp"'" command="sh" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/specs.c"'" command="sh" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="de.innot.avreclipse.core.AVRGCCManagedMakePerProjectProfileC"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="avr-gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="de.innot.avreclipse.core.AVRGCCManagedMakePerProjectProfileCPP"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="avr-g++" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
</scannerConfigBuildInfo> |
<scannerConfigBuildInfo instanceId="de.innot.avreclipse.configuration.app.release.799832959.623565166.2071059632;de.innot.avreclipse.configuration.app.release.799832959.623565166.2071059632.;de.innot.avreclipse.tool.compiler.winavr.app.release.1087602969;de.innot.avreclipse.compiler.winavr.input.1885366176"> |
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="de.innot.avreclipse.core.AVRGCCManagedMakePerProjectProfileC"/> |
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="makefileGenerator"> |
<runAction arguments="-E -P -v -dD" command="" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/${specs_file}"'" command="sh" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-c 'g++ -E -P -v -dD "${plugin_state_location}/specs.cpp"'" command="sh" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/specs.c"'" command="sh" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="de.innot.avreclipse.core.AVRGCCManagedMakePerProjectProfileC"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="avr-gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="de.innot.avreclipse.core.AVRGCCManagedMakePerProjectProfileCPP"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="avr-g++" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
</scannerConfigBuildInfo> |
<scannerConfigBuildInfo instanceId="de.innot.avreclipse.configuration.app.debug.2000056965;de.innot.avreclipse.configuration.app.debug.2000056965."> |
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="de.innot.avreclipse.core.AVRGCCManagedMakePerProjectProfileC"/> |
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="makefileGenerator"> |
<runAction arguments="-E -P -v -dD" command="" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/${specs_file}"'" command="sh" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-c 'g++ -E -P -v -dD "${plugin_state_location}/specs.cpp"'" command="sh" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/specs.c"'" command="sh" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="de.innot.avreclipse.core.AVRGCCManagedMakePerProjectProfileC"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="avr-gcc" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
<profile id="de.innot.avreclipse.core.AVRGCCManagedMakePerProjectProfileCPP"> |
<buildOutputProvider> |
<openAction enabled="true" filePath=""/> |
<parser enabled="true"/> |
</buildOutputProvider> |
<scannerInfoProvider id="specsFile"> |
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="avr-g++" useDefault="true"/> |
<parser enabled="true"/> |
</scannerInfoProvider> |
</profile> |
</scannerConfigBuildInfo> |
</storageModule> |
</cconfiguration> |
</storageModule> |
<storageModule moduleId="cdtBuildSystem" version="4.0.0"> |
<project id="GPL_Mikrokoptertool.de.innot.avreclipse.project.winavr.elf_2.1.0.1917146692" name="AVR Cross Target Application" projectType="de.innot.avreclipse.project.winavr.elf_2.1.0"/> |
</storageModule> |
</cproject> |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/.directory |
---|
0,0 → 1,7 |
[Dolphin] |
AdditionalInfo=35 |
Timestamp=2012,12,10,23,7,26 |
ViewMode=1 |
[Settings] |
ShowDotFiles=true |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/.project |
---|
0,0 → 1,89 |
<?xml version="1.0" encoding="UTF-8"?> |
<projectDescription> |
<name>GPL_PKT_V3_6_7f_FC090b</name> |
<comment></comment> |
<projects> |
</projects> |
<buildSpec> |
<buildCommand> |
<name>org.eclipse.mylyn.wikitext.ui.wikiTextValidationBuilder</name> |
<arguments> |
</arguments> |
</buildCommand> |
<buildCommand> |
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name> |
<triggers>clean,full,incremental,</triggers> |
<arguments> |
<dictionary> |
<key>?name?</key> |
<value></value> |
</dictionary> |
<dictionary> |
<key>org.eclipse.cdt.make.core.append_environment</key> |
<value>true</value> |
</dictionary> |
<dictionary> |
<key>org.eclipse.cdt.make.core.autoBuildTarget</key> |
<value>all</value> |
</dictionary> |
<dictionary> |
<key>org.eclipse.cdt.make.core.buildArguments</key> |
<value></value> |
</dictionary> |
<dictionary> |
<key>org.eclipse.cdt.make.core.buildCommand</key> |
<value>make</value> |
</dictionary> |
<dictionary> |
<key>org.eclipse.cdt.make.core.buildLocation</key> |
<value>${workspace_loc:/GPL_Mikrokoptertool/Release}</value> |
</dictionary> |
<dictionary> |
<key>org.eclipse.cdt.make.core.cleanBuildTarget</key> |
<value>clean</value> |
</dictionary> |
<dictionary> |
<key>org.eclipse.cdt.make.core.contents</key> |
<value>org.eclipse.cdt.make.core.activeConfigSettings</value> |
</dictionary> |
<dictionary> |
<key>org.eclipse.cdt.make.core.enableAutoBuild</key> |
<value>false</value> |
</dictionary> |
<dictionary> |
<key>org.eclipse.cdt.make.core.enableCleanBuild</key> |
<value>true</value> |
</dictionary> |
<dictionary> |
<key>org.eclipse.cdt.make.core.enableFullBuild</key> |
<value>true</value> |
</dictionary> |
<dictionary> |
<key>org.eclipse.cdt.make.core.fullBuildTarget</key> |
<value>all</value> |
</dictionary> |
<dictionary> |
<key>org.eclipse.cdt.make.core.stopOnError</key> |
<value>true</value> |
</dictionary> |
<dictionary> |
<key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key> |
<value>true</value> |
</dictionary> |
</arguments> |
</buildCommand> |
<buildCommand> |
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name> |
<triggers>full,incremental,</triggers> |
<arguments> |
</arguments> |
</buildCommand> |
</buildSpec> |
<natures> |
<nature>org.eclipse.cdt.core.cnature</nature> |
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature> |
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature> |
<nature>de.innot.avreclipse.core.avrnature</nature> |
<nature>org.eclipse.mylyn.wikitext.ui.wikiTextNature</nature> |
</natures> |
</projectDescription> |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/.settings/de.innot.avreclipse.core.prefs |
---|
0,0 → 1,55 |
#Sun Jan 27 13:21:17 CET 2013 |
avrtarget/ClockFrequency=20000000 |
avrtarget/ExtRAMSize=0 |
avrtarget/ExtendedRAM=false |
avrtarget/MCUType=atmega644p |
avrtarget/UseEEPROM=false |
avrtarget/UseExtendedRAMforHeap=true |
avrtarget/avrdude/BitBangDelay= |
avrtarget/avrdude/Bitclock= |
avrtarget/avrdude/EEPROMFile= |
avrtarget/avrdude/EEPROMFromConfig=true |
avrtarget/avrdude/FlashFile= |
avrtarget/avrdude/FlashFromConfig=true |
avrtarget/avrdude/Fuses/ByteValues=215\:220\:252 |
avrtarget/avrdude/Fuses/FileName= |
avrtarget/avrdude/Fuses/MCUid=atmega644p |
avrtarget/avrdude/Fuses/UseFile=false |
avrtarget/avrdude/Fuses/Write=false |
avrtarget/avrdude/NoChipErase=false |
avrtarget/avrdude/NoSigCheck=false |
avrtarget/avrdude/NoVerify=true |
avrtarget/avrdude/NoWrite=false |
avrtarget/avrdude/OtherOptions= |
avrtarget/avrdude/ProgrammerID=programmerconfig.5 |
avrtarget/avrdude/UseCounter=false |
avrtarget/avrdude/WriteEEPROM=true |
avrtarget/avrdude/WriteFlash=true |
avrtarget/de.innot.avreclipse.configuration.app.release.799832959.623565166.2071059632/ClockFrequency=20000000 |
avrtarget/de.innot.avreclipse.configuration.app.release.799832959.623565166.2071059632/ExtRAMSize=0 |
avrtarget/de.innot.avreclipse.configuration.app.release.799832959.623565166.2071059632/ExtendedRAM=false |
avrtarget/de.innot.avreclipse.configuration.app.release.799832959.623565166.2071059632/MCUType=atmega1284p |
avrtarget/de.innot.avreclipse.configuration.app.release.799832959.623565166.2071059632/UseEEPROM=false |
avrtarget/de.innot.avreclipse.configuration.app.release.799832959.623565166.2071059632/UseExtendedRAMforHeap=true |
avrtarget/de.innot.avreclipse.configuration.app.release.799832959.623565166.2071059632/avrdude/BitBangDelay= |
avrtarget/de.innot.avreclipse.configuration.app.release.799832959.623565166.2071059632/avrdude/Bitclock= |
avrtarget/de.innot.avreclipse.configuration.app.release.799832959.623565166.2071059632/avrdude/EEPROMFile= |
avrtarget/de.innot.avreclipse.configuration.app.release.799832959.623565166.2071059632/avrdude/EEPROMFromConfig=true |
avrtarget/de.innot.avreclipse.configuration.app.release.799832959.623565166.2071059632/avrdude/FlashFile= |
avrtarget/de.innot.avreclipse.configuration.app.release.799832959.623565166.2071059632/avrdude/FlashFromConfig=true |
avrtarget/de.innot.avreclipse.configuration.app.release.799832959.623565166.2071059632/avrdude/Fuses/ByteValues=215\:220\:252 |
avrtarget/de.innot.avreclipse.configuration.app.release.799832959.623565166.2071059632/avrdude/Fuses/FileName= |
avrtarget/de.innot.avreclipse.configuration.app.release.799832959.623565166.2071059632/avrdude/Fuses/MCUid=atmega1284p |
avrtarget/de.innot.avreclipse.configuration.app.release.799832959.623565166.2071059632/avrdude/Fuses/UseFile=false |
avrtarget/de.innot.avreclipse.configuration.app.release.799832959.623565166.2071059632/avrdude/Fuses/Write=false |
avrtarget/de.innot.avreclipse.configuration.app.release.799832959.623565166.2071059632/avrdude/NoChipErase=false |
avrtarget/de.innot.avreclipse.configuration.app.release.799832959.623565166.2071059632/avrdude/NoSigCheck=false |
avrtarget/de.innot.avreclipse.configuration.app.release.799832959.623565166.2071059632/avrdude/NoVerify=true |
avrtarget/de.innot.avreclipse.configuration.app.release.799832959.623565166.2071059632/avrdude/NoWrite=false |
avrtarget/de.innot.avreclipse.configuration.app.release.799832959.623565166.2071059632/avrdude/OtherOptions= |
avrtarget/de.innot.avreclipse.configuration.app.release.799832959.623565166.2071059632/avrdude/ProgrammerID=programmerconfig.5 |
avrtarget/de.innot.avreclipse.configuration.app.release.799832959.623565166.2071059632/avrdude/UseCounter=false |
avrtarget/de.innot.avreclipse.configuration.app.release.799832959.623565166.2071059632/avrdude/WriteEEPROM=false |
avrtarget/de.innot.avreclipse.configuration.app.release.799832959.623565166.2071059632/avrdude/WriteFlash=true |
avrtarget/perConfig=true |
eclipse.preferences.version=1 |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/.settings/org.eclipse.cdt.core.prefs |
---|
0,0 → 1,36 |
#Mon Sep 19 11:44:16 CEST 2011 |
eclipse.preferences.version=1 |
environment/project/de.innot.avreclipse.configuration.app.release.799832959.1517645312.1613256380/AVRDUDEOPTIONS/delimiter=\: |
environment/project/de.innot.avreclipse.configuration.app.release.799832959.1517645312.1613256380/AVRDUDEOPTIONS/operation=replace |
environment/project/de.innot.avreclipse.configuration.app.release.799832959.1517645312.1613256380/AVRDUDEOPTIONS/value=-pm644 -cavr109 -P/dev/ttyUSB0 -b115200 -V |
environment/project/de.innot.avreclipse.configuration.app.release.799832959.1517645312.1613256380/AVRTARGETMCU/delimiter=\: |
environment/project/de.innot.avreclipse.configuration.app.release.799832959.1517645312.1613256380/AVRTARGETMCU/operation=replace |
environment/project/de.innot.avreclipse.configuration.app.release.799832959.1517645312.1613256380/AVRTARGETMCU/value=${AVRTARGETMCU}atmega644p |
environment/project/de.innot.avreclipse.configuration.app.release.799832959.1517645312.1613256380/append=true |
environment/project/de.innot.avreclipse.configuration.app.release.799832959.1517645312.1613256380/appendContributed=true |
environment/project/de.innot.avreclipse.configuration.app.release.799832959.1517645312.853231308/AVRDUDEOPTIONS/delimiter=\: |
environment/project/de.innot.avreclipse.configuration.app.release.799832959.1517645312.853231308/AVRDUDEOPTIONS/operation=replace |
environment/project/de.innot.avreclipse.configuration.app.release.799832959.1517645312.853231308/AVRDUDEOPTIONS/value=-pm644 -cavr109 -P/dev/ttyUSB0 -b115200 -V |
environment/project/de.innot.avreclipse.configuration.app.release.799832959.1517645312.853231308/AVRTARGETMCU/delimiter=\: |
environment/project/de.innot.avreclipse.configuration.app.release.799832959.1517645312.853231308/AVRTARGETMCU/operation=replace |
environment/project/de.innot.avreclipse.configuration.app.release.799832959.1517645312.853231308/AVRTARGETMCU/value=${AVRTARGETMCU}atmega644p |
environment/project/de.innot.avreclipse.configuration.app.release.799832959.1517645312.853231308/append=true |
environment/project/de.innot.avreclipse.configuration.app.release.799832959.1517645312.853231308/appendContributed=true |
environment/project/de.innot.avreclipse.configuration.app.release.799832959.1517645312/AVRDUDEOPTIONS/delimiter=\: |
environment/project/de.innot.avreclipse.configuration.app.release.799832959.1517645312/AVRDUDEOPTIONS/operation=replace |
environment/project/de.innot.avreclipse.configuration.app.release.799832959.1517645312/AVRDUDEOPTIONS/value=-pm644 -cavr109 -P/dev/ttyUSB0 -b115200 -V |
environment/project/de.innot.avreclipse.configuration.app.release.799832959.1517645312/AVRTARGETMCU/delimiter=\: |
environment/project/de.innot.avreclipse.configuration.app.release.799832959.1517645312/AVRTARGETMCU/operation=replace |
environment/project/de.innot.avreclipse.configuration.app.release.799832959.1517645312/AVRTARGETMCU/value=${AVRTARGETMCU}atmega644p |
environment/project/de.innot.avreclipse.configuration.app.release.799832959.1517645312/append=true |
environment/project/de.innot.avreclipse.configuration.app.release.799832959.1517645312/appendContributed=true |
environment/project/de.innot.avreclipse.configuration.app.release.799832959.2056827711.732852056/AVRTARGETMCU/delimiter=\: |
environment/project/de.innot.avreclipse.configuration.app.release.799832959.2056827711.732852056/AVRTARGETMCU/operation=replace |
environment/project/de.innot.avreclipse.configuration.app.release.799832959.2056827711.732852056/AVRTARGETMCU/value=${AVRTARGETMCU}atmega644p |
environment/project/de.innot.avreclipse.configuration.app.release.799832959.2056827711.732852056/append=true |
environment/project/de.innot.avreclipse.configuration.app.release.799832959.2056827711.732852056/appendContributed=true |
environment/project/de.innot.avreclipse.configuration.app.release.799832959.2056827711/AVRTARGETMCU/delimiter=\: |
environment/project/de.innot.avreclipse.configuration.app.release.799832959.2056827711/AVRTARGETMCU/operation=replace |
environment/project/de.innot.avreclipse.configuration.app.release.799832959.2056827711/AVRTARGETMCU/value=${AVRTARGETMCU}atmega644p |
environment/project/de.innot.avreclipse.configuration.app.release.799832959.2056827711/append=true |
environment/project/de.innot.avreclipse.configuration.app.release.799832959.2056827711/appendContributed=true |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/.settings/org.eclipse.core.resources.prefs |
---|
0,0 → 1,6 |
#Mon Mar 11 21:21:40 CET 2013 |
eclipse.preferences.version=1 |
encoding//tracking/ng_servo.h=UTF-8 |
encoding//tracking/tracking.c=UTF-8 |
encoding/HAL_HW3_9.c=UTF-8 |
encoding/mk-data-structs.h=UTF-8 |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/.settings/org.eclipse.ltk.core.refactoring.prefs |
---|
0,0 → 1,3 |
#Sat Jun 25 11:51:11 CEST 2011 |
eclipse.preferences.version=1 |
org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/.settings/org.eclipse.mylyn.tasks.ui.prefs |
---|
0,0 → 1,4 |
#Wed Mar 13 21:55:19 CET 2013 |
eclipse.preferences.version=1 |
project.repository.kind=local |
project.repository.url=local |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/HAL_HW3_9.c |
---|
0,0 → 1,353 |
/***************************************************************************** |
* Copyright (C) 2008 Thomas Kaiser, thomas@ft-fanpage.de * |
* Copyright (C) 2009 Peter "woggle" Mack, mac@denich.net * |
* Copyright (C) 2011 Christian "Cebra" Brandtner, brandtner@brandtner.net * |
* Copyright (C) 2011 Harald Bongartz * |
* * |
* This program is free software; you can redistribute it and/or modify * |
* it under the terms of the GNU General Public License as published by * |
* the Free Software Foundation; either version 2 of the License. * |
* * |
* This program is distributed in the hope that it will be useful, * |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
* GNU General Public License for more details. * |
* * |
* You should have received a copy of the GNU General Public License * |
* along with this program; if not, write to the * |
* Free Software Foundation, Inc., * |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
* * |
* * |
* Credits to: * |
* Holger Buss & Ingo Busker from mikrokopter.de for the MK project + SVN * |
* http://www.mikrokopter.de * |
* Gregor "killagreg" Stobrawa for his version of the MK code * |
* Thomas Kaiser "thkais" for the original project. See * |
* http://www.ft-fanpage.de/mikrokopter/ * |
* http://forum.mikrokopter.de/topic-4061-1.html * |
* Claas Anders "CaScAdE" Rathje for providing the font and his C-OSD code * |
* http://www.mylifesucks.de/oss/c-osd/ * |
* Harald Bongartz "HaraldB" for providing his Ideas and Code for usibility* |
*****************************************************************************/ |
#ifndef HAL_HW3_9_C_ |
#define HAL_HW3_9_C_ |
#include "cpu.h" |
#include <inttypes.h> |
#include <avr/io.h> |
#include <avr/interrupt.h> |
#include <avr/pgmspace.h> |
#include <avr/eeprom.h> |
#include <util/delay.h> |
#include <stdbool.h> |
#include <stdlib.h> |
#include "main.h" |
#if defined HWVERSION3_9 |
#include "eeprom/eeprom.h" |
#include "messages.h" |
#include "lcd/lcd.h" |
#include "uart/usart.h" |
#include "uart/uart1.h" |
#include "display.h" |
#include "timer/timer.h" |
#include "wi232/Wi232.h" |
#include "motortest/twimaster.h" |
#include "bluetooth/bluetooth.h" |
#include "bluetooth/error.h" |
#include "connect.h" |
#include "lipo/lipo.h" |
#include "setup/setup.h" |
#include "osd/osd.h" |
#include "sound/pwmsine8bit.h" |
#include "tracking/ng_servo.h" |
volatile uint8_t USBBT; |
volatile uint8_t U02SV2; |
volatile uint8_t PCB_Version; |
uint8_t PortA; |
uint8_t PortB; |
uint8_t PortC; |
uint8_t PortD; |
void CheckPCB(void) |
{ |
DDRA = 0xFF; |
DDRB = 0x00; |
DDRC = 0x00; |
DDRD = 0x00; |
PortA = PINA; |
PortB = PINB; |
PortC = PINC; |
PortD = PIND; |
if (PINC & (1<<PINC7) ) PCB_Version = PKT39m; else PCB_Version = PKT39x; |
} |
//-------------------------------------------------------------- |
void InitHWPorts(void) // Initialisierung der Hardware fÃŒr die jeweilige Leiterplattenversion |
{ |
CheckPCB(); // Version der Leiterplatte prüfen |
PORTA |= (1<<PORTA4)|(1<<PORTA5)|(1<<PORTA6)|(1<<PORTA7); // Enable Pull Up for the 4 keys |
DDRA &= ~(1<<DDA4); // Eingang: A4 auf Low setzen (Power On) |
//DDRA &= ~(1<<DDA1); // Eingang: PKT Lipo Messung // MartinR so war es |
if (Config.Lipomessung == true) |
{ |
DDRA &= ~(1<<DDA1); // Eingang: PKT Lipo Messung |
PORTA &= ~(1<<PORTA1); |
} |
DDRB = 0xFF; // Alles AusgÀnge |
PORTC |= (1<<PORTC4)|(1<<PORTC7); // Enable Pull Up for LBO + Summer |
DDRC |= (1<<DDC2)|(1<<DDC3)|(1<<DDC5)|(1<<DDC6|(1<<DDC7)); // Ausgang: Led2,Rs232Switch,Summer |
DDRC &= ~(1<<DDC4); // Eingang: LowBat LTC1308 |
_BTOn(); // Erstmal USB dektivieren, damit beim versehentlichen Einschalten USB im PC ruhig bleibt |
PORTD |= (1<<PORTD6); // Wi232-CMD auf High schalten |
DDRD |= (1<<DDD4)|(1<<DDD5)|(1<<DDD6)|(1<<DDD7); // Ausgang: PiepserTest, Servo, Wi232-CMD und Beleuchtung |
set_V_On(); // Spannung mit T3 halten |
Timer0_Init (); // system |
Display_on = 1; |
USART_Init (UART_BAUD_SELECT(USART_BAUD,F_CPU)); |
uart1_init (UART_BAUD_SELECT(USART_BAUD,F_CPU)); // USB |
I2C_Init(1); |
LCD_Init (0); // muss vor "ReadParameter" stehen |
ReadParameter (); // Aktuelle Werte aus EEProm auslesen |
servoInit(SERVO_PERIODE); |
// servoSetDefaultPos(); |
sei (); |
Old_Baudrate = Config.PKT_Baudrate; |
SetBaudUart1(Config.PKT_Baudrate); |
SetBaudUart0(Config.PKT_Baudrate); |
if (Config.DisplayLanguage > NUM_LANG) // Beim ersten Start Sprache abfragen |
{ Config.DisplayLanguage = 1; |
Config.DisplayLanguage = Edit_generic(Config.DisplayLanguage,0,3,DISPLAY3,Language); |
// WriteParameter(); |
} |
if ((Config.HWSound==0)&&(PCB_Version == PKT39m)) |
{ |
Timer2_Init(); // Displaybeleuchtung |
OCR2A = Config.LCD_Helligkeit * 2.55; |
} |
if (Config.HWSound==1) InitSound(); |
LCD_Init (1); |
set_beep ( 400, 0x0080, BeepNormal); |
OSD_active = false; //keine OSD Ausgabe |
ADC_Init(); // ADC für Lipomessung// MartinR: verschoben |
if (PCB_Version==PKT39m) |
{ |
lcd_printp_at (2, 0, PSTR("Hardware PKT 3.9m"),0); |
lcd_printp_at (7, 1, PSTR("09.2011"),0); |
} |
if (PCB_Version==PKT39x) |
{ |
lcd_printp_at (2, 0, PSTR("Hardware PKT 3.9x"),0); |
lcd_printp_at (7, 1, PSTR("11.2012"),0); |
} |
lcd_printp_at (0, 3, PSTR("Software:"),0); |
// lcd_printpj_at (8, 3, PSTR(PKTSWVersion),0); |
lcd_printp_at (8, 3, PSTR(PKTSWVersion), MBIG); |
lcd_puts_at(0, 5, strGet(BOOT1), 0); |
lcd_puts_at(0, 6, strGet(BOOT2), 0); |
_delay_ms(800); |
if (PINA & (1<<PINA7)) // Spannung eingeschaltet lassen |
clr_V_On(); |
_delay_ms(100); |
set_beep ( 400, 0x0080, BeepNormal); |
get_key_press(KEY_ALL); |
if (Config.HWSound==1); |
{ |
playTone(505,100,Config.Volume); |
playTone(515,100,Config.Volume); |
playTone(525,100,Config.Volume); |
playTone(535,100,Config.Volume); |
playTone(525,100,Config.Volume); |
playTone(515,100,Config.Volume); |
playTone(505,100,Config.Volume); |
} |
lcd_cls(); |
// servoSetPosition(1,0); |
// _delay_ms(250); |
// servoSetPosition(0,0); |
// _delay_ms(250); |
// servoSetPosition(1,400); |
// _delay_ms(250); |
// servoSetPosition(0,400); |
// _delay_ms(250); |
// servoSetPosition(1,0); |
// _delay_ms(250); |
// servoSetPosition(0,0); |
// _delay_ms(250); |
// servoSetPosition(1,400); |
// _delay_ms(250); |
// servoSetPosition(0,400); |
set_BTOff(); |
if ((Config.UseWi == true) && (Config.WiIsSet == false)) |
{ |
InitWi232(Config.PKT_Baudrate); // wenn Wi232 nicht initialisiert ist, dann jetzt tun |
} |
lcd_cls(); |
// BT ausschalten |
if ((Config.UseBT == true) && (Config.BTIsSet == false)) |
{ |
bt_init(); |
// set_USBOn(); |
} |
bt_start(); |
lcd_cls(); |
if ((Config.UseWi == true) && (U02SV2 == 0)) |
{ |
Change_Output(Uart02Wi); // Verbindung zu Wi232 herstellen |
if (Config.PKT_StartInfo == true) |
{ |
lcd_puts_at(0, 0, strGet(BOOT_WI1), 0); |
lcd_puts_at(0, 1, strGet(BOOT_WI2), 0); |
_delay_ms(2000); |
} |
} |
else |
{ |
Change_Output(Uart02FC); // Verbindung zu SV" (Kabel) herstellen |
if (Config.PKT_StartInfo == true) |
{ |
lcd_puts_at(0, 0, strGet(BOOT_WI1), 0); |
lcd_puts_at(0, 1, strGet(BOOT_SV), 0); |
_delay_ms(2000); |
} |
} |
lcd_cls(); |
} |
//#define set_BEEP() (PORTC &= ~(1 << Summer)) // Summer |
//#define clr_BEEP() (PORTC |= (1 << Summer)) |
void set_BEEP(void) |
{ |
if (PCB_Version == PKT39m) |
PORTC &= ~(1 << Summer); // Summer |
if (PCB_Version == PKT39x) |
PORTD &= ~(1 << SummerV2); // Summer |
} |
void clr_BEEP(void) |
{ |
if (PCB_Version == PKT39m) |
PORTC |= (1 << Summer); // Summer |
if (PCB_Version == PKT39x) |
PORTD |= (1 << SummerV2); // Summer |
} |
void set_D_LIGHT(void) /* Displaybeleuchtung ein*/ |
{ |
if (PCB_Version == PKT39m) |
{ |
if (Config.HWSound==0) |
{ |
// PWM einschalten |
TCCR2A |= (1 << WGM21) | (1 << WGM20) | (1 << COM2A1); |
TCCR2B |= (1 << CS20); |
} |
else |
clr_DISPLAYLIGHT(); |
} |
if (PCB_Version == PKT39x) |
{ |
// if (HWSound==0) |
// { |
// // PWM einschalten |
// TCCR2A |= (1 << WGM21) | (1 << WGM20) | (1 << COM2A1); |
// TCCR2B |= (1 << CS20); |
// } |
// else |
clr_DISPLAYLIGHTV2(); |
} |
} |
void clr_D_LIGHT(void) /* Displaybeleuchtung aus*/ |
{ |
if (PCB_Version == PKT39m) |
{ |
if (Config.HWSound==0) |
{ |
// PWM ausschalten |
TCCR2A = 0; |
TCCR2B = 0; |
} |
else |
set_DISPLAYLIGHT(); |
} |
if (PCB_Version == PKT39x) |
{ |
// if (HWSound==0) |
// { |
// // PWM ausschalten |
// TCCR2A = 0; |
// TCCR2B = 0; |
// } |
// else |
set_DISPLAYLIGHTV2(); |
} |
} |
uint8_t BTIsOn=0; |
void set_BTOn(void) |
{ |
if (BTIsOn == 0) |
{ |
_BTOn(); |
BTIsOn = 1; |
_delay_ms(2000); |
} |
} |
void set_BTOff(void) |
{ |
set_USBOn(); |
BTIsOn = 0; |
} |
#endif |
#endif // HAL_HW3_9_C_ |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/HAL_HW3_9.h |
---|
0,0 → 1,153 |
/***************************************************************************** |
* Copyright (C) 2008 Thomas Kaiser, thomas@ft-fanpage.de * |
* Copyright (C) 2009 Peter "woggle" Mack, mac@denich.net * |
* Copyright (C) 2011 Christian "Cebra" Brandtner, brandtner@brandtner.net * |
* Copyright (C) 2011 Harald Bongartz * |
* * |
* This program is free software; you can redistribute it and/or modify * |
* it under the terms of the GNU General Public License as published by * |
* the Free Software Foundation; either version 2 of the License. * |
* * |
* This program is distributed in the hope that it will be useful, * |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
* GNU General Public License for more details. * |
* * |
* You should have received a copy of the GNU General Public License * |
* along with this program; if not, write to the * |
* Free Software Foundation, Inc., * |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
* * |
* * |
* Credits to: * |
* Holger Buss & Ingo Busker from mikrokopter.de for the MK project + SVN * |
* http://www.mikrokopter.de * |
* Gregor "killagreg" Stobrawa for his version of the MK code * |
* Thomas Kaiser "thkais" for the original project. See * |
* http://www.ft-fanpage.de/mikrokopter/ * |
* http://forum.mikrokopter.de/topic-4061-1.html * |
* Claas Anders "CaScAdE" Rathje for providing the font and his C-OSD code * |
* http://www.mylifesucks.de/oss/c-osd/ * |
* Harald Bongartz "HaraldB" for providing his Ideas and Code for usibility* |
*****************************************************************************/ |
#ifndef HAL_HW3_9_H_ |
#define HAL_HW3_9_H_ |
//#define PIEPSER_NERVT // Summer zu Testzwecken ganz Ausschalten |
// Hardware 3.9 Portbelegung |
#define KEY_PIN PINA // Port A als Input |
#define Touch0 PA0 // Pin 37 |
#define Touch1 PA1 // Pin 36 |
#define Touch2 PA2 // Pin 35 |
#define Touch3 PA3 // Pin 34 |
#define KEY_EXT PINA3 // MartinR |
#define Key1 PA4 // Pin 33 |
#define Key2 PA5 // Pin 32 |
#define Key3 PA6 // Pin 31 |
#define Key4 PA7 // Pin 30 |
#define USB2Wi PB0 // Pin 40 aktiv low > IC5 |
#define VoltageHold PB1 // Pin 41 High = Spannung T3 halten |
#define Display_Reset PB2 // Pin 42 |
#define Display_A0 PB3 // Pin 43 |
#define Display_CS PB4 // Pin 44 |
#define Display_SI PB5 // Pin 1 |
#define LED1 PB6 // Pin 2 Low = LED1 (nicht benutzbar wegen SCL |
#define Display_SCL PB7 // Pin 3 |
#define I2C_SCL PC0 // Pin 19 SCL |
#define I2C_CDA PC1 // Pin 20 SDA |
#define USB2FC PC2 // Pin 21 aktiv low > IC5 |
#define USB_BT PC3 // Pin 22 high = USB, Low = Bluetooth, LED2 |
#define LowBat PC4 // Pin 23 Low Bat Warning Lipo PKT,Input |
#define Uart02Wi PC5 // Pin 24 aktiv Low > IC4 |
#define Uart02FC PC6 // Pin 25 aktiv Low > IC4 |
#define Summer PC7 // Pin 26 Low = Summer |
#define DisplaybeleuchtungV2 PC7 // Pin 26 High = Display-LED PCB 3.9w |
#define Uart0RxD PD0 // Pin 9 über IC4 =Wi | SV2 |
#define Uart0TxD PD1 // Pin 10 über IC4 =Wi | SV2 |
#define Uart1RxD PD2 // Pin 11 direkt = USB, BTM, über IC5 = Wi | SV2 |
#define Uart1TxD PD3 // Pin 12 direkt = USB, BTM, über IC5 = Wi | SV2 |
#define SERVO2 PD4 // Pin 13 PWM Servo 2 |
#define SERVO1 PD5 // Pin 14 PWM Servo 1 |
#define Wi232_CMD PD6 // Pin 15 aktiv Low = Wi232 CMD |
#define Displaybeleuchtung PD7 // Pin 16 High = Display-LED |
#define SummerV2 PD7 // Pin 16 Low = Summer, PCB 3.9w |
#define KEY_ENTER Key1 |
#define KEY_ESC Key2 |
#define KEY_PLUS Key3 |
#define KEY_MINUS Key4 |
// |= schaltet Ausgang auf HIGH |
// &= ~ schaltet Ausgang auf LOW |
#define set_reset() (PORTB |= (1 << Display_Reset)) |
#define clr_reset() (PORTB &= ~(1 << Display_Reset)) |
#define set_A0() (PORTB |= (1 << Display_A0)) |
#define clr_A0() (PORTB &= ~(1 << Display_A0)) |
#define set_cs() (PORTB |= (1 << Display_CS)) |
#define clr_cs() (PORTB &= ~(1 << Display_CS)) |
#define set_si() (PORTB |= (1 << Display_SI)) |
#define clr_si() (PORTB &= ~(1 << Display_SI)) |
#define set_scl() (PORTB |= (1 << Display_SCL)) |
#define clr_scl() (PORTB &= ~(1 << Display_SCL)) |
#define _BTOn() (PORTC &= ~(1 << USB_BT)) // Bluetooth ein |
#define set_USBOn() (PORTC |= (1 << USB_BT)) // USB ein |
#define clr_V_On() (PORTB &= ~(1 << VoltageHold)) // Spannung mit T3 halten |
#define set_V_On() (PORTB |= (1 << VoltageHold)) |
#define set_USB2FC() (PORTC &= ~(1 << USB2FC)) // USB mit FC-Kabel verbinden |
#define clr_USB2FC() (PORTC |= (1 << USB2FC)) |
#define set_USB2Wi() (PORTB &= ~(1 << USB2Wi)) // USB mit Wi232 verbinden |
#define clr_USB2Wi() (PORTB |= (1 << USB2Wi)) |
#define set_Uart02FC() (PORTC &= ~(1 << Uart02FC)) // Uart0 mit FC-Kabel verbinden |
#define clr_Uart02FC() (PORTC |= (1 << Uart02FC)) |
#define set_Uart02Wi() (PORTC &= ~(1 << Uart02Wi)) // Uart0 mit Wi232 verbinden |
#define clr_Uart02Wi() (PORTC |= (1 << Uart02Wi)) |
#define set_DISPLAYLIGHT() (PORTD &= ~(1 << Displaybeleuchtung)) // Displaybeleuchtung |
#define clr_DISPLAYLIGHT() (PORTD |= (1 << Displaybeleuchtung)) |
#define set_DISPLAYLIGHTV2() (PORTC &= ~(1 << DisplaybeleuchtungV2)) // Displaybeleuchtung PCB3.9w |
#define clr_DISPLAYLIGHTV2() (PORTC |= (1 << DisplaybeleuchtungV2)) |
#define set_WI232CMD() (PORTD &= ~(1 << Wi232_CMD)) // Wi232 Programmierpin |
#define clr_WI232CMD() (PORTD |= (1 << Wi232_CMD)) |
#define PKT39m 1 |
#define PKT39x 2 |
void set_D_LIGHT(void); /* Displaybeleuchtung ein*/ |
void clr_D_LIGHT(void); /* Displaybeleuchtung aus */ |
void set_BEEP(void); /* Beeper ein*/ |
void clr_BEEP(void); /* Beeper aus*/ |
void InitHWPorts(void); |
void set_BTOn(void); /* Bluetooth einschalten*/ |
void set_BTOff(void); /* Bluetooth einschalten*/ |
extern volatile uint8_t PCB_Version; |
#endif |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/LICENSE.TXT |
---|
0,0 → 1,340 |
GNU GENERAL PUBLIC LICENSE |
Version 2, June 1991 |
Copyright (C) 1989, 1991 Free Software Foundation, Inc. |
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
Everyone is permitted to copy and distribute verbatim copies |
of this license document, but changing it is not allowed. |
Preamble |
The licenses for most software are designed to take away your |
freedom to share and change it. By contrast, the GNU General Public |
License is intended to guarantee your freedom to share and change free |
software--to make sure the software is free for all its users. This |
General Public License applies to most of the Free Software |
Foundation's software and to any other program whose authors commit to |
using it. (Some other Free Software Foundation software is covered by |
the GNU Library General Public License instead.) You can apply it to |
your programs, too. |
When we speak of free software, we are referring to freedom, not |
price. Our General Public Licenses are designed to make sure that you |
have the freedom to distribute copies of free software (and charge for |
this service if you wish), that you receive source code or can get it |
if you want it, that you can change the software or use pieces of it |
in new free programs; and that you know you can do these things. |
To protect your rights, we need to make restrictions that forbid |
anyone to deny you these rights or to ask you to surrender the rights. |
These restrictions translate to certain responsibilities for you if you |
distribute copies of the software, or if you modify it. |
For example, if you distribute copies of such a program, whether |
gratis or for a fee, you must give the recipients all the rights that |
you have. You must make sure that they, too, receive or can get the |
source code. And you must show them these terms so they know their |
rights. |
We protect your rights with two steps: (1) copyright the software, and |
(2) offer you this license which gives you legal permission to copy, |
distribute and/or modify the software. |
Also, for each author's protection and ours, we want to make certain |
that everyone understands that there is no warranty for this free |
software. If the software is modified by someone else and passed on, we |
want its recipients to know that what they have is not the original, so |
that any problems introduced by others will not reflect on the original |
authors' reputations. |
Finally, any free program is threatened constantly by software |
patents. We wish to avoid the danger that redistributors of a free |
program will individually obtain patent licenses, in effect making the |
program proprietary. To prevent this, we have made it clear that any |
patent must be licensed for everyone's free use or not licensed at all. |
The precise terms and conditions for copying, distribution and |
modification follow. |
GNU GENERAL PUBLIC LICENSE |
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION |
0. This License applies to any program or other work which contains |
a notice placed by the copyright holder saying it may be distributed |
under the terms of this General Public License. The "Program", below, |
refers to any such program or work, and a "work based on the Program" |
means either the Program or any derivative work under copyright law: |
that is to say, a work containing the Program or a portion of it, |
either verbatim or with modifications and/or translated into another |
language. (Hereinafter, translation is included without limitation in |
the term "modification".) Each licensee is addressed as "you". |
Activities other than copying, distribution and modification are not |
covered by this License; they are outside its scope. The act of |
running the Program is not restricted, and the output from the Program |
is covered only if its contents constitute a work based on the |
Program (independent of having been made by running the Program). |
Whether that is true depends on what the Program does. |
1. You may copy and distribute verbatim copies of the Program's |
source code as you receive it, in any medium, provided that you |
conspicuously and appropriately publish on each copy an appropriate |
copyright notice and disclaimer of warranty; keep intact all the |
notices that refer to this License and to the absence of any warranty; |
and give any other recipients of the Program a copy of this License |
along with the Program. |
You may charge a fee for the physical act of transferring a copy, and |
you may at your option offer warranty protection in exchange for a fee. |
2. You may modify your copy or copies of the Program or any portion |
of it, thus forming a work based on the Program, and copy and |
distribute such modifications or work under the terms of Section 1 |
above, provided that you also meet all of these conditions: |
a) You must cause the modified files to carry prominent notices |
stating that you changed the files and the date of any change. |
b) You must cause any work that you distribute or publish, that in |
whole or in part contains or is derived from the Program or any |
part thereof, to be licensed as a whole at no charge to all third |
parties under the terms of this License. |
c) If the modified program normally reads commands interactively |
when run, you must cause it, when started running for such |
interactive use in the most ordinary way, to print or display an |
announcement including an appropriate copyright notice and a |
notice that there is no warranty (or else, saying that you provide |
a warranty) and that users may redistribute the program under |
these conditions, and telling the user how to view a copy of this |
License. (Exception: if the Program itself is interactive but |
does not normally print such an announcement, your work based on |
the Program is not required to print an announcement.) |
These requirements apply to the modified work as a whole. If |
identifiable sections of that work are not derived from the Program, |
and can be reasonably considered independent and separate works in |
themselves, then this License, and its terms, do not apply to those |
sections when you distribute them as separate works. But when you |
distribute the same sections as part of a whole which is a work based |
on the Program, the distribution of the whole must be on the terms of |
this License, whose permissions for other licensees extend to the |
entire whole, and thus to each and every part regardless of who wrote it. |
Thus, it is not the intent of this section to claim rights or contest |
your rights to work written entirely by you; rather, the intent is to |
exercise the right to control the distribution of derivative or |
collective works based on the Program. |
In addition, mere aggregation of another work not based on the Program |
with the Program (or with a work based on the Program) on a volume of |
a storage or distribution medium does not bring the other work under |
the scope of this License. |
3. You may copy and distribute the Program (or a work based on it, |
under Section 2) in object code or executable form under the terms of |
Sections 1 and 2 above provided that you also do one of the following: |
a) Accompany it with the complete corresponding machine-readable |
source code, which must be distributed under the terms of Sections |
1 and 2 above on a medium customarily used for software interchange; or, |
b) Accompany it with a written offer, valid for at least three |
years, to give any third party, for a charge no more than your |
cost of physically performing source distribution, a complete |
machine-readable copy of the corresponding source code, to be |
distributed under the terms of Sections 1 and 2 above on a medium |
customarily used for software interchange; or, |
c) Accompany it with the information you received as to the offer |
to distribute corresponding source code. (This alternative is |
allowed only for noncommercial distribution and only if you |
received the program in object code or executable form with such |
an offer, in accord with Subsection b above.) |
The source code for a work means the preferred form of the work for |
making modifications to it. For an executable work, complete source |
code means all the source code for all modules it contains, plus any |
associated interface definition files, plus the scripts used to |
control compilation and installation of the executable. However, as a |
special exception, the source code distributed need not include |
anything that is normally distributed (in either source or binary |
form) with the major components (compiler, kernel, and so on) of the |
operating system on which the executable runs, unless that component |
itself accompanies the executable. |
If distribution of executable or object code is made by offering |
access to copy from a designated place, then offering equivalent |
access to copy the source code from the same place counts as |
distribution of the source code, even though third parties are not |
compelled to copy the source along with the object code. |
4. You may not copy, modify, sublicense, or distribute the Program |
except as expressly provided under this License. Any attempt |
otherwise to copy, modify, sublicense or distribute the Program is |
void, and will automatically terminate your rights under this License. |
However, parties who have received copies, or rights, from you under |
this License will not have their licenses terminated so long as such |
parties remain in full compliance. |
5. You are not required to accept this License, since you have not |
signed it. However, nothing else grants you permission to modify or |
distribute the Program or its derivative works. These actions are |
prohibited by law if you do not accept this License. Therefore, by |
modifying or distributing the Program (or any work based on the |
Program), you indicate your acceptance of this License to do so, and |
all its terms and conditions for copying, distributing or modifying |
the Program or works based on it. |
6. Each time you redistribute the Program (or any work based on the |
Program), the recipient automatically receives a license from the |
original licensor to copy, distribute or modify the Program subject to |
these terms and conditions. You may not impose any further |
restrictions on the recipients' exercise of the rights granted herein. |
You are not responsible for enforcing compliance by third parties to |
this License. |
7. If, as a consequence of a court judgment or allegation of patent |
infringement or for any other reason (not limited to patent issues), |
conditions are imposed on you (whether by court order, agreement or |
otherwise) that contradict the conditions of this License, they do not |
excuse you from the conditions of this License. If you cannot |
distribute so as to satisfy simultaneously your obligations under this |
License and any other pertinent obligations, then as a consequence you |
may not distribute the Program at all. For example, if a patent |
license would not permit royalty-free redistribution of the Program by |
all those who receive copies directly or indirectly through you, then |
the only way you could satisfy both it and this License would be to |
refrain entirely from distribution of the Program. |
If any portion of this section is held invalid or unenforceable under |
any particular circumstance, the balance of the section is intended to |
apply and the section as a whole is intended to apply in other |
circumstances. |
It is not the purpose of this section to induce you to infringe any |
patents or other property right claims or to contest validity of any |
such claims; this section has the sole purpose of protecting the |
integrity of the free software distribution system, which is |
implemented by public license practices. Many people have made |
generous contributions to the wide range of software distributed |
through that system in reliance on consistent application of that |
system; it is up to the author/donor to decide if he or she is willing |
to distribute software through any other system and a licensee cannot |
impose that choice. |
This section is intended to make thoroughly clear what is believed to |
be a consequence of the rest of this License. |
8. If the distribution and/or use of the Program is restricted in |
certain countries either by patents or by copyrighted interfaces, the |
original copyright holder who places the Program under this License |
may add an explicit geographical distribution limitation excluding |
those countries, so that distribution is permitted only in or among |
countries not thus excluded. In such case, this License incorporates |
the limitation as if written in the body of this License. |
9. The Free Software Foundation may publish revised and/or new versions |
of the General Public License from time to time. Such new versions will |
be similar in spirit to the present version, but may differ in detail to |
address new problems or concerns. |
Each version is given a distinguishing version number. If the Program |
specifies a version number of this License which applies to it and "any |
later version", you have the option of following the terms and conditions |
either of that version or of any later version published by the Free |
Software Foundation. If the Program does not specify a version number of |
this License, you may choose any version ever published by the Free Software |
Foundation. |
10. If you wish to incorporate parts of the Program into other free |
programs whose distribution conditions are different, write to the author |
to ask for permission. For software which is copyrighted by the Free |
Software Foundation, write to the Free Software Foundation; we sometimes |
make exceptions for this. Our decision will be guided by the two goals |
of preserving the free status of all derivatives of our free software and |
of promoting the sharing and reuse of software generally. |
NO WARRANTY |
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY |
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN |
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES |
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED |
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS |
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE |
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, |
REPAIR OR CORRECTION. |
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING |
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR |
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, |
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING |
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED |
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY |
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER |
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE |
POSSIBILITY OF SUCH DAMAGES. |
END OF TERMS AND CONDITIONS |
How to Apply These Terms to Your New Programs |
If you develop a new program, and you want it to be of the greatest |
possible use to the public, the best way to achieve this is to make it |
free software which everyone can redistribute and change under these terms. |
To do so, attach the following notices to the program. It is safest |
to attach them to the start of each source file to most effectively |
convey the exclusion of warranty; and each file should have at least |
the "copyright" line and a pointer to where the full notice is found. |
<one line to give the program's name and a brief idea of what it does.> |
Copyright (C) <year> <name of author> |
This program is free software; you can redistribute it and/or modify |
it under the terms of the GNU General Public License as published by |
the Free Software Foundation; either version 2 of the License, or |
(at your option) any later version. |
This program is distributed in the hope that it will be useful, |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
GNU General Public License for more details. |
You should have received a copy of the GNU General Public License |
along with this program; if not, write to the Free Software |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
Also add information on how to contact you by electronic and paper mail. |
If the program is interactive, make it output a short notice like this |
when it starts in an interactive mode: |
Gnomovision version 69, Copyright (C) year name of author |
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. |
This is free software, and you are welcome to redistribute it |
under certain conditions; type `show c' for details. |
The hypothetical commands `show w' and `show c' should show the appropriate |
parts of the General Public License. Of course, the commands you use may |
be called something other than `show w' and `show c'; they could even be |
mouse-clicks or menu items--whatever suits your program. |
You should also get your employer (if you work as a programmer) or your |
school, if any, to sign a "copyright disclaimer" for the program, if |
necessary. Here is a sample; alter the names: |
Yoyodyne, Inc., hereby disclaims all copyright interest in the program |
`Gnomovision' (which makes passes at compilers) written by James Hacker. |
<signature of Ty Coon>, 1 April 1989 |
Ty Coon, President of Vice |
This General Public License does not permit incorporating your program into |
proprietary programs. If your program is a subroutine library, you may |
consider it more useful to permit linking proprietary applications with the |
library. If this is what you want to do, use the GNU Library General |
Public License instead of this License. |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/bluetooth/.directory |
---|
0,0 → 1,3 |
[Dolphin] |
Timestamp=2012,12,28,23,42,17 |
ViewMode=1 |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/bluetooth/bluetooth.c |
---|
0,0 → 1,1793 |
/** |
* source for the Bluetooth driver |
* @file bluetooth.c |
* @author Linus Lotz<lotz@in.tum.de> |
* @author Salomon Sickert |
*/ |
//2013 Cebra, Erweiterung um BT Local-ID Abfrage |
#include <string.h> |
#include "../cpu.h" |
#define __DELAY_BACKWARD_COMPATIBLE__ |
#include <util/delay.h> |
#include <avr/interrupt.h> |
#include <avr/pgmspace.h> |
#include <stdlib.h> |
#include "bluetooth.h" |
#include "../main.h" |
#ifdef HWVERSION3_9 |
#include "../uart/uart1.h" |
#include "../uart/usart.h" |
#include "../timer/timer.h" |
#include "fifo.h" |
#include "error.h" |
#include "../lcd/lcd.h" |
#include "../eeprom/eeprom.h" |
#include "../setup/setup.h" |
#include "bluetooth.h" |
#include "../tracking/tracking.h" |
//#define SaveMem |
// |
// Baudrate for the UART-connection to the BTM-222 on SQUIRREL |
// |
#define SQUIRREL |
#ifdef SQUIRREL |
#define UART_BAUD_RATE 19200 |
#endif |
#ifdef NUT |
#define UART_BAUD_RATE 19200 |
#endif |
typedef enum { |
BT_RAW, |
BT_DATA, |
BT_CMD, |
BT_NOECHO, |
BT_NOANSWER |
} communication_mode_t; |
#define BT_CMD_TIMEOUT_MS 2000 |
typedef enum { |
BT_TEST, // AT |
BT_CONNECT, // ATA |
BT_DISCONNECT, // ATH |
BT_CLEAR_ADDRESS, // ATD0 |
BT_SET_ADDRESS, // ATD=_____ |
BT_GET_LOCALID, // ATB? Inquire the Local BD address |
BT_FIND_DEVICES, // ATF? |
BT_DISABLE_AUTOCONNECT, // ATO1 |
BT_ENABLE_AUTOCONNECT, // ATO0 |
BT_SET_MASTER, // ATR0 |
BT_SET_SLAVE, // ATR1 |
BT_SET_PIN, // ATP=1234 |
BT_SET_2400, // ATL* Baudrate 2400 |
BT_SET_4800, // ATL0 Baudrate 4800 |
BT_SET_9600, // ATL1 Baudrate 9600 |
BT_SET_19200, // ATL2 Baudrate 19200 |
BT_SET_38400, // ATL3 Baudrate 38400 |
BT_SET_57600, // ATL4 Baudrate 57600 |
BT_SET_115200, // ATL5 Baudrate 115200 |
BT_SET_NOANSWER, // ATQ1 Rückmeldungen aus |
BT_SET_NOECHO, // ATE0 ECHO deaktivieren |
BT_SET_ANSWER, // ATQ0 Rückmeldungen |
BT_SET_ECHO, // ATE1 ECHO aktivieren |
BT_SET_DEFAULT, // Defaultwerte setzen |
BT_SET_NAME, // Devicename |
BT_SET_DISPWRDOWN // disable auto Powerdown |
} bt_cmd_t; |
//TODO: FIFO Grösse |
#define IN_FIFO_SIZE 512 |
char localID[15]="12345678901234"; |
static uint8_t bt_buffer[IN_FIFO_SIZE]; |
static fifo_t in_fifo; |
char bt_rx_buffer[RXD_BUFFER_SIZE]; |
volatile uint8_t bt_rx_len; |
volatile uint8_t bt_rx_ready = 0; |
uint8_t rx_GPS; |
static char start = '$'; |
static char end = '\n'; |
char data_decode[RXD_BUFFER_SIZE]; |
volatile uint16_t rx_timeout; |
uint8_t EchoAnswerOn; //Merkzelle |
static bt_mode_t bt_mode = BLUETOOTH_SLAVE; |
static communication_mode_t comm_mode = BT_CMD; |
uint8_t i = 0; |
//uint8_t NoEcho = 0; |
//uint8_t NoAnswer = 0; |
uint8_t bt_devicecount = 0; |
uint8_t bt_rxerror = 0; |
device_info device_list[NUTS_LIST]; |
uint8_t BT_New_Baudrate = 0; //Merkzelle für zu setzende Baudrate |
// Set a timeout of Y ms and a Conditon X, which have to be true while timeout |
#define while_timeout(X, Y) for(uint16_t __timeout = 0; __timeout++ <= Y && (X); Delay_MS(Y ? 1 : 0)) |
//-------------------------------------------------------------- |
void Delay_MS(int count) |
{ |
for (int i = 0; i < count; i++) |
_delay_ms(1); |
} |
void bt_start(void) |
{ |
if (Config.BTIsSlave == true) EchoAnswerOn = false; else EchoAnswerOn = true; |
} |
//-------------------------------------------------------------- |
void uart_receive(void) |
{ |
unsigned int uart_data; |
while (!fifo_is_full(&in_fifo)) |
{ |
uart_data = uart1_getc(); |
// USART_puts("."); |
switch (uart_data & 0xFF00) { |
// Framing Error detected, i.e no stop bit detected |
case UART_FRAME_ERROR: |
#ifdef DEBUG |
warn_pgm(PSTR("FRM ERR")); |
#endif |
bt_rxerror++; |
return; |
// Overrun, a character already presend in the UART UDR register was |
// not read by the interrupt handler before the next character arrived, |
// one or more received characters have been dropped |
// |
case UART_OVERRUN_ERROR: |
#ifdef DEBUG |
warn_pgm(PSTR("OVR ERR")); |
#endif |
bt_rxerror++; |
return; |
// We are not reading the receive buffer fast enough, |
// one or more received character have been dropped |
// |
case UART_BUFFER_OVERFLOW: |
#ifdef DEBUG |
warn_pgm(PSTR("BUF ERR")); |
#endif |
bt_rxerror++; |
return; |
// UART Inputbuffer empty, nothing to do |
case UART_NO_DATA: |
return; |
default: |
{ |
fifo_write(&in_fifo, uart_data); |
#ifdef DEBUG |
USART_putc(uart_data); |
#endif |
} |
} |
} |
#ifdef DEBUG |
warn_pgm(PSTR("FIFO OVR ERR")); |
#endif |
} |
//-------------------------------------------------------------- |
static void uart_send(const char *data, const uint8_t length) |
{ |
#ifdef SND_DEBUG |
debug_pgm(PSTR("bt_uart_send")); |
if (comm_mode == BT_CMD) debug_pgm(PSTR("bt_uart_send:BT_CMD")); else debug_pgm(PSTR("bt_uart_send:Wrong comm-mode")); |
if (EchoAnswerOn == true) debug_pgm(PSTR("bt_uart_send:EchoAnswer ON")); else debug_pgm(PSTR("bt_uart_send:EchoAnswer OFF")); |
#endif |
char echo; |
// lcd_printp_at (i++, 1, PSTR("."), 0); |
for (uint8_t i = 0; i < length; i++) |
{ |
#ifdef SND_DEBUG |
USART_putc((data[i])); //test |
#endif |
// debug_pgm(PSTR("bt_init_S")); |
if (uart1_putc(data[i]) == 0) |
{ |
#ifdef SND_DEBUG |
warn_pgm(PSTR("UART: Remote not ready")); |
#endif |
return; |
} |
if (comm_mode == BT_RAW) |
_delay_ms(50); |
if (comm_mode == BT_DATA) |
_delay_ms(1); |
if ((comm_mode == BT_CMD) && (EchoAnswerOn == true)) |
{ |
#ifdef SND_DEBUG |
warn_pgm(PSTR ("UARTsend: get Echo")); |
#endif |
uint8_t x = 0; |
for (; x < 3; x++) |
{ |
while_timeout(fifo_is_empty(&in_fifo), 200) |
// for(uint16_t __timeout = 0; __timeout++ <= 200 && (fifo_is_empty(&in_fifo)); _delay_ms(200 ? 1 : 0)) |
uart_receive(); |
fifo_read(&in_fifo, &echo); |
if (echo != data[i]) { |
if (uart1_putc(data[i]) == 0) |
{ |
#ifdef SND_DEBUG |
warn_pgm(PSTR ("UART: Remote not ready")); |
#endif |
return; |
} |
} |
else |
break; |
} |
if (x == 3) |
{ |
error_putc(data[i]); |
#ifdef DEBUG |
error_pgm(PSTR("BT: WRONG ECHO")); |
//_delay_ms(2000); |
#endif |
} |
} |
else |
{ |
for(uint16_t __timeout = 0; __timeout++ <= 200 && (fifo_is_empty(&in_fifo)); _delay_ms(200 ? 1 : 0)) |
{ |
uart_receive(); |
} |
fifo_read(&in_fifo, &echo); |
#ifdef SND_DEBUG |
warn_pgm(PSTR ("UARTsend: skip Echo")); |
#endif |
} |
} |
} |
//-------------------------------------------------------------- |
static uint16_t send_cmd(const bt_cmd_t command, const char *data) |
{ |
uint16_t CommandDelay=0; // nach BTM222 Kommandos verschiedene Verzögerungszeiten bevor es weitergehen kann |
// _delay_ms(500); // org 500 300 zu wenig |
char full_command[20]; // Maximum command size |
switch (command) |
{ |
case BT_SET_PIN: |
strcpy_P(full_command, PSTR("ATP=")); |
for (uint8_t i = 0; i < bt_pin_length; i++) |
{ |
full_command[i+4] = Config.bt_pin[i]; |
} |
full_command[(bt_pin_length+4)] =0; |
CommandDelay = 100; //100ms |
break; |
case BT_SET_DEFAULT: |
strcpy_P(full_command, PSTR("ATZ0")); |
CommandDelay = 1000; |
break; |
case BT_SET_2400: |
strcpy_P(full_command, PSTR("ATL*")); |
CommandDelay = 100; |
#ifdef DEBUG |
debug_pgm(PSTR("ATL*")); |
#endif |
break; |
case BT_SET_4800: |
strcpy_P(full_command, PSTR("ATL0")); |
CommandDelay = 100; |
#ifdef DEBUG |
debug_pgm(PSTR("ATL0")); |
#endif |
break; |
case BT_SET_9600: |
strcpy_P(full_command, PSTR("ATL1")); |
CommandDelay = 100; |
#ifdef DEBUG |
debug_pgm(PSTR("ATL1")); |
#endif |
break; |
case BT_SET_19200: |
strcpy_P(full_command, PSTR("ATL2")); |
CommandDelay = 100; |
#ifdef DEBUG |
debug_pgm(PSTR("ATL2")); |
#endif |
break; |
case BT_SET_38400: |
strcpy_P(full_command, PSTR("ATL3")); |
CommandDelay = 100; |
#ifdef DEBUG |
debug_pgm(PSTR("ATL3")); |
#endif |
break; |
case BT_SET_57600: |
strcpy_P(full_command, PSTR("ATL4")); |
CommandDelay = 100; |
#ifdef DEBUG |
debug_pgm(PSTR("ATL4")); |
#endif |
break; |
case BT_SET_115200: |
strcpy_P(full_command, PSTR("ATL5")); |
CommandDelay = 100; |
#ifdef DEBUG |
debug_pgm(PSTR("ATL5")); |
#endif |
break; |
case BT_SET_NOANSWER: |
strcpy_P(full_command, PSTR("ATQ1")); |
CommandDelay = 100; |
#ifdef DEBUG |
debug_pgm(PSTR("ATQ1")); |
#endif |
break; |
case BT_SET_NOECHO: |
strcpy_P(full_command, PSTR("ATE0")); |
CommandDelay = 100; |
#ifdef DEBUG |
debug_pgm(PSTR("ATE0")); |
#endif |
break; |
case BT_SET_ANSWER: |
strcpy_P(full_command, PSTR("ATQ0")); |
CommandDelay = 100; |
#ifdef DEBUG |
debug_pgm(PSTR("ATQ0")); |
#endif |
break; |
case BT_SET_ECHO: |
strcpy_P(full_command, PSTR("ATE1")); |
CommandDelay = 100; |
#ifdef DEBUG |
debug_pgm(PSTR("ATE1")); |
#endif |
break; |
case BT_TEST: |
strcpy_P(full_command, PSTR("AT")); |
CommandDelay = 100; |
#ifdef DEBUG |
debug_pgm(PSTR("AT")); |
#endif |
break; |
case BT_CONNECT: |
strcpy_P(full_command, PSTR("ATA")); |
CommandDelay = 100; |
#ifdef DEBUG |
debug_pgm(PSTR("ATA")); |
#endif |
break; |
case BT_DISCONNECT: |
strcpy_P(full_command, PSTR("ATH")); |
CommandDelay = 100; |
#ifdef DEBUG |
debug_pgm(PSTR("ATH")); |
#endif |
break; |
case BT_CLEAR_ADDRESS: |
strcpy_P(full_command, PSTR("ATD0")); |
CommandDelay = 100; |
break; |
case BT_SET_ADDRESS: |
strcpy_P(full_command, PSTR("ATD=")); |
memcpy((full_command + strlen(full_command)), data, 12); |
full_command[16] = 0; |
CommandDelay = 100; |
#ifdef DEBUG |
debug_pgm(PSTR("ATLD=")); |
#endif |
break; |
case BT_FIND_DEVICES: |
strcpy_P(full_command, PSTR("ATF?")); |
CommandDelay = 100; |
#ifdef DEBUG |
debug_pgm(PSTR("ATF?")); |
#endif |
break; |
case BT_DISABLE_AUTOCONNECT: |
strcpy_P(full_command, PSTR("ATO1")); |
CommandDelay = 3500; |
#ifdef DEBUG |
debug_pgm(PSTR("ATO1")); |
#endif |
break; |
case BT_ENABLE_AUTOCONNECT: |
strcpy_P(full_command, PSTR("ATO0")); |
CommandDelay = 3500; |
#ifdef DEBUG |
debug_pgm(PSTR("ATO0")); |
#endif |
break; |
case BT_SET_MASTER: |
strcpy_P(full_command, PSTR("ATR0")); |
CommandDelay = 3000; |
#ifdef DEBUG |
debug_pgm(PSTR("ATR0")); |
#endif |
break; |
case BT_SET_SLAVE: |
strcpy_P(full_command, PSTR("ATR1")); |
CommandDelay = 3000; |
#ifdef DEBUG |
debug_pgm(PSTR("ATR1")); |
#endif |
break; |
case BT_SET_NAME: |
strcpy_P(full_command, PSTR("ATN=")); |
for (uint8_t i = 0; i < bt_name_len; i++) |
{ |
full_command[i + 4] = Config.bt_name[i]; |
} |
full_command[(bt_name_len + 4)] = 0; |
CommandDelay = 100; |
#ifdef DEBUG |
debug_pgm(PSTR("ATN=")); |
#endif |
break; |
case BT_SET_DISPWRDOWN: |
strcpy_P(full_command, PSTR("ATS1")); |
CommandDelay = 100; |
#ifdef DEBUG |
debug_pgm(PSTR("ATS1")); |
#endif |
break; |
case BT_GET_LOCALID: |
strcpy_P(full_command, PSTR("ATB?")); |
CommandDelay = 100; |
#ifdef DEBUG |
debug_pgm(PSTR("ATB?")); |
#endif |
break; |
default: |
warn_pgm(PSTR("CMD UNK")); |
return false; |
} |
strcat_P(full_command, PSTR("\r")); |
// throw away your television |
uart_receive(); |
fifo_clear(&in_fifo); |
// debug_pgm(PSTR("bt_init3, send command")); |
// send command |
uart_send(full_command, strlen(full_command)); |
//TODO: hier ist ein Fehler bei den Bedingungen |
// if (command == (BT_SET_NOECHO||BT_SET_NOANSWER||BT_SET_ECHO||BT_SET_ANSWER)) |
// { |
// uart_receive(); |
// fifo_clear(&in_fifo); |
// _delay_ms(CommandDelay); |
//#ifdef DEBUG |
// debug_pgm(PSTR("send_cmd: Echo Answer no Response")); |
//#endif |
//// return true; |
// |
// } |
// else |
{ |
// get response |
#ifdef DEBUG |
debug_pgm(PSTR("send_cmd:get Response")); |
#endif |
while_timeout(true, BT_CMD_TIMEOUT_MS) |
{ |
uart_receive(); |
if (command== BT_GET_LOCALID) |
{ |
_delay_ms(CommandDelay); |
return bt_getID(); |
} |
if (fifo_strstr_pgm(&in_fifo, PSTR("OK\r\n"))) |
{ |
info_pgm(PSTR("CMD SEND: OK")); |
_delay_ms(CommandDelay); |
return true; |
} |
if (fifo_strstr_pgm(&in_fifo, PSTR("ERROR\r\n"))) |
{ |
#ifdef DEBUG |
info_pgm(PSTR("CMD SEND: Error")); |
_delay_ms(2000); |
#endif |
return false; |
} |
} |
} |
//#ifdef DEBUG |
// if (command != BT_TEST) |
// warn_pgm(PSTR("CMD SEND: TIMEOUT")); |
// _delay_ms(2000); |
//#endif |
return false; |
} |
//bt_init |
//-------------------------------------------------------------- |
//void test(void) |
//{ |
// comm_mode = BT_RAW; |
// for (uint8_t i = 0; i < 2; i++) |
// if (send_cmd(BT_TEST, NULL)) |
// break; |
// comm_mode = BT_CMD; |
//} |
#ifndef SaveMem |
//-------------------------------------------------------------- |
static void clean_line(void) |
{ |
while_timeout(true, 50) |
uart_receive(); |
fifo_strstr_pgm(&in_fifo, PSTR("\r\n")); |
} |
static communication_mode_t update_comm_mode(uint16_t timeout_ms) |
{ |
while_timeout(true, timeout_ms) |
// for(uint16_t __timeout = 0; __timeout++ <= true && (timeout_ms); _delay_ms(true ? 1 : 0)) |
{ |
uart_receive(); |
if (fifo_strstr_pgm(&in_fifo, PSTR("DISCONNECT"))) |
{ |
clean_line(); |
// test(); |
comm_mode = BT_CMD; |
send_cmd(BT_TEST, NULL); |
return comm_mode; |
} |
if (fifo_strstr_pgm(&in_fifo, PSTR("CONNECT"))) |
{ |
_delay_ms(100); //don't delete this, else there will be no success!!!!!!!!! |
comm_mode = BT_DATA; |
return comm_mode; |
} |
if (fifo_strstr_pgm (&in_fifo, PSTR("Time out,Fail to connect!"))) |
{ |
clean_line(); |
#ifdef DEBUG |
debug_pgm(PSTR("CONNECT FAILED\n")); |
#endif |
// test(); |
send_cmd(BT_TEST, NULL); |
comm_mode = BT_CMD; |
return comm_mode; |
} |
} |
return comm_mode; |
} |
#endif |
//-------------------------------------------------------------- |
uint16_t bt_setbaud(uint8_t baudrate) |
{ |
uint8_t init_error = false; |
uint8_t BT_found = 0; |
i = 0; |
// set_BTOn(); |
lcd_cls(); |
lcd_printp_at (0, 0, PSTR("BT set new Baudrate.."), 0); |
SetBaudUart1(Old_Baudrate); |
fifo_init(&in_fifo, bt_buffer, IN_FIFO_SIZE); |
_delay_ms(100); |
fifo_clear(&in_fifo); |
// send_cmd(BT_TEST, NULL); |
// comm_mode = BT_NOECHO; |
// send_cmd(BT_SET_ECHO, NULL); |
// send_cmd(BT_SET_ANSWER, NULL); |
bt_set_EchoAnswer(true); |
#ifdef DEBUG |
debug_pgm(PSTR("Check with PKT Baudrate")); |
#endif |
if (send_cmd(BT_TEST, NULL)) // Test mit PKT_Baudrate |
{ |
#ifdef DEBUG |
debug_pgm(PSTR("BT found with PKT Baudrate")); |
#endif |
BT_found = 1; |
} |
if (BT_found == 0) |
{ |
lcd_printp_at (0, 1, PSTR("Error1 set Baudrate.."), 0); |
_delay_ms(2100); |
set_BTOff(); |
return false; |
} |
else |
{ |
/* Set comm_mode to CMD */ |
comm_mode = BT_CMD; |
switch (baudrate) |
{ |
// case Baud_2400 : { /* Set BTM Baudrate */ |
// if (!(send_cmd(BT_SET_2400, NULL))) init_error = true; |
// SetBaudUart1(Baud_2400); |
// _delay_ms(100); |
// break; |
// } |
case Baud_4800 : { /* Set BTM Baudrate */ |
if (!(send_cmd(BT_SET_4800, NULL))) init_error = true; |
SetBaudUart1(Baud_4800); |
_delay_ms(100); |
break; |
} |
case Baud_9600 : { /* Set BTM Baudrate */ |
if (!(send_cmd(BT_SET_9600, NULL))) init_error = true; |
SetBaudUart1(Baud_9600); |
_delay_ms(100); |
break; |
} |
case Baud_19200 : { /* Set BTM Baudrate */ |
if (!(send_cmd(BT_SET_19200, NULL))) init_error = true; |
SetBaudUart1(Baud_19200); |
_delay_ms(100); |
break; |
} |
case Baud_38400 : { /* Set BTM Baudrate */ |
if (!(send_cmd(BT_SET_38400, NULL))) init_error = true; |
SetBaudUart1(Baud_38400); |
_delay_ms(100); |
break; |
} |
case Baud_57600 : { /* Set BTM Baudrate */ |
if (!(send_cmd(BT_SET_57600, NULL))) init_error = true; |
SetBaudUart1(Baud_57600); |
_delay_ms(100); |
break; |
} |
case Baud_115200 : { /* Set BTM Baudrate */ |
if (!(send_cmd(BT_SET_115200, NULL))) init_error = true; |
SetBaudUart1(Baud_115200); |
_delay_ms(100); |
break; |
} |
break; |
} |
// /* Set BTM Echo aus */ |
// send_cmd(BT_SET_NOECHO, NULL); |
//// test(); |
// comm_mode = BT_NOECHO; |
// /* Set BTM Answer aus */ |
// send_cmd(BT_SET_NOANSWER, NULL); |
//// test(); |
bt_set_EchoAnswer(false); |
bt_mode = BLUETOOTH_SLAVE; |
// set_BTOff(); |
if (!init_error) |
{ |
lcd_printp_at (0, 2, PSTR("set Baudrate ok"), 0); |
_delay_ms(2100); |
return true; |
} |
else |
{ |
lcd_printp_at (0, 2, PSTR("set Baudrate Error"), 0); |
_delay_ms(2100); |
return true; |
} |
} |
} |
void bt_set_EchoAnswer (uint8_t onoff) |
{ |
if (onoff == true) |
{ |
// if (EchoAnswerOn==false) |
// { |
/* Set comm_mode to CMD */ |
comm_mode = BT_CMD; |
send_cmd(BT_SET_ECHO, NULL); |
send_cmd(BT_SET_ANSWER, NULL); |
EchoAnswerOn = true; |
send_cmd(BT_TEST, NULL); |
// fifo_clear(&in_fifo); |
// } |
#ifdef DEBUG |
debug_pgm(PSTR("bt_set_EchoAnswer: on")); |
#endif |
} |
else |
{ |
// if (EchoAnswerOn==true) |
// { |
/* Set comm_mode to CMD */ |
comm_mode = BT_CMD; |
EchoAnswerOn = false; |
send_cmd(BT_SET_NOECHO, NULL); |
send_cmd(BT_SET_NOANSWER, NULL); |
// fifo_clear(&in_fifo); |
// } |
#ifdef DEBUG |
debug_pgm(PSTR("bt_set_EchoAnswer: off")); |
#endif |
} |
} |
//-------------------------------------------------------------- |
uint16_t bt_init(void) |
{ |
uint8_t init_error = false; |
uint8_t BT_found = 0; |
i = 0; |
set_BTOn(); |
lcd_cls(); |
lcd_printp_at (0, 0, PSTR("BT initialisieren.."), 0); |
// _delay_ms(200); |
for (uint8_t z = (bt_name_length); z > 0; z--) |
{ |
if (Config.bt_name[z - 1] != ' ') |
{ |
bt_name_len = z; |
break; |
} |
} |
// uart1_init(UART_BAUD_SELECT(57600, F_CPU)); |
SetBaudUart1(Config.PKT_Baudrate); |
fifo_init(&in_fifo, bt_buffer, IN_FIFO_SIZE); |
_delay_ms(100); |
// debug_pgm(PSTR("bt_init")); |
uart_receive(); |
// debug_pgm(PSTR("bt_init1")); |
fifo_clear(&in_fifo); |
bt_disconnect(); |
bt_set_EchoAnswer(true); |
// debug_pgm(PSTR("bt_init2")); |
#ifdef DEBUG |
debug_pgm(PSTR("Check with PKT Baudrate")); |
#endif |
send_cmd(BT_TEST, NULL); // Schrott löschen |
send_cmd(BT_TEST, NULL); // Schrott löschen |
if (send_cmd(BT_TEST, NULL)) // Test mit 57600 |
{ |
#ifdef DEBUG |
debug_pgm(PSTR("BT found with PKT Baudrate")); |
#endif |
BT_found = 1; |
} |
if (BT_found == 0) |
{ |
#ifdef DEBUG |
debug_pgm(PSTR("Check with 19200")); |
#endif |
// uart1_init(UART_BAUD_SELECT(19200, F_CPU));// Test mit 19200 |
SetBaudUart1(Baud_19200); |
// _delay_ms(100); |
send_cmd(BT_TEST, NULL); // Schrott löschen |
send_cmd(BT_TEST, NULL); // Schrott löschen |
bt_set_EchoAnswer(true); |
if (send_cmd(BT_TEST, NULL)) |
{ |
#ifdef DEBUG |
debug_pgm(PSTR("19200 OK")); |
#endif |
if (send_cmd(BT_TEST, NULL)) |
{ |
#ifdef DEBUG |
debug_pgm(PSTR("BT found 19200 Baud")); |
#endif |
Old_Baudrate = Baud_19200; |
BT_found = 2; |
} |
} |
} |
if (BT_found == 0) |
{ |
#ifdef DEBUG |
debug_pgm(PSTR("Check with 38400")); |
#endif |
// uart1_init(UART_BAUD_SELECT(19200, F_CPU));// Test mit 19200 |
SetBaudUart1(Baud_38400); |
// _delay_ms(100); |
send_cmd(BT_TEST, NULL); // Schrott löschen |
// comm_mode = BT_NOECHO; |
// send_cmd(BT_SET_ECHO, NULL); |
// comm_mode = BT_NOANSWER; |
// send_cmd(BT_SET_ANSWER, NULL); |
// comm_mode = BT_CMD; |
bt_set_EchoAnswer(true); |
if (send_cmd(BT_TEST, NULL)) |
{ |
#ifdef DEBUG |
debug_pgm(PSTR("38400 OK")); |
#endif |
if (send_cmd(BT_TEST, NULL)) |
{ |
#ifdef DEBUG |
debug_pgm(PSTR("BT found 38400 Baud")); |
#endif |
Old_Baudrate = Baud_38400; |
BT_found = 2; |
} |
} |
} |
if (BT_found == 0) |
{ |
#ifdef DEBUG |
debug_pgm(PSTR("Check with 9600")); |
#endif |
// uart1_init(UART_BAUD_SELECT(9600, F_CPU));//test mit 9600 |
SetBaudUart1(Baud_9600); |
// _delay_ms(100); |
send_cmd(BT_TEST, NULL); |
// comm_mode = BT_NOECHO; |
// send_cmd(BT_SET_ECHO, NULL); |
// comm_mode = BT_NOANSWER; |
// send_cmd(BT_SET_ANSWER, NULL); |
// comm_mode = BT_CMD; |
bt_set_EchoAnswer(true); |
if (send_cmd(BT_TEST, NULL)); |
{ |
#ifdef DEBUG |
debug_pgm(PSTR("9600 OK")); |
#endif |
if (send_cmd(BT_TEST, NULL)) |
{ |
#ifdef DEBUG |
debug_pgm(PSTR("BT found 9600 Baud")); |
#endif |
Old_Baudrate = Baud_9600; |
BT_found = 3; |
} |
} |
} |
if (BT_found == 0) |
{ |
#ifdef DEBUG |
debug_pgm(PSTR("Check with 57600")); |
#endif |
// uart1_init(UART_BAUD_SELECT(9600, F_CPU));//test mit 9600 |
SetBaudUart1(Baud_57600); |
// _delay_ms(100); |
send_cmd(BT_TEST, NULL); |
// comm_mode = BT_NOECHO; |
// send_cmd(BT_SET_ECHO, NULL); |
// comm_mode = BT_NOANSWER; |
// send_cmd(BT_SET_ANSWER, NULL); |
// comm_mode = BT_CMD; |
bt_set_EchoAnswer(true); |
if (send_cmd(BT_TEST, NULL)); |
{ |
#ifdef DEBUG |
debug_pgm(PSTR("57600 OK")); |
#endif |
if (send_cmd(BT_TEST, NULL)) |
{ |
#ifdef DEBUG |
debug_pgm(PSTR("BT found 57600 Baud")); |
#endif |
Old_Baudrate = Baud_57600; |
BT_found = 4; |
} |
} |
} |
if (BT_found == 0) |
{ |
#ifdef DEBUG |
debug_pgm(PSTR("Check with 4800")); |
#endif |
// uart1_init(UART_BAUD_SELECT(4800, F_CPU));//test mit 4800 |
SetBaudUart1(Baud_4800); |
// _delay_ms(100); |
send_cmd(BT_TEST, NULL); |
// comm_mode = BT_NOECHO; |
// send_cmd(BT_SET_ECHO, NULL); |
// comm_mode = BT_NOANSWER; |
// send_cmd(BT_SET_ANSWER, NULL); |
// comm_mode = BT_CMD; |
bt_set_EchoAnswer(true); |
if (send_cmd(BT_TEST, NULL)); |
{ |
#ifdef DEBUG |
debug_pgm(PSTR("4800 OK")); |
#endif |
if (send_cmd(BT_TEST, NULL)) |
{ |
#ifdef DEBUG |
debug_pgm(PSTR("BT found 4800 Baud")); |
#endif |
Old_Baudrate = Baud_4800; |
BT_found = 5; |
} |
} |
} |
if (BT_found > 0) |
{ |
#ifdef DEBUG |
debug_pgm(PSTR("BT found !")); |
#endif |
/* Set comm_mode to CMD */ |
comm_mode = BT_CMD; |
// test(); |
// if (BTIsSlave==false) |
// { |
// fifo_init(&in_fifo, bt_buffer, IN_FIFO_SIZE); |
_delay_ms(100); |
// test(); |
/* Clear remote address */ |
if(!(send_cmd(BT_CLEAR_ADDRESS, NULL))) |
init_error = true; |
// test(); |
/* Set BTM to SLAVE */ |
if (!(send_cmd(BT_SET_SLAVE, NULL))) |
init_error = true; |
// test(); |
/* Set BTM PIN */ |
if(!(send_cmd(BT_SET_PIN, NULL))) |
init_error = true; |
// test(); |
/* Set BTM Name */ |
if(!(send_cmd(BT_SET_NAME, NULL))) |
init_error = true; |
_delay_ms(300); |
// test(); |
if(!(send_cmd(BT_SET_DISPWRDOWN, NULL))) |
init_error = true; |
if(!(send_cmd(BT_GET_LOCALID, NULL))) |
init_error = true; |
// } |
/* Set BTM Baudrate */ |
// if (!(send_cmd(BT_SET_57600, NULL))) |
// init_error = true; |
if (!bt_setbaud(Config.PKT_Baudrate)) init_error = true; |
// uart1_init(UART_BAUD_SELECT(57600, F_CPU)); |
SetBaudUart1(Config.PKT_Baudrate); |
// /* Set BTM Echo aus */ |
// send_cmd(BT_SET_NOECHO, NULL); |
//// test(); |
// comm_mode = BT_NOECHO; |
// /* Set BTM Answer aus */ |
// send_cmd(BT_SET_NOANSWER, NULL); |
//// test(); |
bt_set_EchoAnswer (false); |
bt_mode = BLUETOOTH_SLAVE; |
set_BTOff(); |
if (!init_error) |
{ |
WriteBTInitFlag(); // Init merken |
WriteBTSlaveFlag(); |
bt_start(); |
return true; |
} |
else |
return false; |
} |
else |
{ |
set_BTOff(); |
return false; |
} |
} |
#ifndef SaveMem |
//-------------------------------------------------------------- |
uint8_t bt_set_mode(const bt_mode_t mode) |
{ |
#ifdef DEBUG |
debug_pgm(PSTR("bt_setmode: set Mode")); |
#endif |
// if (update_comm_mode(0) == BT_DATA) // 30.1.2012 CB |
// return false; |
if (mode == bt_mode) |
return true; |
if (mode == BLUETOOTH_MASTER) |
{ |
comm_mode = BT_CMD; |
bt_set_EchoAnswer(true); |
// _delay_ms(1000); |
if (send_cmd(BT_SET_MASTER, NULL)) |
{ |
bt_mode = BLUETOOTH_MASTER; |
send_cmd(BT_DISABLE_AUTOCONNECT, NULL); |
WriteBTMasterFlag(); |
#ifdef DEBUG |
debug_pgm(PSTR("bt_setmode: Master is set")); |
#endif |
} |
} |
if (mode == BLUETOOTH_SLAVE) |
{ |
comm_mode = BT_CMD; |
bt_set_EchoAnswer(true); |
if (send_cmd(BT_ENABLE_AUTOCONNECT, NULL)) |
{ |
bt_mode = BLUETOOTH_SLAVE; |
send_cmd(BT_SET_SLAVE, NULL); |
WriteBTSlaveFlag(); |
bt_set_EchoAnswer(false); |
comm_mode = BT_CMD; |
#ifdef DEBUG |
debug_pgm(PSTR("bt_setmode: Slave is set")); |
#endif |
} |
} |
// if (bt_mode == BLUETOOTH_MASTER) debug_pgm(PSTR("bt_mode:BLUETOOTH_MASTER ")); |
// if (bt_mode == BLUETOOTH_SLAVE) debug_pgm(PSTR("bt_mode:BLUETOOTH_SLAVE")); |
// if (mode == BLUETOOTH_MASTER) debug_pgm(PSTR("mode:BLUETOOTH_MASTER ")); |
// if (mode == BLUETOOTH_SLAVE) debug_pgm(PSTR("mode:BLUETOOTH_SLAVE")); |
return (mode == bt_mode); |
} |
//-------------------------------------------------------------- |
uint16_t bt_receive(void *data, uint8_t length, uint16_t timeout_ms) |
{ |
uint8_t rec_length = 0; |
uint8_t i = 0; |
// while_timeout(true, timeout_ms); |
for(uint16_t __timeout = 0; __timeout++ <= true && (timeout_ms); _delay_ms(true ? 1 : 0)) |
{ |
if (i == length) |
return true; |
uart_receive(); |
if (fifo_is_empty(&in_fifo)) |
continue; |
if (update_comm_mode(0) != BT_DATA) |
{ |
#ifdef DEBUG |
debug_pgm(PSTR("not connected")); |
#endif |
return false; |
} |
// We have a connection |
if (timeout_ms == 0) |
timeout_ms += 2000; |
if (fifo_is_empty(&in_fifo)) |
continue; |
// Find starting point of packet |
if (!rec_length) |
{ |
fifo_read(&in_fifo, (char *)&rec_length); |
if (rec_length != length) |
{ |
rec_length = 0; |
} |
else |
{ |
// You've got mail! |
timeout_ms += 2000; |
} |
} |
else |
{ |
fifo_read(&in_fifo, (char *)data + i); |
i++; |
} |
} |
return false; |
} |
#endif |
#ifndef SaveMem |
//-------------------------------------------------------------- |
uint16_t bt_send(void *data, const uint8_t length) |
{ |
if (update_comm_mode(0) == BT_CMD) |
return false; |
uart_send((const char *)&length, 1); |
uart_send((char *)data, length); |
return (update_comm_mode(0) == BT_DATA); |
} |
#ifdef SQUIRREL |
//-------------------------------------------------------------- |
uint16_t bt_connect(const char *address) |
{ |
fifo_init(&in_fifo, bt_buffer, IN_FIFO_SIZE); |
uart_receive(); |
fifo_clear(&in_fifo); |
// Maybe we already disconnected??? |
if (BT_DATA == update_comm_mode(0)) |
{ |
#ifdef DEBUG |
debug_pgm(PSTR("We are still connected...")); |
#endif |
return false; |
} |
// test(); |
send_cmd(BT_TEST, NULL); |
/* |
if (!send_cmd(BT_DISABLE_AUTOCONNECT, address)) |
return false; |
*/ |
// Test(); |
send_cmd(BT_TEST, NULL); |
#ifdef DEBUG |
debug_pgm (PSTR ("SET_ADD")); |
#endif |
if (!send_cmd(BT_SET_ADDRESS, address)) |
return false; |
// test(); |
send_cmd(BT_TEST, NULL); |
#ifdef DEBUG |
debug_pgm (PSTR ("CONNECT")); |
#endif |
if (!send_cmd(BT_CONNECT, NULL)) |
return false; |
#ifdef DEBUG |
debug_pgm (PSTR ("WAIT FOR COMM")); |
#endif |
return (BT_DATA == update_comm_mode(20000)); |
} |
//-------------------------------------------------------------- |
uint16_t bt_disconnect(void) |
{ |
if (BT_CMD == update_comm_mode(0)) |
{ |
fifo_clear(&in_fifo); |
return true; |
} |
// Switch to online cmd mode |
for (uint8_t i = 0; i < 4; i++) |
{ |
const char plus = '+'; |
uart_send(&plus, 1); |
_delay_ms(1000); |
} |
comm_mode = BT_CMD; |
if (!send_cmd(BT_DISCONNECT, NULL)) |
return false; |
// test(); |
if (!send_cmd(BT_CLEAR_ADDRESS, NULL)) |
return false; |
// test(); |
if (BT_CMD == update_comm_mode(10000)) |
{ |
fifo_clear(&in_fifo); |
return true; |
} |
#ifdef DEBUG |
debug_pgm(PSTR("Still in DATA??")); |
#endif |
return false; |
} |
/* |
BTM-222 Softwareversion 4.35 |
Inquiry Results: |
111111111222222222233333333334 |
01234567890123456789012345678901234567890 |
1 LE091452 0024-2C-BEB0CA |
2 E71 c 0024-7C-3EC9B9 |
BTM-222 Softwareversion 6.26 |
Inquiry Results: |
1 E71 c 0024-7C-3EC9B9 N.A. |
2 LE091452 0024-2C-BEB0CA N.A. |
*/ |
//-------------------------------------------------------------- |
void copy_mac(const char *src, char *dst) |
{ |
uint8_t off = 0; |
for (uint8_t i = 0; i < 40; i++) |
{ |
if (src[i] == '-') if (src[i+3] == '-')// MAC Adresse suchen |
{ |
off = i-4; |
break; |
} |
} |
for (uint8_t i = 0; i < 14; i++) |
{ |
if (src[i + off] == '-') |
off++; |
dst[i] = src[i + off]; |
} |
} |
//-------------------------------------------------------------- |
void copy_localID(const char *src, char *dst) |
{ |
uint8_t off = 0; |
// for (uint8_t i = 0; i < 40; i++) |
// { |
// if (src[i] == '-') if (src[i+3] == '-')// MAC Adresse suchen |
// { |
// off = i-4; |
// break; |
// } |
// } |
for (uint8_t i = 0; i < 14; i++) |
{ |
if (src[i + off] == '-') |
off++; |
dst[i] = src[i + off]; |
} |
} |
//-------------------------------------------------------------- |
void copy_DevName(const char *src, char *dst) |
{ |
uint8_t off = 0; |
for (uint8_t i = 0; i < 14; i++) |
{ |
if (src[i] == ' ') if (src[i+1] == ' ') break; // nach zwei Leerzeichen ist der Name zuende |
dst[i] = src[i + off]; |
} |
} |
//-------------------------------------------------------------- |
uint16_t bt_discover(char result[8][12]) |
{ |
if (!bt_set_mode(BLUETOOTH_MASTER)) |
return false; |
send_cmd(BT_TEST, NULL); |
if (!send_cmd(BT_FIND_DEVICES, NULL)) |
{ |
return false; |
} |
char buffer[255]; //oversized, but who cares? |
char *bufferhead = buffer; |
uint16_t pos = 0; |
uint16_t Timeout = 40000; |
uint16_t pos1 = 0; |
uint16_t posC = 0; |
#ifdef DEBUG |
debug_pgm(PSTR("discover2")); |
#endif |
do |
{ |
uart_receive(); |
Timeout--; |
pos1++; |
posC++; |
_delay_ms(1); |
write_ndigit_number_u(0,5,fifo_getcount(&in_fifo),5,0,0); |
if (posC ==1000) |
{ |
lcd_printp_at (i++, 1, PSTR("."), 0); |
posC = 0; |
} |
if (fifo_is_full(&in_fifo)) break; |
#ifdef DEBUG |
if (fifo_search(&in_fifo, PSTR("Found."))) debug_pgm(PSTR("Suchen ende1")); |
#endif |
} |
// while (((Timeout > 0) ||(!fifo_strstr_pgm(&in_fifo, PSTR("Inquiry Results:\r\n")))) && (!fifo_strstr_pgm(&in_fifo, PSTR("Found")))); |
while ((Timeout > 0)||(!fifo_strstr_pgm(&in_fifo, PSTR("Inquiry Results:\r\n")))); |
#ifdef DEBUG |
debug_pgm(PSTR("Suchen ende2")); |
if (Timeout == 0) debug_pgm(PSTR("Timeout")); |
if (fifo_is_full(&in_fifo)) debug_pgm(PSTR("Fifo Overrun, zuviele BT Devices")); |
#endif |
while (!fifo_is_empty(&in_fifo)) |
{ |
// Get next line |
while (!fifo_cmp_pgm(&in_fifo, PSTR("\r\n"))) |
{ |
fifo_read(&in_fifo, bufferhead); |
bufferhead++; |
} |
// terminate string |
*bufferhead = 0; |
//reset bufferhead |
bufferhead = buffer; |
if (strlen(buffer) == 0) |
continue; //the empty line before end of inquiry |
if (strstr_P(buffer, PSTR("Inquiry End"))) |
// if (searchend) |
{ |
fifo_clear(&in_fifo); |
// test(); |
return true; |
} |
copy_DevName(&buffer[3],device_list[pos].DevName); |
device_list[pos].DevName[14] = 0; // Stringende |
copy_mac(&buffer[3], device_list[pos].mac); |
// for (uint16_t i = 0; i < 15; i++) |
// { |
// |
//// USART_putc((device_list[pos].DevName[i])); |
// lcd_print_hex((device_list[pos].DevName[i]),0); |
// } |
// USART_putc('\n'); |
// |
// |
// for (uint16_t i = 0; i < 12; i++) |
// { |
// |
// USART_putc((device_list[pos].mac[i])); |
// |
// } |
// |
// USART_putc('\n'); |
// USART_putc('\r'); |
pos++; |
} |
return false; |
} |
//-------------------------------------------------------------- |
uint8_t bt_getID (void) |
{ |
char buffer[255]; //oversized, but who cares? |
char *bufferhead = buffer; |
// uint16_t pos = 0; |
#ifdef DEBUG |
debug_pgm(PSTR("bt_getID1")); |
#endif |
while_timeout(!fifo_strstr_pgm(&in_fifo, PSTR("r\n")), |
2000) |
uart_receive(); |
#ifdef DEBUG |
debug_pgm(PSTR("bt_getID:Suchen ende2")); |
// if (Timeout == 0) debug_pgm(PSTR("Timeout")); |
if (fifo_is_full(&in_fifo)) debug_pgm(PSTR("bt_getID:Fifo Overrun")); |
#endif |
while (!fifo_is_empty(&in_fifo)) |
{ |
// Get next line |
while (!fifo_cmp_pgm(&in_fifo, PSTR("\r\n"))) |
{ |
fifo_read(&in_fifo, bufferhead); |
bufferhead++; |
// write_ndigit_number_u(10,4,fifo_getcount(&in_fifo),5,0,0); |
} |
// terminate string |
*bufferhead = 0; |
//reset bufferhead |
bufferhead = buffer; |
if (strlen(buffer) == 0) |
continue; //the empty line before end of inquiry |
copy_localID(&buffer[0], &localID[0]); |
for(uint8_t i = 0; i < 13; i++) |
{ |
lcd_putc (i, 6, localID[i],0); |
Config.bt_Mac[i] = localID[i]; |
} |
// lcd_printp_at (0, 7, PSTR("lokale ID hier"), 0); |
//// write_ndigit_number_u(0,4,fifo_getcount(&in_fifo),5,0,0); |
// while (!get_key_press (1 << KEY_ENTER)); |
#ifdef DEBUG |
debug_pgm(PSTR("bt_getID:Copy ID")); |
#endif |
if ( fifo_strstr_pgm(&in_fifo, PSTR("OK"))) |
{ |
fifo_clear(&in_fifo); |
#ifdef DEBUG |
debug_pgm(PSTR("bt_getID:OK found")); |
#endif |
return true; |
} |
else return false; |
return true; |
// pos++; |
} |
return false; |
} |
device_info device_list[NUTS_LIST]; |
void bt_downlink_init(void) |
{ |
fifo_init(&in_fifo, bt_buffer, IN_FIFO_SIZE); |
_delay_ms(100); |
// debug_pgm(PSTR("bt_downlink_init")); |
uart_receive(); |
fifo_clear(&in_fifo); |
// send_cmd(BT_TEST, NULL); |
#ifdef DEBUG |
debug_pgm(PSTR("downlink_init Start")); |
#endif |
if (Config.BTIsSlave == true) // nur Init wenn BT ist Slave |
{ |
#ifdef DEBUG |
debug_pgm(PSTR("downlink_init:try to set Master")); |
#endif |
// comm_mode = BT_NOECHO; |
// |
// if (!send_cmd (BT_SET_ECHO,NULL)) { |
//#ifdef DEBUG |
// debug_pgm(PSTR("downlink_init:Couldn't set Echo!")); |
//#endif |
// } |
// |
// comm_mode = BT_NOANSWER; |
// if (!send_cmd(BT_SET_ANSWER,NULL)) { |
//#ifdef DEBUG |
// debug_pgm(PSTR("downlink_init:Couldn't set Answer!")); |
//#endif |
// |
// } |
comm_mode = BT_CMD; |
// send_cmd(BT_TEST, NULL); |
bt_set_EchoAnswer(true); |
if (!bt_set_mode(BLUETOOTH_MASTER)) |
{ |
#ifdef DEBUG |
debug_pgm(PSTR("downlink_init:Couldn't set master!")); |
#endif |
return; |
} |
#ifdef DEBUG |
debug_pgm(PSTR("downlink_init:master is set ")); |
#endif |
// WriteBTMasterFlag(); // Master merken |
comm_mode = BT_CMD; |
} |
else |
{ |
#ifdef DEBUG |
debug_pgm(PSTR("downlink_init:Master was set")); |
#endif |
comm_mode = BT_CMD; |
} |
} |
void bt_searchDevice(void) //Bluetoothgeräte suchen |
{ |
char result[8][12]; |
for (uint8_t i = 0; i < 8; i++) // alte Liste löschen |
for (uint8_t j = 0; j < 12; j++) |
result[i][j] = 0; |
#ifdef DEBUG |
debug_pgm(PSTR("Search Device:BT_discover")); |
#endif |
if (bt_discover(result)) |
{ |
bt_devicecount = 0; |
#ifdef DEBUG |
debug_pgm(PSTR("Search Device:Search ok")); |
#endif |
for (uint8_t i = 0; i < 8; i++) |
{ |
if (valid(i)) |
bt_devicecount++; |
else break; |
} |
} |
#ifdef DEBUG |
else |
debug_pgm(PSTR("Search Device:Search failed")); |
#endif |
// } |
} |
// |
//-------------------------------------------------------------- |
volatile uint8_t bt_receiveNMEA(void) |
{ |
char received; |
static uint8_t line_flag = 1; |
static char* ptr_write = bt_rx_buffer; |
uint32_t timeout=400000; |
while(!timeout == 0){ |
if (bt_rx_ready == 1) |
return true; |
uart_receive(); |
if (fifo_is_empty(&in_fifo)) timeout--; |
if (fifo_is_empty(&in_fifo)) continue; |
timeout = 400000; |
fifo_read(&in_fifo, &received); |
//#ifdef DEBUG |
// USART_putc(received); |
//#endif |
// Find starting point of packet |
if (bt_rx_ready == 0) |
{ |
if ((received == start) && (line_flag==1)) |
{ // start '$' |
line_flag = 0; // New line has begun |
ptr_write = bt_rx_buffer; // Begin at start of buffer |
bt_rx_len = 0; |
//#ifdef DEBUG |
// debug_pgm(PSTR("NMEA $")); |
//#endif |
} |
if (line_flag == 0) |
{ // Are we receiving a line? |
*ptr_write = received; // Add current byte |
bt_rx_len++; |
// GPS Datensatzende |
if (received == end) |
{ // End of MK-GPS or NMEA-line? |
line_flag = 1; // Yes, start new line |
bt_rx_ready = 1; // Lock buffer until line has been processed |
//#ifdef DEBUG |
// debug_pgm(PSTR("NMEA End")); |
//#endif |
return true; |
} |
} |
ptr_write++; |
if(bt_rx_len == RXD_BUFFER_SIZE) line_flag = 1; // Line too long? Try again |
}//if (bt_rx_ready == 0) |
} |
#ifdef DEBUG |
debug_pgm(PSTR("bt_receiveNMEA: Timeout")); |
#endif |
return false; |
} |
// |
////-------------------------------------------------------------- |
//uint16_t bt_receiveNMEA2(void) |
//{ |
// |
// char received; |
// static uint8_t line_flag = 1; |
// static char* ptr_write = bt_rx_buffer; |
// uint16_t timeout_ms=2000; |
// |
//// while_timeout(true, timeout_ms) { |
//while(1){ |
// |
// uart_receive(); |
// if (fifo_is_empty(&in_fifo)) |
// continue; |
// fifo_read(&in_fifo, &received); |
// USART_putc(received); |
//// _delay_ms(1); |
// } |
//// |
//return true; |
//} |
#endif |
#endif |
#endif |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/bluetooth/bluetooth.h |
---|
0,0 → 1,156 |
/***************************************************************************** |
* Copyright (C) 2008 Thomas Kaiser, thomas@ft-fanpage.de * |
* Copyright (C) 2009 Peter "woggle" Mack, mac@denich.net * |
* Copyright (C) 2011 Christian "Cebra" Brandtner, brandtner@brandtner.net * |
* Copyright (C) 2011 Harald Bongartz * |
* * |
* This program is free software; you can redistribute it and/or modify * |
* it under the terms of the GNU General Public License as published by * |
* the Free Software Foundation; either version 2 of the License. * |
* * |
* This program is distributed in the hope that it will be useful, * |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
* GNU General Public License for more details. * |
* * |
* You should have received a copy of the GNU General Public License * |
* along with this program; if not, write to the * |
* Free Software Foundation, Inc., * |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
* * |
* * |
* Credits to: * |
* Holger Buss & Ingo Busker from mikrokopter.de for the MK project + SVN * |
* http://www.mikrokopter.de * |
* Gregor "killagreg" Stobrawa for his version of the MK code * |
* Thomas Kaiser "thkais" for the original project. See * |
* http://www.ft-fanpage.de/mikrokopter/ * |
* http://forum.mikrokopter.de/topic-4061-1.html * |
* Claas Anders "CaScAdE" Rathje for providing the font and his C-OSD code * |
* http://www.mylifesucks.de/oss/c-osd/ * |
* Harald Bongartz "HaraldB" for providing his Ideas and Code for usibility* |
*****************************************************************************/ |
#ifndef _BLUETOOTH_H_ |
#define _BLUETOOTH_H_ |
#include <avr/io.h> |
//#include <common.h> |
#define SQUIRREL |
#define NUTS_LIST 16 |
#define EXTENSIONS_LIST 16 |
#define RXD_BUFFER_SIZE 150 |
//void InitBT(void); |
extern char bt_rx_buffer[RXD_BUFFER_SIZE]; |
extern volatile uint8_t bt_rx_len; |
extern volatile uint8_t bt_rx_ready; |
extern uint8_t rx_GPS; |
//extern static char start = '$'; |
//extern static char end = '\n'; |
extern char data_decode[RXD_BUFFER_SIZE]; |
extern volatile uint16_t rx_timeout; |
extern uint8_t bt_rxerror; |
extern uint8_t BT_New_Baudrate; //Merkzelle für zu setzende Baudrate |
typedef struct _device_info device_info; |
// device info struct, holds mac , class and extensions + values of a device |
struct _device_info |
{ |
char DevName[20]; |
char mac[14]; |
// uint8_t class; |
// uint8_t extension_types[EXTENSIONS_LIST]; |
// uint16_t values_cache[EXTENSIONS_LIST]; |
}; |
extern uint8_t bt_devicecount; |
extern device_info device_list[NUTS_LIST]; |
extern char localID[15]; |
#define valid(num) (num < NUTS_LIST && (device_list[num].mac[0] != 0 || device_list[num].mac[1] != 0 || device_list[num].mac[2] != 0 || device_list[num].mac[3] != 0 || device_list[num].mac[4] != 0 || device_list[num].mac[5] != 0 || device_list[num].mac[6] != 0 || device_list[num].mac[7] != 0 || device_list[num].mac[8] != 0 || device_list[num].mac[9] != 0 || device_list[num].mac[10] != 0 || device_list[num].mac[11] != 0)) |
extern volatile uint8_t bt_receiveNMEA(void); |
extern void bt_start(void); // EchoAnswervariable setzen |
void bt_set_EchoAnswer (uint8_t onoff); |
extern uint8_t bt_getID (void); |
//extern static communication_mode_t update_comm_mode(uint16_t timeout_ms); |
// Bluetooth mode ENUM |
typedef enum |
{ |
BLUETOOTH_MASTER, // < Master Mode (to create outgoinng connections). |
BLUETOOTH_SLAVE // < Slave Mode (to wait for incoming connections). |
} bt_mode_t; |
// set baudrate bluetooth |
// @return true = ok |
// false = error |
//extern uint16_t bt_setbaud (uint8_t baudrate); |
uint16_t bt_setbaud(uint8_t baudrate); |
// init bluetooth driver |
// @return always true |
// |
//extern uint16_t bt_init (void (*upate_percentage) (uint16_t)); |
extern uint16_t bt_init (void); |
// Set the Bluetooth mode |
// @param mode bt_mode_t Bluetooth Mode ENUM (BLUETOOTH_MASTER or BLUETOOTH_SLAVE) |
// @return true if mode change was succesful, false if not |
// |
extern uint8_t bt_set_mode (const bt_mode_t mode); |
// recieve data over bluetooth |
// @param data pointer to memory for data storage |
// @param length value of length after call holds the actual recived data length |
// @param timeout_ms timeout in ms after the recive function aborts and returns with false |
// @return false if recived length > length parameter or it timeouted, true otherwise |
// |
extern uint16_t bt_receive (void * data, uint8_t length, uint16_t timeout_ms); |
// send data over bluetooth |
// @param data pointer to the data to send |
// @param length length of the data to be send |
// @return true if sendingn was successful, false otherwise |
// |
extern uint16_t bt_send (void * data, const uint8_t length); |
// squirrelt only functions |
#ifdef SQUIRREL |
// open bluetoot connection (only one at a time possible) |
// @param address connection is opened to this device mac address |
// @return true if connection was established, false otherwise |
// |
extern uint16_t bt_connect (const char *address); |
// closes bluetooth connection |
// @return false if failed, true otherwise |
// |
extern uint16_t bt_disconnect (void); |
// discover bluetooth devices |
// @param result in a 2 dimensional array first index are devicecs (max 8) second is mac address string |
// @param update_callback to inform of progress (in % from 0 to 100) |
// @return true if successful, false if error occured |
// |
extern uint16_t bt_discover (char result[8][12]); |
//extern uint16_t bt_discover (char result[8][12], void (*update_callback)(const uint16_t progress)); |
extern void bt_downlink_init(void); // Auf Master stellen für Devicesuche und GPS Empfang |
extern void bt_searchDevice(void); //Bluetoothgeräte suchen |
#endif // SQUIRREL |
#endif |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/bluetooth/error.c |
---|
0,0 → 1,208 |
/* |
___ ___ ___ ___ _____ |
/ /\ /__/\ / /\ /__/\ / /::\ |
/ /::\ | |::\ / /::\ \ \:\ / /:/\:\ |
/ /:/\:\ ___ ___ | |:|:\ / /:/\:\ \ \:\ / /:/ \:\ |
/ /:/~/::\ /__/\ / /\ __|__|:|\:\ / /:/ \:\ _____\__\:\ /__/:/ \__\:| |
/__/:/ /:/\:\ \ \:\ / /:/ /__/::::| \:\ /__/:/ \__\:\ /__/::::::::\ \ \:\ / /:/ |
\ \:\/:/__\/ \ \:\ /:/ \ \:\~~\__\/ \ \:\ / /:/ \ \:\~~\~~\/ \ \:\ /:/ |
\ \::/ \ \:\/:/ \ \:\ \ \:\ /:/ \ \:\ ~~~ \ \:\/:/ |
\ \:\ \ \::/ \ \:\ \ \:\/:/ \ \:\ \ \::/ |
\ \:\ \__\/ \ \:\ \ \::/ \ \:\ \__\/ |
\__\/ \__\/ \__\/ \__\/ |
___ ___ ___ ___ ___ ___ |
/ /\ / /\ /__/\ /__/\ / /\ /__/\ |
/ /:/ / /::\ | |::\ | |::\ / /::\ \ \:\ |
/ /:/ / /:/\:\ | |:|:\ | |:|:\ / /:/\:\ \ \:\ |
/ /:/ ___ / /:/ \:\ __|__|:|\:\ __|__|:|\:\ / /:/ \:\ _____\__\:\ |
/__/:/ / /\ /__/:/ \__\:\ /__/::::| \:\ /__/::::| \:\ /__/:/ \__\:\ /__/::::::::\ |
\ \:\ / /:/ \ \:\ / /:/ \ \:\~~\__\/ \ \:\~~\__\/ \ \:\ / /:/ \ \:\~~\~~\/ |
\ \:\ /:/ \ \:\ /:/ \ \:\ \ \:\ \ \:\ /:/ \ \:\ ~~~ |
\ \:\/:/ \ \:\/:/ \ \:\ \ \:\ \ \:\/:/ \ \:\ |
\ \::/ \ \::/ \ \:\ \ \:\ \ \::/ \ \:\ |
\__\/ \__\/ \__\/ \__\/ \__\/ \__\/ |
** |
* Error handling functions |
*/ |
#include <stdbool.h> |
#include <avr/pgmspace.h> |
#include "error_driver.h" |
#include "../main.h" |
//-------------------------------------------------------------- |
inline void _send_msg(const char *msg) |
{ |
for (uint8_t i=0; i<255 && msg[i]!='\0'; i++) |
{ |
errordriver_write_c(msg[i]); |
} |
errordriver_write_c('\n'); |
} |
//-------------------------------------------------------------- |
void send_pgm(const prog_char *msg) |
{ |
uint8_t myByte; |
myByte = pgm_read_byte(msg); |
for(int i = 1; myByte != '\0'; i++) |
{ |
errordriver_write_c(myByte); |
myByte = pgm_read_byte(msg+i); |
} |
} |
#ifdef DEBUG |
//-------------------------------------------------------------- |
void error_init(void) |
{ |
error_driver_Init(); |
} |
//-------------------------------------------------------------- |
void error_putc(const char c) |
{ |
errordriver_write_c(c); |
} |
//-------------------------------------------------------------- |
void assert (bool condition, const char *msg) |
{ |
if (!condition) |
{ |
send_pgm(PSTR("ASS:")); |
_send_msg(msg); |
} |
} |
//-------------------------------------------------------------- |
void info (const char *msg) |
{ |
send_pgm(PSTR("INF:")); |
_send_msg(msg); |
} |
//-------------------------------------------------------------- |
void warn (const char *msg) |
{ |
send_pgm(PSTR("WARN:")); |
_send_msg(msg); |
} |
//-------------------------------------------------------------- |
void debug (const char *msg) |
{ |
send_pgm(PSTR("DBG:")); |
_send_msg(msg); |
} |
//-------------------------------------------------------------- |
void Error (const char *msg) |
{ |
send_pgm(PSTR("ERR:")); |
_send_msg(msg); |
} |
#endif |
#ifdef DEBUG |
//-------------------------------------------------------------- |
void assert_pgm(bool condition, const prog_char *msg) |
{ |
if (condition) { |
send_pgm(PSTR("ASS:")); |
send_pgm(msg); |
errordriver_write_c('\n'); |
} |
} |
//-------------------------------------------------------------- |
void info_pgm(const prog_char *msg) |
{ |
send_pgm(PSTR("INF:")); |
send_pgm(msg); |
errordriver_write_c('\n'); |
} |
//-------------------------------------------------------------- |
void warn_pgm(const prog_char *msg) |
{ |
send_pgm(PSTR("WARN:")); |
send_pgm(msg); |
errordriver_write_c('\n'); |
errordriver_write_c('\r'); |
} |
//-------------------------------------------------------------- |
void error_pgm(const prog_char *msg) |
{ |
send_pgm(PSTR("ERR:")); |
send_pgm(msg); |
errordriver_write_c('\n'); |
errordriver_write_c('\r'); |
} |
//-------------------------------------------------------------- |
void debug_pgm(const prog_char *msg) |
{ |
send_pgm(PSTR("DBG:")); |
send_pgm(msg); |
errordriver_write_c('\n'); |
errordriver_write_c('\r'); |
} |
////-------------------------------------------------------------- |
//void print_hex(uint8_t num) |
//{ |
// if (num<10) |
// error_putc(num+48); |
// else |
// { |
// switch (num) |
// { |
// case 10: |
// error_putc('A'); break; |
// case 11: |
// error_putc('B'); break; |
// case 12: |
// error_putc('C'); break; |
// case 13: |
// error_putc('D'); break; |
// case 14: |
// error_putc('E'); break; |
// case 15: |
// error_putc('F'); break; |
// default: |
// error_putc('#'); break; |
// } |
// } |
//} |
// |
// |
////-------------------------------------------------------------- |
//void byte_to_hex(uint8_t byte) |
//{ |
// uint8_t b2 = (byte & 0x0F); |
// uint8_t b1 = ((byte & 0xF0)>>4); |
// print_hex(b1); |
// print_hex(b2); |
//} |
#endif |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/bluetooth/error.h |
---|
0,0 → 1,79 |
/* |
___ ___ ___ ___ _____ |
/ /\ /__/\ / /\ /__/\ / /::\ |
/ /::\ | |::\ / /::\ \ \:\ / /:/\:\ |
/ /:/\:\ ___ ___ | |:|:\ / /:/\:\ \ \:\ / /:/ \:\ |
/ /:/~/::\ /__/\ / /\ __|__|:|\:\ / /:/ \:\ _____\__\:\ /__/:/ \__\:| |
/__/:/ /:/\:\ \ \:\ / /:/ /__/::::| \:\ /__/:/ \__\:\ /__/::::::::\ \ \:\ / /:/ |
\ \:\/:/__\/ \ \:\ /:/ \ \:\~~\__\/ \ \:\ / /:/ \ \:\~~\~~\/ \ \:\ /:/ |
\ \::/ \ \:\/:/ \ \:\ \ \:\ /:/ \ \:\ ~~~ \ \:\/:/ |
\ \:\ \ \::/ \ \:\ \ \:\/:/ \ \:\ \ \::/ |
\ \:\ \__\/ \ \:\ \ \::/ \ \:\ \__\/ |
\__\/ \__\/ \__\/ \__\/ |
___ ___ ___ ___ ___ ___ |
/ /\ / /\ /__/\ /__/\ / /\ /__/\ |
/ /:/ / /::\ | |::\ | |::\ / /::\ \ \:\ |
/ /:/ / /:/\:\ | |:|:\ | |:|:\ / /:/\:\ \ \:\ |
/ /:/ ___ / /:/ \:\ __|__|:|\:\ __|__|:|\:\ / /:/ \:\ _____\__\:\ |
/__/:/ / /\ /__/:/ \__\:\ /__/::::| \:\ /__/::::| \:\ /__/:/ \__\:\ /__/::::::::\ |
\ \:\ / /:/ \ \:\ / /:/ \ \:\~~\__\/ \ \:\~~\__\/ \ \:\ / /:/ \ \:\~~\~~\/ |
\ \:\ /:/ \ \:\ /:/ \ \:\ \ \:\ \ \:\ /:/ \ \:\ ~~~ |
\ \:\/:/ \ \:\/:/ \ \:\ \ \:\ \ \:\/:/ \ \:\ |
\ \::/ \ \::/ \ \:\ \ \:\ \ \::/ \ \:\ |
\__\/ \__\/ \__\/ \__\/ \__\/ \__\/ |
* |
* Error handling functions. |
*/ |
#ifndef __ERROR__ |
#define __ERROR__ |
#include <avr/pgmspace.h> |
#include <stdbool.h> |
#include "../main.h" |
#ifdef DEBUG |
void error_init(void); |
void error_putc(const char c); |
void assert (bool condition, const char *msg); |
void info (const char *msg); |
void warn(const char *msg); |
void debug(const char *msg); |
void Error(const char *msg); |
void assert_pgm(bool condition, const prog_char *msg); |
void info_pgm (const prog_char *msg); |
void warn_pgm(const prog_char *msg); |
void debug_pgm(const prog_char *msg); |
void error_pgm(const prog_char *msg); |
void byte_to_hex(uint8_t byte); |
#else |
#define error_init() {} |
#define error_putc(c) {} |
#define assert(cond, msg) {} |
#define info(msg) {} |
#define warn(msg) {} |
#define debug(msg) {} |
#define error(msg) {} |
#define assert_pgm(cond, msg) {} |
#define info_pgm(msg) {} |
#define warn_pgm(msg) {} |
#define debug_pgm(msg) {} |
#define error_pgm(msg) {} |
#define byte_to_hex(byte) {} |
#endif |
#endif //__ERROR__ |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/bluetooth/error_driver.c |
---|
0,0 → 1,27 |
#include <avr/pgmspace.h> |
#include <stdbool.h> |
//#include "cpu.h" |
#include "error_driver.h" |
#include "../main.h" |
#ifdef DEBUG |
#include "../uart/usart.h" |
#include "../uart/uart1.h" |
void errordriver_write_c(char c) |
{ |
USART_putc(c); |
} |
void error_driver_Init(void) |
{ |
// USART_Init(UART_BAUD_SELECT(USART_BAUD,F_CPU)); |
} |
#endif |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/bluetooth/error_driver.h |
---|
0,0 → 1,22 |
/* |
* Functions to write error message to FTDI or USART |
*/ |
#ifndef __ERROR_DRIVER__ |
#define __ERROR_DRIVER__ |
#include <avr/io.h> |
#include "../main.h" |
#ifdef DEBUG |
extern void errordriver_write_c(char c); |
extern void error_driver_Init(void); |
#else |
#define errordriver_write_c(c) {} |
#define error_driver_init() {} |
#endif |
#endif //__ERROR_DRIVER__ |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/bluetooth/fifo.c |
---|
0,0 → 1,148 |
/** |
* a simple Fifo |
* @file fifo.c |
* @author Pascal Schnurr |
*/ |
#include "fifo.h" |
//#if defined HWVERSION1_3W || defined HWVERSION3_9 || defined HWVERSION1_2W |
//-------------------------------------------------------------- |
void fifo_init (fifo_t * fifo, uint8_t * buffer, uint16_t size) |
{ |
fifo->size = size; |
fifo->buffer = buffer; |
fifo->head = 0; |
fifo->count = 0; |
} |
//-------------------------------------------------------------- |
uint16_t fifo_getcount (const fifo_t * fifo) |
{ |
return fifo->count; |
} |
//-------------------------------------------------------------- |
bool fifo_is_empty (const fifo_t * fifo) |
{ |
return (fifo->count == 0); |
} |
//-------------------------------------------------------------- |
bool fifo_is_full (const fifo_t * fifo) |
{ |
return (fifo->size - fifo->count == 0); |
} |
//-------------------------------------------------------------- |
bool fifo_read (fifo_t * fifo, char *data) |
{ |
if (fifo_is_empty (fifo)) |
return false; |
uint8_t *head = fifo->buffer + fifo->head; |
*data = (char) * head; |
fifo->head = ( (fifo->head + 1) % fifo->size); |
fifo->count--; |
return true; |
} |
//-------------------------------------------------------------- |
bool fifo_write (fifo_t * fifo, const char data) |
{ |
if (fifo_is_full (fifo)) |
return false; |
uint8_t *end = fifo->buffer + ( (fifo->head + fifo->count) % fifo->size); |
*end = (uint8_t) data; |
fifo->count++; |
return true; |
} |
//-------------------------------------------------------------- |
bool fifo_clear (fifo_t * fifo) |
{ |
fifo->count = 0; |
fifo->head = 0; |
return true; |
} |
//-------------------------------------------------------------- |
static bool fifo_cmp_pgm_at (fifo_t * fifo, const prog_char * pgm, const uint16_t index) |
{ |
uint16_t i; |
uint8_t fifo_byte; |
uint8_t pgm_byte; |
for (i = 0; pgm_read_byte (pgm + i) != 0; i++) |
{ |
if (fifo->count <= (i + index)) |
return false; |
pgm_byte = pgm_read_byte (pgm + i); |
fifo_byte = * (fifo->buffer + ( (fifo->head + i + index) % fifo->size)); |
if (fifo_byte != pgm_byte) |
return false; |
} |
// We found the string, lets move the pointer |
fifo->head = ( (fifo->head + i + index) % fifo->size); |
fifo->count -= (i + index); |
return true; |
} |
//-------------------------------------------------------------- |
bool fifo_search (fifo_t * fifo, const prog_char * pgm) |
{ |
uint16_t i; |
uint8_t fifo_byte; |
uint8_t pgm_byte; |
for (i = 0; pgm_read_byte (pgm + i) != 0; i++) |
{ |
if (fifo->count <= i) |
return false; |
pgm_byte = pgm_read_byte (pgm + i); |
fifo_byte = * (fifo->buffer + ( (fifo->head + i) % fifo->size)); |
if (fifo_byte != pgm_byte) |
return false; |
} |
// // We found the string, lets move the pointer |
// fifo->head = ( (fifo->head + i + index) % fifo->size); |
// |
// fifo->count -= (i + index); |
return true; |
} |
//-------------------------------------------------------------- |
bool fifo_cmp_pgm (fifo_t * fifo, const prog_char * pgm) |
{ |
return fifo_cmp_pgm_at (fifo, pgm, 0); |
} |
//-------------------------------------------------------------- |
bool fifo_strstr_pgm (fifo_t * fifo, const prog_char * pgm) |
{ |
for (uint16_t i = 0; i < fifo->count; i++) |
{ |
if (fifo_cmp_pgm_at (fifo, pgm, i)) |
return true; |
} |
return false; |
} |
//#endif |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/bluetooth/fifo.h |
---|
0,0 → 1,93 |
/** |
* a simple Fifo |
* @file fifo.h |
* @author Pascal Schnurr |
*/ |
#include <avr/pgmspace.h> |
#include <stdbool.h> |
#ifndef _FIFO_H_ |
#define _FIFO_H_ |
/** |
*fifo data structure all vital fifo information |
*/ |
typedef struct |
{ |
uint16_t count; /**< current number of elements */ |
uint16_t head; /**< position of the head element */ |
uint16_t size; /**< size equals max number of entrys*/ |
uint8_t* buffer; /**< pointer to memory area where the fifo is to be saved */ |
} fifo_t; |
uint16_t fifo_getcount (const fifo_t * fifo); |
/** \brief initialize of a fifo |
* sets all the information in your given fifo structure |
* @param fifo pointer to an allocated fifo_t structure |
* @param buffer pointer to an a allocated memory space for the fifo of size = sizeof(uint8_t) * size |
* @param size max number of entrys the fifo will hold |
*/ |
void fifo_init (fifo_t *fifo, uint8_t *buffer, uint16_t size); |
/** \brief checks if fifo is empty |
* @param fifo pointer to your initialized fifo_t structure |
* @return true if empty otherwise false |
*/ |
bool fifo_is_empty (const fifo_t *fifo); |
/** \brief checks if fifo is full |
* @param fifo pointer to your initialized fifo_t structure |
* @return true if full otherwise false |
*/ |
bool fifo_is_full (const fifo_t *fifo); |
/** \brief clears the fifo |
* resets your fifo structure to 0 elements |
* @param fifo pointer to your initialized fifo_t structure |
* @return always true (never fails) |
*/ |
bool fifo_clear (fifo_t *fifo); |
/** \brief reads head of fifo |
* reads the first element and removes it |
* @param fifo pointer to your initialized fifo_t structure |
* @return false if fifo is empty false otherwise |
*/ |
bool fifo_read (fifo_t *fifo, char *data); |
/** \brief inserts a char into the fifo |
* adds a char to the end of the fifo |
* @param fifo pointer to your initialized fifo_t structure |
* @param data the char data to be inserted |
* @return false if fifo is full true otherwise |
*/ |
bool fifo_write (fifo_t *fifo, const char data); |
/** \brief compares first elements with prog_char string |
* if pgm equals the first elements of the fifo these elements are removed |
* @param fifo pointer to your initialized fifo_t structure |
* @param pgm a prog_char string for comparison |
* @return true if pgm is equal to the first entrys in the fifo, false otherwise |
*/ |
bool fifo_cmp_pgm (fifo_t* fifo, const prog_char* pgm); |
/** \brief searches a string in the whole fifo |
* starts at the beginning and searches for the pgm string in the fifo, |
* |
* @param fifo pointer to your initialized fifo_t structure |
* @param pgm a prog_char with the search string |
* @return true if found, false otherwise |
*/ |
bool fifo_search (fifo_t * fifo, const prog_char * pgm); |
/** \brief searches a string in the whole fifo |
* starts at the beginning and searches for the pgm string in the fifo, |
* if they are found previous entrys and the string are removed from the fifo |
* @param fifo pointer to your initialized fifo_t structure |
* @param pgm a prog_char with the search string |
* @return true if found, false otherwise |
*/ |
bool fifo_strstr_pgm (fifo_t *fifo, const prog_char *pgm); |
#endif /* _FIFO_H_ */ |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/connect.c |
---|
0,0 → 1,332 |
/***************************************************************************** |
* Copyright (C) 2008 Thomas Kaiser, thomas@ft-fanpage.de * |
* Copyright (C) 2009 Peter "woggle" Mack, mac@denich.net * |
* Copyright (C) 2011 Christian "Cebra" Brandtner, brandtner@brandtner.net * |
* Copyright (C) 2011 Harald Bongartz * |
* * |
* This program is free software; you can redistribute it and/or modify * |
* it under the terms of the GNU General Public License as published by * |
* the Free Software Foundation; either version 2 of the License. * |
* * |
* This program is distributed in the hope that it will be useful, * |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
* GNU General Public License for more details. * |
* * |
* You should have received a copy of the GNU General Public License * |
* along with this program; if not, write to the * |
* Free Software Foundation, Inc., * |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
* * |
* * |
* Credits to: * |
* Holger Buss & Ingo Busker from mikrokopter.de for the MK project + SVN * |
* http://www.mikrokopter.de * |
* Gregor "killagreg" Stobrawa for his version of the MK code * |
* Thomas Kaiser "thkais" for the original project. See * |
* http://www.ft-fanpage.de/mikrokopter/ * |
* http://forum.mikrokopter.de/topic-4061-1.html * |
* Claas Anders "CaScAdE" Rathje for providing the font and his C-OSD code * |
* http://www.mylifesucks.de/oss/c-osd/ * |
* Harald Bongartz "HaraldB" for providing his Ideas and Code for usibility* |
*****************************************************************************/ |
#include "cpu.h" |
#include <avr/pgmspace.h> |
#include <util/delay.h> |
#include "lcd/lcd.h" |
#include "timer/timer.h" |
#include "eeprom/eeprom.h" |
#include "messages.h" |
#include "lipo/lipo.h" |
#include "main.h" |
#include "bluetooth/bluetooth.h" |
#if defined HWVERSION3_9 |
//-------------------------------------------------------------- |
void Change_Output(uint8_t UartMode) // Schaltet die Rx/Tx Richtungen |
{ |
// hiermit werden die 74HTC125 (IC5) Gatter geschaltet |
clr_USB2FC(); // PC2 aus |
clr_USB2Wi(); // PB0 aus |
clr_Uart02FC(); // PC6 aus |
clr_Uart02Wi(); // PC5 aus |
switch (UartMode) |
{ |
case USB2FC: |
UCSR1B &= ~(1<<RXEN1); |
UCSR1B &= ~(1<<TXEN1); |
UCSR1B &= ~(1<<RXCIE1); |
DDRD &= ~(1<<DDD2); // Pins auf Eingang setzen |
DDRD &= ~(1<<DDD3); |
PORTD &= ~(1<<PD2); // Pullup aus |
PORTD &= ~(1<<PD3); |
set_USB2FC(); |
break; |
case Uart02Wi: |
set_Uart02Wi(); |
break; |
case Uart02FC: |
set_Uart02FC(); |
break; |
case USB2Wi: |
UCSR1B &= ~(1<<RXEN1); |
UCSR1B &= ~(1<<TXEN1); |
UCSR1B &= ~(1<<RXCIE1); |
DDRD &= ~(1<<DDD2); // Pins auf Eingang setzen |
DDRD &= ~(1<<DDD3); |
PORTD &= ~(1<<PD2); // Pullup aus |
PORTD &= ~(1<<PD3); |
set_USB2Wi(); |
break; |
} |
} |
//-------------------------------------------------------------- |
// Function: BT2FC() |
// Purpose: Connect BT direct to FC-Kabel (SV2 as MKUSB) |
// Returns: |
//-------------------------------------------------------------- |
void Port_BT2FC(void) |
{ |
lcd_cls (); |
if(Config.UseBT == true) |
{ |
lcd_puts_at(0, 0, strGet(CONNECT14), 2); |
lcd_puts_at(0, 1, strGet(CONNECT15), 0); |
lcd_puts_at(0, 3, strGet(CONNECT16), 0); |
lcd_puts_at(0, 4, strGet(CONNECT17), 0); |
lcd_puts_at(0, 5, strGet(CONNECT23), 0); |
lcd_printp_at (0, 6, PSTR("Baudrate: "), 0); |
show_baudrate (10,6,Config.PKT_Baudrate,0); |
lcd_puts_at(12, 7, strGet(ESC), 0); |
set_BTOn(); |
_delay_ms(2000); |
if (!Config.BTIsSlave==true) bt_set_mode(BLUETOOTH_SLAVE); |
Change_Output(USB2FC); |
do |
{ |
show_Lipo(); |
} |
while(!get_key_press (1 << KEY_ESC)); |
get_key_press(KEY_ALL); |
if (Config.U02SV2 == 1) |
Change_Output(Uart02FC); |
else |
Change_Output(Uart02Wi); |
set_BTOff(); |
return; |
} |
else |
{ |
lcd_puts_at(0, 1, strGet(CONNECT12), 0); |
lcd_puts_at(0, 1, strGet(CONNECT13), 0); |
lcd_puts_at(0, 2, strGet(CONNECT7), 0); |
lcd_puts_at(0, 3, strGet(CONNECT8), 0); |
lcd_puts_at(0, 4, strGet(CONNECT9), 0); |
lcd_puts_at(12, 7, strGet(ENDE), 0); |
// lcd_printp_at (12, 7, PSTR("Ende"), 0); |
while(!get_key_press (1 << KEY_ESC)); |
get_key_press(KEY_ALL); |
return; |
} |
} |
//-------------------------------------------------------------- |
// Function: BT2Wi() |
// Purpose: Connect BT direct to Wi.232 |
// Returns: |
//-------------------------------------------------------------- |
void Port_BT2Wi(void) |
{ |
lcd_cls (); |
lcd_puts_at(0, 0, strGet(CONNECT14), 2); |
lcd_puts_at(0, 1, strGet(CONNECT18), 2); |
lcd_printp_at (5, 2, PSTR("RE-ID: "), 0); |
for (uint8_t i = 0; i < RE_ID_length; i++) |
{ |
lcd_putc (12+i,2, Config.RE_ID[i], 0); |
} |
lcd_puts_at(0, 3, strGet(CONNECT16), 0); |
lcd_puts_at(0, 4, strGet(CONNECT19), 0); |
lcd_puts_at(0, 5, strGet(CONNECT23), 0); |
lcd_printp_at (0, 6, PSTR("Baudrate: "), 0); |
show_baudrate (10,6,Config.PKT_Baudrate,0); |
lcd_puts_at(12, 7, strGet(ESC), 0); |
set_BTOn(); |
_delay_ms(2000); |
if (!Config.BTIsSlave==true) bt_set_mode(BLUETOOTH_SLAVE); |
Change_Output(USB2Wi); |
do |
{ |
show_Lipo(); |
} |
while(!get_key_press (1 << KEY_ESC)); |
get_key_press(KEY_ALL); |
if (Config.U02SV2 == 1) |
Change_Output(Uart02FC); |
else |
Change_Output(Uart02Wi); |
set_BTOff(); |
return; |
} |
//-------------------------------------------------------------- |
// Function: FC2CFG_BT() |
// Purpose: Connect FC (Tx1 Pin3, Rx1 Pin4) direct to BT |
// Returns: |
//-------------------------------------------------------------- |
void Port_FC2CFG_BT(void) |
{ |
lcd_cls (); |
lcd_printp_at (0, 0, PSTR("BTM-222 Konfigurieren"), 2); |
lcd_printp_at (0, 1, PSTR("FC > MK-USB > BTM-222"), 2); |
lcd_printp_at (0, 3, PSTR("MK-USB an PC anschl. "), 0); |
lcd_printp_at (0, 4, PSTR("Zwischen MK-USB und "), 0); |
lcd_printp_at (0, 5, PSTR("PKT ein gekreuztes "), 0); |
lcd_printp_at (0, 6, PSTR("Kabel anschliessen. "), 0); |
lcd_puts_at(12, 7, strGet(ESC), 0); |
set_BTOn(); |
Change_Output(USB2FC); |
while(!get_key_press (1 << KEY_ESC)); |
get_key_press(KEY_ALL); |
if (Config.U02SV2 == 1) |
Change_Output(Uart02FC); |
else |
Change_Output(Uart02Wi); |
set_BTOff(); |
return; |
} |
//-------------------------------------------------------------- |
// Function: USB2FC() |
// Purpose: Connect USB direct to FC-Kabel (SV2 as MKUSB) |
// Returns: |
//-------------------------------------------------------------- |
void Port_USB2FC(void) |
{ |
lcd_cls (); |
lcd_puts_at(0, 0, strGet(CONNECT14), 2); |
lcd_puts_at(0, 1, strGet(CONNECT20), 0); |
lcd_puts_at(0, 3, strGet(CONNECT21), 0); |
lcd_puts_at(0, 4, strGet(CONNECT17), 0); |
lcd_puts_at(0, 5, strGet(CONNECT23), 0); |
lcd_puts_at(12, 7, strGet(ESC), 0); |
Change_Output(USB2FC); |
do |
{ |
show_Lipo(); |
} |
while(!get_key_press (1 << KEY_ESC)); |
get_key_press(KEY_ALL); |
if (Config.U02SV2 == 1) |
Change_Output(Uart02FC); |
else |
Change_Output(Uart02Wi); |
return; |
} |
//-------------------------------------------------------------- |
// Function: USB2Wi() |
// Purpose: Connect USB direct to Wi.232 |
// Returns: |
//-------------------------------------------------------------- |
void Port_USB2Wi(void) |
{ |
lcd_cls (); |
lcd_puts_at(0, 0, strGet(CONNECT14), 2); |
lcd_puts_at(0, 1, strGet(CONNECT22), 2); |
lcd_puts_at(0, 3, strGet(CONNECT21), 0); |
lcd_puts_at(0, 4, strGet(CONNECT19), 0); |
lcd_puts_at(0, 5, strGet(CONNECT23), 0); |
lcd_printp_at (0, 6, PSTR("Baudrate: "), 0); |
show_baudrate (10,6,Config.PKT_Baudrate,0); |
lcd_puts_at(12, 7, strGet(ESC), 0); |
Change_Output(USB2Wi); |
do |
{ |
show_Lipo(); |
} |
while(!get_key_press (1 << KEY_ESC)); |
get_key_press(KEY_ALL); |
if (Config.U02SV2 == 1) |
Change_Output(Uart02FC); |
else |
Change_Output(Uart02Wi); |
return; |
} |
//-------------------------------------------------------------- |
// Function: USB2CFG_Wi() |
// Purpose: Connect USB direct to Wi.232 in Progmode |
// Returns: |
//-------------------------------------------------------------- |
void Port_USB2CFG_Wi(void) |
{ |
lcd_cls (); |
lcd_puts_at(0, 0, strGet(CONNECT24), 2); |
lcd_puts_at(0, 1, strGet(CONNECT22), 2); |
lcd_puts_at(0, 3, strGet(CONNECT21), 0); |
lcd_printp_at (0, 4, PSTR("Radiotronix Wi.232DTS"), 0); |
lcd_printp_at (0, 5, PSTR("Evaluation (868MHz) "), 0); |
lcd_puts_at(0, 6, strGet(CONNECT25), 0); |
lcd_puts_at(12, 7, strGet(ESC), 0); |
Change_Output(USB2Wi); |
set_WI232CMD(); // Port D6 = CMD |
while(!get_key_press (1 << KEY_ESC)); |
get_key_press(KEY_ALL); |
clr_WI232CMD(); // Port D6 = CMD |
if (Config.U02SV2 == 1) |
Change_Output(Uart02FC); |
else |
Change_Output(Uart02Wi); |
return; |
} |
#endif |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/connect.h |
---|
0,0 → 1,48 |
/***************************************************************************** |
* Copyright (C) 2008 Thomas Kaiser, thomas@ft-fanpage.de * |
* Copyright (C) 2009 Peter "woggle" Mack, mac@denich.net * |
* Copyright (C) 2011 Christian "Cebra" Brandtner, brandtner@brandtner.net * |
* Copyright (C) 2011 Harald Bongartz * |
* * |
* This program is free software; you can redistribute it and/or modify * |
* it under the terms of the GNU General Public License as published by * |
* the Free Software Foundation; either version 2 of the License. * |
* * |
* This program is distributed in the hope that it will be useful, * |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
* GNU General Public License for more details. * |
* * |
* You should have received a copy of the GNU General Public License * |
* along with this program; if not, write to the * |
* Free Software Foundation, Inc., * |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
* * |
* * |
* Credits to: * |
* Holger Buss & Ingo Busker from mikrokopter.de for the MK project + SVN * |
* http://www.mikrokopter.de * |
* Gregor "killagreg" Stobrawa for his version of the MK code * |
* Thomas Kaiser "thkais" for the original project. See * |
* http://www.ft-fanpage.de/mikrokopter/ * |
* http://forum.mikrokopter.de/topic-4061-1.html * |
* Claas Anders "CaScAdE" Rathje for providing the font and his C-OSD code * |
* http://www.mylifesucks.de/oss/c-osd/ * |
* Harald Bongartz "HaraldB" for providing his Ideas and Code for usibility* |
*****************************************************************************/ |
#ifndef _CONNECT_H |
#define _CONNECT_H |
void Change_Output(uint8_t UartMode); |
void Port_BT2Wi(void); |
void Port_BT2FC(void); |
void Port_FC2CFG_BT(void); |
void Port_USB2FC(void); |
void Port_USB2Wi(void); |
void Port_USB2CFG_Wi(void); |
#endif |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/cpu.h |
---|
0,0 → 1,41 |
/***************************************************************************** |
* Copyright (C) 2008 Thomas Kaiser, thomas@ft-fanpage.de * |
* Copyright (C) 2009 Peter "woggle" Mack, mac@denich.net * |
* Copyright (C) 2011 Christian "Cebra" Brandtner, brandtner@brandtner.net * |
* Copyright (C) 2011 Harald Bongartz * |
* * |
* This program is free software; you can redistribute it and/or modify * |
* it under the terms of the GNU General Public License as published by * |
* the Free Software Foundation; either version 2 of the License. * |
* * |
* This program is distributed in the hope that it will be useful, * |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
* GNU General Public License for more details. * |
* * |
* You should have received a copy of the GNU General Public License * |
* along with this program; if not, write to the * |
* Free Software Foundation, Inc., * |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
* * |
* * |
* Credits to: * |
* Holger Buss & Ingo Busker from mikrokopter.de for the MK project + SVN * |
* http://www.mikrokopter.de * |
* Gregor "killagreg" Stobrawa for his version of the MK code * |
* Thomas Kaiser "thkais" for the original project. See * |
* http://www.ft-fanpage.de/mikrokopter/ * |
* http://forum.mikrokopter.de/topic-4061-1.html * |
* Claas Anders "CaScAdE" Rathje for providing the font and his C-OSD code * |
* http://www.mylifesucks.de/oss/c-osd/ * |
* Harald Bongartz "HaraldB" for providing his Ideas and Code for usibility* |
*****************************************************************************/ |
#ifndef _CPU_H |
#define _CPU_H |
// Quarz Frequenz in Hz |
#define F_CPU 20000000UL |
#endif |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/debug.c |
---|
0,0 → 1,378 |
/***************************************************************************** |
* Copyright (C) 2008 Thomas Kaiser, thomas@ft-fanpage.de * |
* Copyright (C) 2009 Peter "woggle" Mack, mac@denich.net * |
* Copyright (C) 2011 Christian "Cebra" Brandtner, brandtner@brandtner.net * |
* Copyright (C) 2011 Harald Bongartz * |
* * |
* This program is free software; you can redistribute it and/or modify * |
* it under the terms of the GNU General Public License as published by * |
* the Free Software Foundation; either version 2 of the License. * |
* * |
* This program is distributed in the hope that it will be useful, * |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
* GNU General Public License for more details. * |
* * |
* You should have received a copy of the GNU General Public License * |
* along with this program; if not, write to the * |
* Free Software Foundation, Inc., * |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
* * |
* * |
* Credits to: * |
* Holger Buss & Ingo Busker from mikrokopter.de for the MK project + SVN * |
* http://www.mikrokopter.de * |
* Gregor "killagreg" Stobrawa for his version of the MK code * |
* Thomas Kaiser "thkais" for the original project. See * |
* http://www.ft-fanpage.de/mikrokopter/ * |
* http://forum.mikrokopter.de/topic-4061-1.html * |
* Claas Anders "CaScAdE" Rathje for providing the font and his C-OSD code * |
* http://www.mylifesucks.de/oss/c-osd/ * |
* Harald Bongartz "HaraldB" for providing his Ideas and Code for usibility* |
*****************************************************************************/ |
#include "cpu.h" |
#include <avr/io.h> |
#include <avr/pgmspace.h> |
#include <util/delay.h> |
#include <string.h> |
#include "main.h" |
#ifdef analognames |
//#include "menu.h" |
#include "lcd/lcd.h" |
#include "uart/usart.h" |
#include "debug.h" |
#include "timer/timer.h" |
#include "messages.h" |
#include "mk-data-structs.h" |
#ifdef HWVERSION3_9 |
#define TIMEOUT 200 // 2 sec |
#define ANALOGTIME 20 // 200 ms |
// WARNING: this work for NC & FC only |
// if current_hardware == MK3MAG or MKGPS the access is outside of the array... |
uint8_t AnalogNames[2][32][16 + 1]; // 32 names, 16 characters + 1 0x00 |
uint8_t AnalogNamesRead[2] = {0,0}; |
//-------------------------------------------------------------- |
// |
void GetAnalogNames (void) |
{ |
uint8_t i = AnalogNamesRead[current_hardware - 1]; |
uint8_t t = 0; |
lcd_cls (); |
lcd_printp_at (0, 3, PSTR("Reading"), 0); |
lcd_printp_at (0, 4, PSTR("Analog Names: "), 0); |
mode = 'A'; // read Names |
_delay_ms(200); |
rxd_buffer_locked = FALSE; |
timer = ANALOGTIME; |
while (i < 32) |
{ |
SendOutData ('a', ADDRESS_ANY, 1, &i, 1); |
while (!rxd_buffer_locked && timer); |
if (timer) |
{ |
Decode64 (); |
if (i == *pRxData) |
{ |
write_ndigit_number_u(14, 4, i, 2, 0,0); |
memcpy (AnalogNames[current_hardware - 1][*pRxData], (uint8_t *) pRxData + 1, 16); |
AnalogNames[current_hardware - 1][*pRxData][16] = 0; |
i++; |
t = 0; |
} |
else |
{ |
_delay_ms (100); |
} |
timer = ANALOGTIME; |
rxd_buffer_locked = FALSE; |
} |
else |
{ // timeout occured |
t++; |
timer = ANALOGTIME; |
if (t >= 50) |
{ |
lcd_printp_at (0, 2, PSTR("ERROR: no data"), 0); |
timer = 100; |
while (timer > 0); |
break; |
} |
} |
} |
AnalogNamesRead[current_hardware - 1] = i; |
#if 0 |
if (timer) |
{ |
for (page = 0; page < 5; page++) |
{ |
for (i = 0; i < 7; i++) |
{ |
lcd_print_at (0, i, AnalogNames[current_hardware - 1][i + page * 7], 0); |
} |
while (!get_key_press (1 << KEY_ESC)); // ESC |
get_key_press(KEY_ALL); |
} |
} |
//return; |
#endif |
} |
//-------------------------------------------------------------- |
// |
void display_debug (void) |
{ |
uint8_t i = 0; |
uint8_t tmp_dat; |
uint8_t page = 0; |
DebugData_t *DebugData; |
lcd_cls (); |
timer = TIMEOUT; |
if (AnalogNamesRead[current_hardware - 1] < 32) |
{ |
GetAnalogNames (); |
} |
if (!timer) |
{ |
return; |
} |
mode = 'D'; // Debug Data |
rxd_buffer_locked = FALSE; |
timer = TIMEOUT; |
tmp_dat = 10; |
SendOutData ('d', ADDRESS_ANY, 1, &tmp_dat, 1); |
abo_timer = ABO_TIMEOUT; |
for (i = 0; i < 7; i++) |
{ |
lcd_print_at (0, i, AnalogNames[current_hardware - 1][i + page * 7], 0); |
if (page == 4 && i > 3) |
{ |
for (i = 4; i < 7; i++) // Linie 4, 5, 6 loeschen |
{ |
lcd_cls_line (0, i, 21); |
} |
i = 7; |
} |
} |
do |
{ |
if (rxd_buffer_locked) |
{ |
Decode64 (); |
DebugData = (DebugData_t *) pRxData; |
// lcd_printp_at (0, 7, PSTR(KEY_LINE_3), 0); |
lcd_puts_at(0, 7, strGet(KEYLINE3), 0); |
lcd_write_number_u_at (5, 7, page + 1); |
switch (current_hardware) |
{ |
case FC: |
lcd_printp_at (3, 7, PSTR("FC"), 0); |
lcd_printp_at (19, 7, PSTR("NC"), 0); |
break; |
case NC: |
lcd_printp_at (3, 7, PSTR("NC"), 0); |
lcd_printp_at (19, 7, PSTR("FC"), 0); |
break; |
default: |
lcd_printp_at (19, 7, PSTR("?"), 0); |
break; |
} |
for (i = 0; i < 7; i++) |
{ |
//lcd_print_at (0, i, AnalogNames[i + page * 7], 0); |
uint8_t size =0; |
if( DebugData->Analog[i + page * 7] < -9999) |
{ |
size = 6; |
} |
else if ( DebugData->Analog[i + page * 7] < -999) |
{ |
size = 5; |
} |
else if ( DebugData->Analog[i + page * 7] < -99) |
{ |
size = 4; |
} |
else if ( DebugData->Analog[i + page * 7] < 999) |
{ |
size = 3; |
} |
else if ( DebugData->Analog[i + page * 7] < 9999) |
{ |
size = 4; |
} |
else |
{ |
size = 5; |
} |
write_ndigit_number_s (21-size, i, DebugData->Analog[i + page * 7], size, 0,0); |
if (page == 4 && i > 3) |
{ |
for (i = 4; i < 7; i++) // Linie 4, 5, 6 loeschen |
{ |
lcd_cls_line (0, i, 21); |
} |
i = 7; |
} |
} |
timer = TIMEOUT; |
rxd_buffer_locked = FALSE; |
} |
if (!abo_timer) |
{ // renew abo every 3 sec |
// request OSD Data from NC every 100ms |
// RS232_request_mk_data (1, 'o', 100); |
tmp_dat = 10; |
SendOutData ('d', ADDRESS_ANY, 1, &tmp_dat, 1); |
abo_timer = ABO_TIMEOUT; |
} |
if (get_key_press (1 << KEY_MINUS)) |
{ |
page--; |
if (page > 4) |
{ |
page = 4; |
} |
lcd_cls (); |
for (i = 0; i < 7; i++) |
{ |
lcd_print_at (0, i, AnalogNames[current_hardware - 1][i + page * 7], 0); |
if (page == 4 && i > 3) |
{ |
for (i = 4; i < 7; i++) // Linie 4, 5, 6 loeschen |
{ |
lcd_cls_line (0, i, 21); |
} |
i = 7; |
} |
} |
} |
else if (get_key_press (1 << KEY_PLUS)) |
{ |
page++; |
if (page > 4) |
{ |
page = 0; |
} |
lcd_cls (); |
for (i = 0; i < 7; i++) |
{ |
lcd_print_at (0, i, AnalogNames[current_hardware - 1][i + page * 7], 0); |
if (page == 4 && i > 3) |
{ |
for (i = 4; i < 7; i++) // Linie 4, 5, 6 loeschen |
{ |
lcd_cls_line (0, i, 21); |
} |
i = 7; |
} |
} |
} |
if ((hardware == NC) && get_key_press (1 << KEY_ENTER)) |
{ |
tmp_dat = 0; |
SendOutData ('d', ADDRESS_ANY, 1, &tmp_dat, 1); |
_delay_ms (200); |
if (current_hardware == NC) |
{ |
SwitchToFC(); |
timer = TIMEOUT; |
} |
else |
{ |
SwitchToNC(); |
timer = TIMEOUT; |
} |
_delay_ms (200); |
if (AnalogNamesRead[current_hardware - 1] < 32) |
{ |
GetAnalogNames (); |
} |
mode = 'D'; // Debug Data |
rxd_buffer_locked = FALSE; |
timer = TIMEOUT; |
tmp_dat = 10; |
SendOutData ('d', ADDRESS_ANY, 1, &tmp_dat, 1); |
lcd_cls (); |
page = 0; |
for (i = 0; i < 7; i++) |
{ |
lcd_print_at (0, i, AnalogNames[current_hardware - 1][i + page * 7], 0); |
if (page == 4 && i > 3) |
{ |
for (i = 4; i < 7; i++) // Linie 4, 5, 6 loeschen |
{ |
lcd_cls_line (0, i, 21); |
} |
i = 7; |
} |
} |
} |
} |
while (!get_key_press (1 << KEY_ESC) && timer); // ESC |
get_key_press(KEY_ALL); |
tmp_dat = 0; |
SendOutData ('d', ADDRESS_ANY, 1, &tmp_dat, 1); |
mode = 0; |
rxd_buffer_locked = FALSE; |
if (!timer) |
{ // timeout occured |
lcd_cls (); |
lcd_printp_at (0, 2, PSTR("ERROR: no data"), 0); |
timer = 100; |
while (timer > 0); |
} |
SwitchToNC(); |
} |
#endif |
#endif |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/debug.h |
---|
0,0 → 1,42 |
/***************************************************************************** |
* Copyright (C) 2008 Thomas Kaiser, thomas@ft-fanpage.de * |
* Copyright (C) 2009 Peter "woggle" Mack, mac@denich.net * |
* Copyright (C) 2011 Christian "Cebra" Brandtner, brandtner@brandtner.net * |
* Copyright (C) 2011 Harald Bongartz * |
* * |
* This program is free software; you can redistribute it and/or modify * |
* it under the terms of the GNU General Public License as published by * |
* the Free Software Foundation; either version 2 of the License. * |
* * |
* This program is distributed in the hope that it will be useful, * |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
* GNU General Public License for more details. * |
* * |
* You should have received a copy of the GNU General Public License * |
* along with this program; if not, write to the * |
* Free Software Foundation, Inc., * |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
* * |
* * |
* Credits to: * |
* Holger Buss & Ingo Busker from mikrokopter.de for the MK project + SVN * |
* http://www.mikrokopter.de * |
* Gregor "killagreg" Stobrawa for his version of the MK code * |
* Thomas Kaiser "thkais" for the original project. See * |
* http://www.ft-fanpage.de/mikrokopter/ * |
* http://forum.mikrokopter.de/topic-4061-1.html * |
* Claas Anders "CaScAdE" Rathje for providing the font and his C-OSD code * |
* http://www.mylifesucks.de/oss/c-osd/ * |
* Harald Bongartz "HaraldB" for providing his Ideas and Code for usibility* |
*****************************************************************************/ |
#ifndef _DEBUG_H |
#define _DEBUG_H |
extern uint8_t AnalogNamesRead[2]; |
void display_debug(void); |
#endif |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/display.c |
---|
0,0 → 1,180 |
/***************************************************************************** |
* Copyright (C) 2008 Thomas Kaiser, thomas@ft-fanpage.de * |
* Copyright (C) 2009 Peter "woggle" Mack, mac@denich.net * |
* Copyright (C) 2011 Christian "Cebra" Brandtner, brandtner@brandtner.net * |
* Copyright (C) 2011 Harald Bongartz * |
* * |
* This program is free software; you can redistribute it and/or modify * |
* it under the terms of the GNU General Public License as published by * |
* the Free Software Foundation; either version 2 of the License. * |
* * |
* This program is distributed in the hope that it will be useful, * |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
* GNU General Public License for more details. * |
* * |
* You should have received a copy of the GNU General Public License * |
* along with this program; if not, write to the * |
* Free Software Foundation, Inc., * |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
* * |
* * |
* Credits to: * |
* Holger Buss & Ingo Busker from mikrokopter.de for the MK project + SVN * |
* http://www.mikrokopter.de * |
* Gregor "killagreg" Stobrawa for his version of the MK code * |
* Thomas Kaiser "thkais" for the original project. See * |
* http://www.ft-fanpage.de/mikrokopter/ * |
* http://forum.mikrokopter.de/topic-4061-1.html * |
* Claas Anders "CaScAdE" Rathje for providing the font and his C-OSD code * |
* http://www.mylifesucks.de/oss/c-osd/ * |
* Harald Bongartz "HaraldB" for providing his Ideas and Code for usibility* |
*****************************************************************************/ |
#include "cpu.h" |
#include <avr/io.h> |
#include <avr/pgmspace.h> |
#include <util/delay.h> |
#include "main.h" |
#include "lcd/lcd.h" |
#include "uart/usart.h" |
#include "timer/timer.h" |
#include "messages.h" |
#include "mk-data-structs.h" |
#define TIMEOUT 500 // 5 sec |
void display_data (void) |
{ |
uint8_t cmd; |
uint8_t flag = 0;; |
mode = 'H'; |
lcd_cls (); |
// lcd_printp_at (0, 7, PSTR(KEY_LINE_3), 0); |
lcd_puts_at(0, 7, strGet(KEYLINE3), 0); |
if (current_hardware == NC) |
{ |
lcd_printp_at (0, 0, PSTR(" Navi-Ctrl Display "), 2); |
lcd_printp_at (19, 7, PSTR("FC"), 0); |
} |
else |
{ |
if (hardware == FC) |
{ |
lcd_printp_at (0, 0, PSTR(" Display "), 2); |
lcd_printp_at (19, 7, PSTR(" "), 0); |
} |
else |
{ |
lcd_printp_at (0, 0, PSTR(" Flight-Ctrl Display "), 2); |
lcd_printp_at (19, 7, PSTR("NC"), 0); |
} |
} |
rxd_buffer_locked = FALSE; |
timer = TIMEOUT; |
cmd = 0xfc; // Home = first page |
do |
{ |
SendOutData('h', ADDRESS_ANY, 1, &cmd, 1); |
cmd = 0xff; |
//LED6_TOGGLE; |
_delay_ms (250); |
if (rxd_buffer_locked) |
{ |
Decode64 (); |
flag = 1; |
if (!hardware) |
{ // hardware was not detected at startup |
hardware = rxd_buffer[1] - 'a'; |
if (hardware == NC) |
{ |
lcd_printp_at (0, 0, PSTR(" Navi-Ctrl Display "), 2); |
lcd_printp_at (19, 7, PSTR("FC"), 0); |
current_hardware = NC; |
} |
else |
{ |
lcd_printp_at (0, 0, PSTR(" Display "), 2); |
lcd_printp_at (19, 7, PSTR(" "), 0); |
current_hardware = FC; |
} |
} |
#if 0 |
rxd_buffer[24] = 0; |
lcd_print_at (0, rxd_buffer[3] + 1, (uint8_t *) &rxd_buffer[4], 0); |
#else |
rxd_buffer[83] = 0; |
print_display_at (0, 2, (uint8_t *) &rxd_buffer[3]); |
#endif |
rxd_buffer_locked = FALSE; |
timer = TIMEOUT; |
} |
if (get_key_press (1 << KEY_MINUS) || get_key_long_rpt_sp ((1 << KEY_MINUS), 2)) |
{ |
cmd = 0xfe; // next page |
//SendOutData('h', ADDRESS_ANY, 1, &cmd, 1); |
//cmd = 0; |
} |
else if (get_key_press (1 << KEY_PLUS) || get_key_long_rpt_sp ((1 << KEY_PLUS), 2)) |
{ |
cmd = 0xfd; // previous page |
//SendOutData('h', ADDRESS_ANY, 1, &cmd, 1); |
//cmd = 0; |
} |
else if ((hardware == NC) && get_key_press (1 << KEY_ENTER)) |
{ |
if (current_hardware == NC) |
{ |
SwitchToFC(); |
//timer = TIMEOUT; |
lcd_printp_at (0, 0, PSTR(" Flight-Ctrl Display "), 2); |
lcd_printp_at (19, 7, PSTR("NC"), 0); |
} |
else |
{ |
SwitchToNC(); |
//timer = TIMEOUT; |
lcd_printp_at (0, 0, PSTR(" Navi-Ctrl Display "), 2); |
lcd_printp_at (19, 7, PSTR("FC"), 0); |
} |
cmd = 0xfc; // Home = first page |
//SendOutData('h', ADDRESS_ANY, 1, &cmd, 1); |
//cmd = 0; |
} |
} |
while (!get_key_press (1 << KEY_ESC) && timer); |
get_key_press(KEY_ALL); |
mode = 0; |
rxd_buffer_locked = FALSE; |
if (!timer) |
{ // timeout occured |
if (flag) |
{ |
lcd_cls (); |
} |
lcd_printp_at (0, 2, PSTR("Fehler: Keine Daten"), 0); |
timer = 100; |
while (timer > 0); |
} |
SwitchToNC(); |
} |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/display.h |
---|
0,0 → 1,42 |
/***************************************************************************** |
* Copyright (C) 2008 Thomas Kaiser, thomas@ft-fanpage.de * |
* Copyright (C) 2009 Peter "woggle" Mack, mac@denich.net * |
* Copyright (C) 2011 Christian "Cebra" Brandtner, brandtner@brandtner.net * |
* Copyright (C) 2011 Harald Bongartz * |
* * |
* This program is free software; you can redistribute it and/or modify * |
* it under the terms of the GNU General Public License as published by * |
* the Free Software Foundation; either version 2 of the License. * |
* * |
* This program is distributed in the hope that it will be useful, * |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
* GNU General Public License for more details. * |
* * |
* You should have received a copy of the GNU General Public License * |
* along with this program; if not, write to the * |
* Free Software Foundation, Inc., * |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
* * |
* * |
* Credits to: * |
* Holger Buss & Ingo Busker from mikrokopter.de for the MK project + SVN * |
* http://www.mikrokopter.de * |
* Gregor "killagreg" Stobrawa for his version of the MK code * |
* Thomas Kaiser "thkais" for the original project. See * |
* http://www.ft-fanpage.de/mikrokopter/ * |
* http://forum.mikrokopter.de/topic-4061-1.html * |
* Claas Anders "CaScAdE" Rathje for providing the font and his C-OSD code * |
* http://www.mylifesucks.de/oss/c-osd/ * |
* Harald Bongartz "HaraldB" for providing his Ideas and Code for usibility* |
*****************************************************************************/ |
#ifndef _DISPLAY_H |
#define _DISPLAY_H |
void display_data (void); |
#endif |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/eeprom/eeprom.c |
---|
0,0 → 1,329 |
/***************************************************************************** |
* Copyright (C) 2008 Thomas Kaiser, thomas@ft-fanpage.de * |
* Copyright (C) 2009 Peter "woggle" Mack, mac@denich.net * |
* Copyright (C) 2013 Christian "Cebra" Brandtner, brandtner@brandtner.net * |
* Copyright (C) 2011 Harald Bongartz * |
* * |
* This program is free software; you can redistribute it and/or modify * |
* it under the terms of the GNU General Public License as published by * |
* the Free Software Foundation; either version 2 of the License. * |
* * |
* This program is distributed in the hope that it will be useful, * |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
* GNU General Public License for more details. * |
* * |
* You should have received a copy of the GNU General Public License * |
* along with this program; if not, write to the * |
* Free Software Foundation, Inc., * |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
* * |
* * |
* Credits to: * |
* Holger Buss & Ingo Busker from mikrokopter.de for the MK project + SVN * |
* http://www.mikrokopter.de * |
* Gregor "killagreg" Stobrawa for his version of the MK code * |
* Thomas Kaiser "thkais" for the original project. See * |
* http://www.ft-fanpage.de/mikrokopter/ * |
* http://forum.mikrokopter.de/topic-4061-1.html * |
* Claas Anders "CaScAdE" Rathje for providing the font and his C-OSD code * |
* http://www.mylifesucks.de/oss/c-osd/ * |
* Harald Bongartz "HaraldB" for providing his Ideas and Code for usibility* |
*****************************************************************************/ |
#include "../cpu.h" |
#include <avr/io.h> |
#include <avr/pgmspace.h> |
#include <util/delay.h> |
#include <stdlib.h> |
#include <string.h> |
#include <avr/interrupt.h> |
#include <avr/eeprom.h> |
#include <stdbool.h> |
#include <avr/wdt.h> |
#include "../lcd/lcd.h" |
#include "../main.h" |
#include "../timer/timer.h" |
#include "eeprom.h" |
#include "../wi232/Wi232.h" |
#include "../setup/setup.h" |
#include "../bluetooth/bluetooth.h" |
#include "../mk-data-structs.h" |
#include "../connect.h" |
#include "../tracking/ng_servo.h" |
#include "../tracking/tracking.h" |
//------------------------------------------------------------------------------------------ |
ST EEMEM EEStruct; |
ST Config; |
//------------------------------------------------------------------------------------------ |
void WriteWiInitFlag(void) |
{ |
Config.WiIsSet = true; |
// WriteParameter(); |
} |
//-------------------------------------------------------------- |
// |
void WriteBTInitFlag(void) |
{ |
Config.BTIsSet = true; |
// WriteParameter(); |
} |
//-------------------------------------------------------------- |
// |
void WriteBTSlaveFlag(void) |
{ |
Config.BTIsSlave = true; |
// WriteParameter(); |
} |
//-------------------------------------------------------------- |
// |
void WriteBTMasterFlag(void) |
{ |
Config.BTIsSlave = false; |
// WriteParameter(); |
} |
//-------------------------------------------------------------- |
// |
void WriteLastPosition(uint32_t ELongitude,uint32_t ELatitude) |
{ |
Config.LastLongitude = ELongitude; |
Config.LastLatitude = ELatitude; |
// WriteParameter(); |
} |
//-------------------------------------------------------------- |
// |
void ReadParameter (void) |
{ |
uint8_t update=false; |
eeprom_read_block((void*)&Config, (const void*)&EEStruct, sizeof(ST)); |
if (Config.Version != EEpromVersion) |
{ |
switch (Config.Version) |
{ |
case 0x77: // PKT Version 3.6.6a |
PointList_Clear(); |
update = true; |
break; |
case 0x78: // PKT Version 3.6.6b |
/* Do necessary steps to perform upgrade */ |
update = true; |
break; |
default:Delete_EEPROM(); //wenn kein Update möglich alles auf Default setzen |
break; |
} |
if (update) |
{ |
Config.Version = EEpromVersion; /* Update the EEPROM version number */ |
sei(); |
lcd_cls(); |
lcd_printp_at (0, 2, PSTR("EEPromUpdate to new"), 0); |
lcd_printp_at (0, 3, PSTR(" Version "), 0); |
lcd_printp_at (0, 5, PSTR("check the settings!"), 0); |
lcd_printp_at (18, 7, PSTR("OK"), 0); |
while (!get_key_press (1 << KEY_ENTER)); |
WriteParameter(); |
cli(); |
} |
} |
} |
void WriteParameter (void) |
{ |
copy_line(7); |
lcd_printp_at (0, 7, PSTR(" Write EEPROM "), 0); |
eeprom_update_block((const void*)&Config, (void*)&EEStruct, sizeof(ST)); |
paste_line(7); |
} |
//-------------------------------------------------------------- |
void Delete_EEPROM(void) |
{ |
// EEPROM auf Default setzen |
lcd_cls(); |
lcd_printp_at (0, 0, PSTR(" EEPROM Parameter "), 2); |
lcd_printp_at (0, 1, PSTR("werden auf"), 0); |
lcd_printp_at (0, 2, PSTR("Standardwerte gesetzt"), 0); |
Config.MK_LowBat = 137; // 13,7V |
Config.DisplayTimeout = 0; // Display immer an |
Config.DisplayLanguage = 5; // default undefined |
Config.WiTXRXChannel = 1; // Kanal 1 MK Standard |
Config.WiNetworkGroup = 66; // Gruppe 66 MK Standard |
Config.WiNetworkMode = NetMode_Normal; // MK Standard |
Config.WiTXTO = TWaitTime16; // MK Standard |
Config.WiUartMTU = UartMTU64; // MK Standard |
Config.LCD_ORIENTATION = 0; // normale Ansicht |
Config.LCD_DisplayMode = 0; // Normal |
Config.LCD_Kontrast = 20; // Kontrast normal |
Config.LCD_Helligkeit = 100; // Helligkeit in % |
Config.USBBT = 0; // USB Betrieb |
Config.U02SV2 = 0; // SV2 (Kabel) Standard |
Config.Debug = 0; // kein Debug |
Config.UseWi = false; // Wi.232 eingebaut? |
Config.UseBT = false; // BT-222 eingebaut? |
Config.WiIsSet = true; // Flag für die Initialisierung Wi232 |
Config.BTIsSet = true; // Flag für die Initialisierung Bluetooth |
Config.BTIsSlave = true; // Slave Flag setzen |
Config.PKT_IdleBeep = 0; // kein Piepsen bei Inaktivität |
Config.PKT_StartInfo = false; // Startinformationen anzeigen |
Config.PKT_Accutyp = true; // True = Lipo, False= LiON |
Config.OSD_RCErrorbeep = true; // OSD Receiveerrorbeep |
Config.OSD_InvertOut = false; // LED Anzeige invertiren |
Config.OSD_LEDform = 1; // Form der Anzeige ( + oder schwarz) |
Config.OSD_SendOSD = false; // OSD Daten an SV2 |
Config.OSD_Fallspeed = 40; // maximale Sinkrate |
Config.OSD_VarioBeep = 1; // Vario Beep ein |
Config.OSD_HomeMKView = true; // Home Circle from MK View |
Config.OSD_mAh_Warning = 10000; //mAh Warnschwelle |
Config.OSD_ScreenMode = 0; // Variante des OSD Screen |
Config.OSD_LipoBar = 0; //Bargraphanzeige für MK Lipo |
Config.PKT_Baudrate = Baud_57600; //Baudrate für BT und Wi232 |
Config.Lipo_UOffset = 6000; // Offset für PKT-Lipomessung |
Config.FM_Refresh = 500; // FollowMe interval |
Config.FM_Speed = 30; // FollowMe Speed in m/s *0.1 |
Config.FM_Radius = 5; // Waypoint Tolerance Radius in meter |
Config.HWSound = 0; // Hardware Sounderweiterung an PD7 |
Config.HWBeeper = 1; // Hardware Beeper an PC7 |
Config.Volume = 0; //Lautstärke |
Config.LastLongitude = 88199720; |
Config.LastLatitude = 522039630; |
strcpy_P(Config.bt_pin, PSTR("0000")); |
strcpy_P(Config.bt_name, PSTR("PKT Cebra ")); // Wenn Name kürzer als "bt_name_length" mit Leerzeichen auffüllen |
strcpy_P(Config.bt_Mac, PSTR("0000-00-000000")); |
strcpy_P(Config.RE_ID, PSTR("0000")); |
for(uint8_t i = 0; i < 20; i++) |
{ |
Config.gps_UsedDevName[i] = 0; // benutztes GPS Device Name |
} |
for(uint8_t i = 0; i < 14; i++) |
{ |
Config.gps_UsedMac[i] = '0'; // benutztes GPS Device Mac Adresse |
} |
Config.gps_UseGPS = false; // ist GPS aktiv? |
Config.gps_UsedGPSMouse = GPS_Bluetoothmouse1; |
Config.WiIsSet = false; |
Config.BTIsSet = false; |
Config.Version = EEpromVersion; |
Config.sIdxSteps= STEPS_255; |
Config.servo[0].rev = SERVO_REV; |
Config.servo[0].min = SERVO_I0_RIGHT; |
Config.servo[0].max = SERVO_I0_LEFT; |
Config.servo[0].mid = SERVO_I0_MIDDLE; |
Config.servo[1].rev = SERVO_REV; |
Config.servo[1].min = SERVO_I0_RIGHT; |
Config.servo[1].max = SERVO_I0_LEFT; |
Config.servo[1].mid = SERVO_I0_MIDDLE; |
Config.servo_frame = SERVO_PERIODE; |
Config.single_step= SINGLE_STEP; // nur bei Test-Servo |
Config.repeat= REPEAT; // nur bei Test-Servo |
Config.pause = PAUSE; // nur bei Test-Servo |
Config.pause_step= PAUSE_STEP; // nur bei Test-Servo |
Config.tracking = TRACKING_MIN; |
Config.track_hyst = TRACKING_HYSTERESE; |
Config.track_tx = 0; |
for (uint8_t i = 0; i < 5; i++) { |
Config.stick_min[i] = 30+i; |
Config.stick_max[i] = 270+i; |
Config.stick_typ[i] = 0; |
Config.stick_dir[i] = 0; |
Config.stick_neutral[i] = 0; |
} |
Config.Lipomessung = true; |
PointList_Clear(); |
WriteParameter(); |
// lcd_printp_at (0, 4, PSTR("Waypoints loeschen"), 0); |
// EEWayPointList_Clear(); |
lcd_printp_at (0, 6, PSTR("!!Check Parameter!! "), 0); |
lcd_printp_at (18, 7, PSTR("OK"), 0); |
sei (); |
set_beep ( 200, 0x0080, BeepNormal); |
do{} |
while (!(get_key_press (1 << KEY_ENTER))); |
#if defined HWVERSION3_9 |
clr_V_On(); |
#else |
wdt_enable( WDTO_250MS ); |
while (1) |
{;} |
#endif |
} |
//-------------------------------------------------------------- |
// |
//void EEWayPointList_Clear(void) // löschen der Waypointliste im EEProm |
//{ |
// uint8_t i; |
// PKTWayPoint.Waypoint.Position.Latitude = 0; |
// PKTWayPoint.Waypoint.Position.Longitude = 0; |
// PKTWayPoint.Waypoint.Position.Altitude = 0; |
// PKTWayPoint.Waypoint.Heading = 361; |
// for(i = 0; i < MAX_WPLIST_LEN; i++) |
// { |
// PKTWayPointDirectory.WPList.WPDirectory[i] = 0; |
// } |
// for(i = 0; i < NumberOfWaypoints; i++) |
// { |
// lcd_printp (PSTR("."), 0); |
// eeprom_write_byte (&EEWayPointList[i].WPIndex, i); |
// eeprom_write_byte (&EEWayPointList[i].Waypoint.Position.Status, INVALID); |
// eeprom_write_block ((const void*)&PKTWayPoint.Waypoint.Position.Latitude, (void*)&EEWayPointList[i].Waypoint.Position.Latitude, sizeof(EEWayPointList[i].Waypoint.Position.Latitude)); |
// eeprom_write_block ((const void*)&PKTWayPoint.Waypoint.Position.Longitude, (void*)&EEWayPointList[i].Waypoint.Position.Longitude, sizeof(EEWayPointList[i].Waypoint.Position.Longitude)); |
// eeprom_write_block ((const void*)&PKTWayPoint.Waypoint.Position.Altitude, (void*)&EEWayPointList[i].Waypoint.Position.Altitude, sizeof(EEWayPointList[i].Waypoint.Position.Altitude)); |
// eeprom_write_block ((const void*)&PKTWayPoint.Waypoint.Heading, (void*)&EEWayPointList[i].Waypoint.Heading, sizeof(EEWayPointList[i].Waypoint.Heading)); |
// |
// eeprom_write_byte (&EEWayPointList[i].Waypoint.ToleranceRadius, 0); // in meters, if the MK is within that range around the target, then the next target is triggered |
// eeprom_write_byte (&EEWayPointList[i].Waypoint.HoldTime, 0); // in seconds, if the was once in the tolerance area around a WP, this time defines the delay before the next WP is triggered |
// eeprom_write_byte (&EEWayPointList[i].Waypoint.Type, POINT_TYPE_INVALID); |
// eeprom_write_byte (&EEWayPointList[i].Waypoint.Event_Flag, 0); // future implementation |
// eeprom_write_byte (&EEWayPointList[i].Waypoint.AltitudeRate, 0); // no change of setpoint |
// } |
// for(i = 0; i < NumberOfWPLists; i++) |
// { |
// lcd_printp (PSTR("."), 0); |
// eeprom_write_byte (&EEWPDirectory[i].WPList.WPListnumber, i); |
// eeprom_write_byte (&EEWPDirectory[i].WPList.WPListAktiv, false); |
// eeprom_write_byte (&EEWPDirectory[i].WPList.POI_CAM_NICK_CTR, 0); |
// eeprom_write_byte (&EEWPDirectory[i].WPList.UsePOI, 0); |
// eeprom_write_block ((const void*)&PKTWayPointDirectory.WPList.WPDirectory, (void*)&EEWPDirectory[i].WPList.WPDirectory, sizeof(EEWPDirectory[i].WPList.WPDirectory)); |
// |
// } |
// lcd_printp (PSTR("\r\n"), 0); |
//} |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/eeprom/eeprom.h |
---|
0,0 → 1,218 |
/***************************************************************************** |
* Copyright (C) 2008 Thomas Kaiser, thomas@ft-fanpage.de * |
* Copyright (C) 2009 Peter "woggle" Mack, mac@denich.net * |
* Copyright (C) 2013 Christian "Cebra" Brandtner, brandtner@brandtner.net * |
* Copyright (C) 2011 Harald Bongartz * |
* * |
* This program is free software; you can redistribute it and/or modify * |
* it under the terms of the GNU General Public License as published by * |
* the Free Software Foundation; either version 2 of the License. * |
* * |
* This program is distributed in the hope that it will be useful, * |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
* GNU General Public License for more details. * |
* * |
* You should have received a copy of the GNU General Public License * |
* along with this program; if not, write to the * |
* Free Software Foundation, Inc., * |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
* * |
* * |
* Credits to: * |
* Holger Buss & Ingo Busker from mikrokopter.de for the MK project + SVN * |
* http://www.mikrokopter.de * |
* Gregor "killagreg" Stobrawa for his version of the MK code * |
* Thomas Kaiser "thkais" for the original project. See * |
* http://www.ft-fanpage.de/mikrokopter/ * |
* http://forum.mikrokopter.de/topic-4061-1.html * |
* Claas Anders "CaScAdE" Rathje for providing the font and his C-OSD code * |
* http://www.mylifesucks.de/oss/c-osd/ * |
* Harald Bongartz "HaraldB" for providing his Ideas and Code for usibility* |
*****************************************************************************/ |
#ifndef _EEPROM_H |
#define _EEPROM_H |
#include <stdbool.h> |
#include "../mk-data-structs.h" |
#include "../connect.h" |
#include "../tracking/ng_servo.h" |
#include "../waypoints/waypoints.h" |
//[General] |
//FileVersion = 2 |
//NumberOfWaypoints = 15 |
//UsePOI = 0 |
//POI_CAM_NICK_CTRL = 0 |
//[POI] |
//Altitude = 1 |
//Latitude = 46.7140763 |
//Longitude = 19.2507334 |
//[Waypoint1] |
//Latitude = 46.7145686 |
//Longitude = 19.2515702 |
//Radius = 10 |
//Altitude = 15 |
//ClimbRate = 0 |
//DelayTime = 4 |
//WP_Event_Channel_Value = 96 |
//Heading = 180 |
#define EEpromVersion 0x78 //wird nach jeder Parametererweiterung hochgezählt |
#define NumberOfWaypoints 55 //Anzahl der Waypoints in der EEPromliste |
#define NumberOfWPLists 5 //Anzahl WP Listen im PKT |
#define MAX_LIST_LEN 31 // Länge Waypointlist |
#define bt_pin_length 4 |
#define RE_ID_length 4 // Länge der RE-ID |
#define bt_name_length 10 |
#define bt_mac_length 14 |
#define GPS_Bluetoothmouse1 0 //NMEA BT-Mouse |
#define GPS_Mikrokopter 1 // GPS Daten vom MK für Tracking |
#define POINT_TYPE_INVALID 255 |
#define POINT_TYPE_WP 0 |
#define POINT_TYPE_POI 1 |
#define INVALID 0x00 |
#define MAX_WPLIST_LEN 31 |
typedef struct { |
uint8_t rev; |
uint16_t min; |
uint16_t max; |
uint16_t mid; |
} servo_t; |
typedef struct |
{ |
uint8_t WPIndex; // Index in der EEpromliste |
Point_t Waypoint; // Waypoint |
} WayPoints; |
typedef struct |
{ |
uint8_t WPListnumber; // Nummer der WP Liste im PKT |
uint8_t WPListAktiv; // Liste aktiv |
uint8_t WPDirectory[31]; // Enthält die Indexe der Waypoints im EEPROM |
uint8_t UsePOI; |
uint8_t POI_CAM_NICK_CTR; |
} WPListHeader; |
typedef struct |
{ |
WPListHeader WPList; // Waypointliste im PKT |
} WPListDirectory; |
typedef struct SStructure{ |
uint8_t Version; |
uint8_t MK_LowBat; |
volatile uint8_t DisplayTimeout; |
volatile uint8_t DisplayLanguage; |
volatile uint8_t WiTXRXChannel; |
volatile uint8_t WiNetworkGroup; |
volatile uint8_t WiNetworkMode; |
volatile uint8_t WiTXTO; |
volatile uint8_t WiUartMTU; |
volatile uint8_t LCD_ORIENTATION; |
volatile uint8_t LCD_DisplayMode; |
volatile uint8_t LCD_Kontrast; |
volatile uint8_t LCD_Helligkeit; |
volatile uint8_t USBBT; |
volatile uint8_t U02SV2; |
volatile uint8_t Debug; |
volatile uint8_t UseWi; // Wi232 wird genutzt |
volatile uint8_t UseBT; // BT wird genutzt |
volatile uint8_t WiIsSet; // Wi232 ist initialisiert |
volatile uint8_t BTIsSet; // BT ist initialisiert |
volatile uint8_t BTIsSlave; // Slave Flag |
char bt_pin[bt_pin_length + 1]; // BT Pinnummer |
char bt_name[bt_name_length + 1]; // BT Name |
char RE_ID[RE_ID_length + 1]; // RE-ID |
char bt_Mac[bt_mac_length + 1]; // MAC-Adresse BTM222 |
char gps_UsedDevName[20]; // benutztes GPS Device Name |
char gps_UsedMac[14]; // benutztes GPS Device Mac Adresse |
volatile uint8_t gps_UseGPS; // ist GPS aktiv? |
volatile uint8_t gps_UsedGPSMouse; // GPS Maustyp |
volatile uint32_t LastLongitude; // Letzte Position |
volatile uint32_t LastLatitude; |
volatile uint8_t PKT_IdleBeep; |
volatile uint8_t PKT_StartInfo; |
volatile uint16_t Lipo_UOffset; // Offset für die Lipospannugsmessung |
volatile uint8_t PKT_Accutyp; // verwendeter Akkutyp |
volatile uint8_t OSD_RCErrorbeep; //Empfangsausffallwarnung im OSD Screen |
volatile uint8_t OSD_InvertOut; // Out1/2 invertiert anzeigen |
volatile uint8_t OSD_LEDform; // Form der Anzeige ( + oder schwarz) |
volatile uint8_t OSD_SendOSD; // OSD Daten an SV2 senden |
volatile uint8_t OSD_Fallspeed; // maximale Sinkrate |
volatile uint8_t OSD_VarioBeep; // Vario Beep im OSD Screen |
volatile uint8_t OSD_HomeMKView; // Home Circle from MK-View |
volatile uint16_t OSD_mAh_Warning; // mAh Warnschwelle |
volatile uint8_t OSD_ScreenMode; //Variante des OSD-Screen |
volatile uint8_t OSD_LipoBar; //Bargraphanzeige für MK Lipo |
volatile uint8_t PKT_Baudrate; // Baudrate für BT und Wi232 |
volatile uint16_t FM_Refresh; // FollowMe interval |
volatile uint16_t FM_Speed; // FollowMe Speed in m/s *0.1 |
volatile uint16_t FM_Radius; // Waypoint Tolerance Radius in meter |
volatile uint8_t HWSound; // Hardware Sounderweiterung an PD7 |
volatile uint8_t HWBeeper; // Hardware Beeper an PC7 |
volatile uint8_t Volume; // Lautstärke |
volatile servo_t servo[2]; |
volatile uint8_t sIdxSteps; |
volatile uint16_t hyst_u_min; |
volatile uint8_t servo_frame; |
volatile uint8_t single_step; |
volatile uint8_t repeat; |
volatile uint8_t pause; |
volatile uint8_t pause_step; |
volatile uint8_t tracking; |
volatile uint8_t track_hyst; |
volatile uint8_t track_tx; |
// Stickparameter |
volatile uint16_t stick_min[5]; |
volatile uint16_t stick_max[5]; |
volatile uint8_t stick_typ[5]; |
volatile uint8_t stick_dir[5]; |
volatile uint8_t stick_neutral[5]; // ja/nein |
volatile uint8_t Lipomessung; // wenn Lipomessung deaktiviert(Lötbrücke öffnen), kann der Kanal als Stick verwendet werden |
Point_t PointList[MAX_LIST_LEN]; // ab 3.6.6b EEPROM Version 78 |
//!!!neue Parameter immer am Ende anfügen!!!!!! |
} ST; |
extern ST Config; |
void ReadParameter (void); |
void WriteParameter (void); |
void ReadLastPosition(void); |
void WriteLastPosition(uint32_t ELongitude,uint32_t ELatitude); |
void WriteWiInitFlag(void); |
void WriteBTInitFlag(void); |
void WriteBTSlaveFlag(void); |
void WriteBTMasterFlag(void); |
void Delete_EEPROM(void); |
//void EEWayPointList_Clear(void); // l�schen der Waypointliste im EEProm |
#endif |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/followme/followme.c |
---|
0,0 → 1,338 |
/* |
* FollowMe.c |
* |
* Created on: 18.05.2012 |
* Author: cebra |
*/ |
/***************************************************************************** |
* Copyright (C) 2011 Christian "Cebra" Brandtner, brandtner@brandtner.net * |
* * |
* This program is free software; you can redistribute it and/or modify * |
* it under the terms of the GNU General Public License as published by * |
* the Free Software Foundation; either version 2 of the License. * |
* * |
* This program is distributed in the hope that it will be useful, * |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
* GNU General Public License for more details. * |
* * |
* You should have received a copy of the GNU General Public License * |
* along with this program; if not, write to the * |
* Free Software Foundation, Inc., * |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
* * |
* * |
* Credits to: * |
* Holger Buss & Ingo Busker from mikrokopter.de for the MK project + SVN * |
* http://www.mikrokopter.de * |
* Gregor "killagreg" Stobrawa for his version of the MK code * |
* Thomas Kaiser "thkais" for the original project. See * |
* http://www.ft-fanpage.de/mikrokopter/ * |
* http://forum.mikrokopter.de/topic-4061-1.html * |
* Claas Anders "CaScAdE" Rathje for providing the font and his C-OSD code * |
* http://www.mylifesucks.de/oss/c-osd/ * |
* Harald Bongartz "HaraldB" for providing his Ideas and Code for usibility* |
*****************************************************************************/ |
#include "../cpu.h" |
#include <avr/io.h> |
#include <inttypes.h> |
#include <stdlib.h> |
#include <avr/pgmspace.h> |
#include <util/delay.h> |
#include "../main.h" |
#include "../followme/followme.h" |
#include "../osd/osd.h" |
#include "../lcd/lcd.h" |
#include "../timer/timer.h" |
#include "../uart/usart.h" |
#include "../eeprom/eeprom.h" |
#include "../messages.h" |
#include "../parameter.h" |
#include "../mk-data-structs.h" |
#define COSD_WASFLYING 4 |
#define TIMEOUT 200 // 2 sec |
// global definitions and global vars |
NaviData_t *naviData; |
mk_param_struct_t *mk_param_struct; |
//uint16_t old_hh = 0; |
uint8_t Flags_ExtraConfig; |
uint8_t Flags_GlobalConfig; |
uint8_t Flags_GlobalConfig3; |
unsigned char Element; |
uint16_t heading_home; |
// Hier Höhenanzeigefehler Korrigieren |
#define AltimeterAdjust 1.5 |
// Positionen der Anzeigeelemente im Bildschirm |
#define OSD_ALTITUDE_CONTROL 1 |
#define OSD_ALTITUDE 2 |
#define OSD_BATTERY_LEVEL 3 |
#define OSD_CAPACITY 4 |
#define OSD_CARE_FREE 5 |
#define OSD_COMPASS_DEGREE 6 |
#define OSD_COMPASS_DIRECTION 7 |
#define OSD_COMPASS_ROSE 8 |
#define OSD_CURRENT 9 |
#define OSD_FLYING_TIME 10 |
#define OSD_GROUND_SPEED 11 |
#define OSD_HOME_CIRCLE 12 |
#define OSD_HOME_DEGREE 13 |
#define OSD_HOME_DISTANCE 14 |
#define OSD_LED1_OUTPUT 15 |
#define OSD_LED2_OUTPUT 16 |
#define OSD_MANUELL 17 |
#define OSD_NAVI_MODE 18 |
#define OSD_RC_INTENSITY 19 |
#define OSD_SATS_IN_USE 20 |
#define OSD_STATUS_FLAGS 21 |
#define OSD_VARIOMETER 22 |
// Flags |
//uint8_t COSD_FLAGS2 = 0; |
// |
//GPS_Pos_t last5pos[7]; |
uint8_t FM_error = 0; |
//-------------------------------------------------------------- |
void FollowMe (void) |
{ |
uint8_t flag; |
uint8_t tmp_dat; |
// uint8_t OSD_Mode; |
// uint8_t info_3D = 0; |
uint8_t status; |
// Clear statistics |
// max_Altimeter = 0; |
// max_GroundSpeed = 0; |
// max_Distance = 0; |
// min_UBat = 255; |
// max_FlyingTime = 0; |
// flags from last round to check for changes |
uint8_t old_FCFlags = 0; |
// uint8_t old_AngleNick = 0; |
// uint8_t old_AngleRoll = 0; |
lcd_cls(); |
if (hardware == FC) |
{ |
lcd_puts_at(0, 3, strGet(ONLY_NC), 0); // Nur mit NC |
timer = 100; |
while (timer > 0); |
return; |
} |
SwitchToFC(); |
status = load_setting(0xff); |
if(status == 255) |
{ |
lcd_puts_at(0, 0, strGet(NO_SETTINGS), 0); // Keine Setings |
_delay_ms(2000); |
} |
Flags_ExtraConfig = mk_param_struct->ExtraConfig; |
Flags_GlobalConfig = mk_param_struct->GlobalConfig; |
Flags_GlobalConfig3 = mk_param_struct->GlobalConfig3; |
SwitchToNC(); |
mode = 'O'; |
// disable debug... |
// RS232_request_mk_data (0, 'd', 0); |
tmp_dat = 0; |
SendOutData ('d', ADDRESS_ANY, 1, &tmp_dat, 1); |
// request OSD Data from NC every 100ms |
// RS232_request_mk_data (1, 'o', 100); |
tmp_dat = 10; |
// OSD_active = true; // benötigt für Navidata Ausgabe an SV2 |
SendOutData ('o', ADDRESS_NC, 1, &tmp_dat, 1); |
flag = 0; |
timer = TIMEOUT; |
abo_timer = ABO_TIMEOUT; |
do |
{ |
if (rxd_buffer_locked) |
{ |
timer = TIMEOUT; |
Decode64 (); |
naviData = (NaviData_t *) pRxData; |
if(FM_error == 1) |
lcd_cls(); |
FM_error = 0; |
GPS_Pos_t currpos; |
currpos.Latitude = naviData->CurrentPosition.Latitude; |
currpos.Longitude = naviData->CurrentPosition.Longitude; |
flag = 1; |
{ |
//------------------------------------------- |
// OSD_Screen_Element() is depricated! |
// USE NEW OSD_Element_xyz() FUNCTIONS! |
//------------------------------------------- |
// Altitude Control |
//OSD_Screen_Element (0, 3, OSD_ALTITUDE_CONTROL,Config.OSD_ScreenMode); |
OSD_Element_AltitudeControl( 0, 0 ); |
// |
// // Altitude |
// OSD_Screen_Element (11, 3, OSD_ALTITUDE); |
// Battery level |
//OSD_Screen_Element (0, 7, OSD_BATTERY_LEVEL,Config.OSD_ScreenMode); |
OSD_Element_BatteryLevel( 0, 7, Config.OSD_ScreenMode ); |
// Capacity |
//OSD_Screen_Element (13, 7, OSD_CAPACITY,Config.OSD_ScreenMode); |
OSD_Element_Capacity( 13, 7 ); |
// Care Free |
//OSD_Screen_Element (12, 2, OSD_CARE_FREE,Config.OSD_ScreenMode); |
OSD_Element_CareFree( 12, 2 ); |
// // Compass Degree |
// OSD_Screen_Element (13, 0, OSD_COMPASS_DEGREE); |
// |
// // Compass Direction |
// OSD_Screen_Element (18, 0, OSD_COMPASS_DIRECTION); |
// |
// // Compass Rose |
// OSD_Screen_Element (12, 1, OSD_COMPASS_ROSE); |
// Current |
//OSD_Screen_Element (7, 7, OSD_CURRENT,Config.OSD_ScreenMode); |
OSD_Element_Current( 7, 7 ); |
// Flying time |
lcd_printp_at (0, 1, PSTR("Flytime:"), 0); |
//OSD_Screen_Element (8, 1, OSD_FLYING_TIME,Config.OSD_ScreenMode); |
OSD_Element_FlyingTime( 8, 1 ); |
// Ground Speed |
lcd_printp_at (0, 0, PSTR("Speed:"), 0); |
//OSD_Screen_Element (6, 0, OSD_GROUND_SPEED,Config.OSD_ScreenMode); |
OSD_Element_GroundSpeed( 6, 0 ); |
// Sats in use |
//OSD_Screen_Element (16, 0, OSD_SATS_IN_USE,Config.OSD_ScreenMode); |
OSD_Element_SatsInUse( 16, 0, Config.OSD_ScreenMode ); |
// // Home Circle |
// OSD_Screen_Element (16, 4, OSD_HOME_CIRCLE); |
// |
// // Home Degree |
// OSD_Screen_Element (12, 4, OSD_HOME_DEGREE); |
// Home Distance |
lcd_printp_at (11, 3, PSTR("Dist:"), 0); |
//OSD_Screen_Element (17, 3, OSD_HOME_DISTANCE,Config.OSD_ScreenMode); |
OSD_Element_HomeDistance( 17, 3, Config.OSD_ScreenMode ); |
// |
// // LED1 Output |
// OSD_Screen_Element (0, 6, OSD_LED1_OUTPUT); |
// |
// // LED2 Output |
// OSD_Screen_Element (5, 6, OSD_LED2_OUTPUT); |
// Manuell |
// OSD_Screen_Element (7, 0, OSD_MANUELL); |
// Navi Mode |
//OSD_Screen_Element (0, 2, OSD_NAVI_MODE,Config.OSD_ScreenMode); |
OSD_Element_NaviMode( 0, 2 ); |
// RC Intensity |
// OSD_Screen_Element (11, 6, OSD_RC_INTENSITY); |
// Status Flags |
// OSD_Screen_Element (0, 2, OSD_STATUS_FLAGS); |
// // Variometer |
// OSD_Screen_Element (9, 0, OSD_VARIOMETER); |
lcd_printp_at (0, 4, PSTR("MK:"), 0); |
write_ndigit_number_u (3, 4, (uint16_t)(currpos.Latitude/10000000), 2, 0,0); |
lcd_printp_at (5, 4, PSTR("."), 0); |
write_ndigit_number_u (6, 4, (uint16_t)((currpos.Latitude/1000) % 10000), 4, 1,0); |
write_ndigit_number_u (10, 4, (uint16_t)((currpos.Latitude/10) % 100), 2, 1,0); |
write_ndigit_number_u (12, 4, (uint16_t)(currpos.Longitude/10000000), 2, 0,0); |
lcd_printp_at (14, 4, PSTR("."), 0); |
write_ndigit_number_u (15, 4, (uint16_t)((currpos.Longitude/1000) % 10000), 4, 1,0); |
write_ndigit_number_u (19, 4, (uint16_t)((currpos.Longitude/10) % 100), 2, 1,0); |
lcd_printp_at (0, 5, PSTR("!!!not implemented!!!"), 2); |
// Akku Warnung |
if (naviData->UBat < Config.MK_LowBat) |
{ //Beeper ein |
set_beep ( 3000, 0x0020, BeepNormal); |
} |
if (naviData->UBat > Config.MK_LowBat) //bei kurzzeitigen Schwankungen Beeper erst wieder aus wenn UBat 0,2 V höher als Warnschwelle |
{ //Beeper aus |
set_beep ( 0, 0, BeepOff); |
} |
// Akku Warnung Ende |
old_FCFlags = naviData->FCStatusFlags; |
rxd_buffer_locked = FALSE; |
} |
if (!abo_timer) |
{ // renew abo every 3 sec |
// request OSD Data from NC every 100ms |
// RS232_request_mk_data (1, 'o', 100); |
tmp_dat = 10; |
SendOutData ('o', ADDRESS_NC, 1, &tmp_dat, 1); |
abo_timer = ABO_TIMEOUT; |
} |
} |
if (!timer) |
{ |
OSD_Timeout(flag); |
flag = 0; |
FM_error = 1; |
} |
} |
while (!get_key_press (1 << KEY_ESC)); |
OSD_active = false; |
} |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/followme/followme.h |
---|
0,0 → 1,13 |
/* |
* FollowMe.h |
* |
* Created on: 18.05.2012 |
* Author: cebra |
*/ |
#ifndef FOLLOWME_H_ |
#define FOLLOWME_H_ |
void FollowMe (void); |
#endif /* FOLLOWME_H_ */ |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/gps/gps.c |
---|
0,0 → 1,366 |
/***************************************************************************** |
* Copyright (C) 2008 Thomas Kaiser, thomas@ft-fanpage.de * |
* Copyright (C) 2009 Peter "woggle" Mack, mac@denich.net * |
* Copyright (C) 2011 Christian "Cebra" Brandtner, brandtner@brandtner.net * |
* Copyright (C) 2011 Harald Bongartz * |
* * |
* This program is free software; you can redistribute it and/or modify * |
* it under the terms of the GNU General Public License as published by * |
* the Free Software Foundation; either version 2 of the License. * |
* * |
* This program is distributed in the hope that it will be useful, * |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
* GNU General Public License for more details. * |
* * |
* You should have received a copy of the GNU General Public License * |
* along with this program; if not, write to the * |
* Free Software Foundation, Inc., * |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
* * |
* * |
* Credits to: * |
* Holger Buss & Ingo Busker from mikrokopter.de for the MK project + SVN * |
* http://www.mikrokopter.de * |
* Gregor "killagreg" Stobrawa for his version of the MK code * |
* Thomas Kaiser "thkais" for the original project. See * |
* http://www.ft-fanpage.de/mikrokopter/ * |
* http://forum.mikrokopter.de/topic-4061-1.html * |
* Claas Anders "CaScAdE" Rathje for providing the font and his C-OSD code * |
* http://www.mylifesucks.de/oss/c-osd/ * |
* Harald Bongartz "HaraldB" for providing his Ideas and Code for usibility* |
*****************************************************************************/ |
#include <avr/io.h> |
#include <inttypes.h> |
#include <stdlib.h> |
#include <avr/pgmspace.h> |
#include "../main.h" |
#include "../lcd/lcd.h" |
#include "../timer/timer.h" |
#include "../uart/usart.h" |
#if defined HWVERSION1_3W || defined HWVERSION3_9 || defined HWVERSION1_2W |
#define TIMEOUT 200 // 2 sec |
uint8_t ck_a = 0; |
uint8_t ck_b = 0; |
uint8_t UBX_class = 0; |
uint8_t UBX_id = 0; |
uint8_t UBX_buffer[250]; |
uint8_t UBX_payload_counter = 0; |
void checksum(uint8_t); |
void UBX_process(void); |
uint32_t join_4_bytes(uint8_t*); |
uint8_t display_mode = 0; |
//-------------------------------------------------------------- |
void gps(void) |
{ |
lcd_cls(); |
display_mode = 2; |
if (hardware == FC) |
{ |
lcd_printp_at(0, 3, PSTR("Nur mit NC !"), 0); |
timer = 100; |
while (timer > 0); |
return; |
} |
if(current_hardware != NC) |
SwitchToNC(); |
SwitchToGPS(); |
uint8_t mode = 0; |
// SendOutData ('d', ADDRESS_ANY, 1, &tmp_dat, 1); |
timer = TIMEOUT; |
uint8_t data = 0; |
uint8_t length = 0; |
uint8_t UBX_ck_a = 0; |
do |
{ |
// if (rxFlag == 1) |
if (uart_getc_nb(&data)) |
{ |
//rxFlag = 0; |
//data = rx_byte; |
timer = TIMEOUT; |
switch(mode) |
{ |
case 0: // init 1 |
if(data == 0xB5) |
{ |
UBX_payload_counter = 0; |
UBX_id = 0; |
UBX_class = 0; |
ck_a = 0; |
ck_b = 0; |
mode++; |
} |
break; |
case 1: // init 2 |
if(data == 0x62) |
mode++; |
else |
mode = 0; |
break; |
case 2: //class |
if(data != 1) |
mode = 0; |
else |
{ |
checksum(data); |
UBX_class = data; |
mode++; |
} |
break; |
case 3: // id |
if((data != 48)&&(data != 6)&&(data != 18)&&(data != 2)) |
mode = 0; |
else |
{ |
UBX_id = data; |
checksum(data); |
mode++; |
} |
break; |
case 4: // length lo |
if(data > 250) |
mode = 0; |
else |
{ |
checksum(data); |
length = data; |
mode++; |
} |
break; |
case 5: // length hi |
if(data != 0) |
mode = 0; |
else |
{ |
checksum(data); |
mode++; |
} |
break; |
case 6: // length hi |
length--; |
UBX_buffer[UBX_payload_counter] = data; |
checksum(data); |
UBX_payload_counter++; |
if(length==0) |
{ |
mode++; |
}; |
break; |
case 7: // check lo |
mode++; |
UBX_ck_a = data; |
break; |
case 8: // check hi |
mode=0; |
if((UBX_ck_a == ck_a) && (data == ck_b)) |
UBX_process(); |
} |
// write_ndigit_number_u (14, 0, data, 3, 0); |
} |
} |
while (!get_key_press (1 << KEY_ESC) && timer); |
get_key_press(KEY_ALL); |
SwitchToNC(); |
} |
//-------------------------------------------------------------- |
void UBX_process() |
{ |
if ((get_key_press (1 << KEY_MINUS))||(display_mode == 2)) |
{ |
if (display_mode != 1) |
{ |
lcd_cls(); |
lcd_printp_at (0,0, PSTR("Fix Type : "), 0); |
lcd_printp_at (0,1, PSTR("Sat : "), 0); |
lcd_printp_at (0,2, PSTR("Accuracy : "), 0); |
lcd_printp_at (0,3, PSTR("PDOP : "), 0); |
lcd_printp_at (0,4, PSTR("Speed : "), 0); |
lcd_printp_at (0,5, PSTR("Long : "), 0); |
lcd_printp_at (0,6, PSTR("Lat : "), 0); |
lcd_printp_at (0,7, PSTR("Alt : "), 0); |
} |
display_mode = 1; |
} |
if((UBX_class == 1) && (UBX_id == 48)&&(display_mode == 0)) |
{ |
uint8_t channels = UBX_buffer[4]; |
uint8_t i = 0; |
for(i = 0; i < channels; i++) |
{ |
if (i > 15) |
break; |
uint8_t line; |
uint8_t col; |
if (i > 7) |
{ |
line = i-7; |
col = 11; |
} |
else |
col = 0; line = i; |
write_ndigit_number_u (col, line, UBX_buffer[9 + 12*i], 3, 0,0); |
write_ndigit_number_u (col+4, line, UBX_buffer[12 + 12*i], 2, 0,0); |
if((UBX_buffer[10 + 12*i] & 3) == 3) |
lcd_printp_at (col+7,line, PSTR("O"), 0); |
else if((UBX_buffer[10 + 12*i] & 1) == 1) |
lcd_printp_at (col+7,line, PSTR("X"), 0); |
else if(UBX_buffer[11 + 12*i] > 4) |
lcd_printp_at (col+7,line, PSTR("x"), 0); |
else if(UBX_buffer[11 + 12*i] > 1) |
lcd_printp_at (col+7,line, PSTR("-"), 0); |
else |
lcd_printp_at (col+7,line, PSTR(" "), 0); |
} |
} |
if(display_mode == 1) |
{ |
if((UBX_class == 1) && (UBX_id == 6)) //SVINFO |
{ |
switch (UBX_buffer[10]) |
{ |
case 4: |
case 3: |
lcd_printp_at (11,0, PSTR("3D"), 0); |
break; |
case 2: |
lcd_printp_at (11,0, PSTR("2D"), 0); |
break; |
default: |
lcd_printp_at (11,0, PSTR("no"), 0); |
} |
if((UBX_buffer[11] & 3) == 3) |
lcd_printp_at (17,0, PSTR("D"), 0); |
else |
lcd_printp_at (17,0, PSTR(" "), 0); |
if((UBX_buffer[11] & 1) == 1) |
lcd_printp_at (14,0, PSTR("ok"), 0); |
else |
lcd_printp_at (14,0, PSTR(" "), 0); |
// lcd_write_number_u_at (11, 1, UBX_buffer[47]); |
write_ndigit_number_u (11, 1, UBX_buffer[47], 2,0,0); |
uint16_t acc = (uint16_t)join_4_bytes(&UBX_buffer[24]); |
write_ndigit_number_u (11, 2, acc, 5, 0,0); |
lcd_printp_at (17,2, PSTR("cm"), 0); |
uint16_t pdop = UBX_buffer[44]+UBX_buffer[45]*255; |
write_ndigit_number_u (11, 3, pdop/100, 2, 0,0); |
lcd_printp_at (13,3, PSTR("."), 0); |
write_ndigit_number_u (14, 3, (pdop % 100),2, 1,0); |
} |
if((UBX_class == 1) && (UBX_id == 18)) //VELNED |
{ |
uint16_t speed = (uint16_t)((join_4_bytes(&UBX_buffer[20])*60*60)/100000); |
write_ndigit_number_u (11, 4, speed, 3, 0,0); |
lcd_printp_at (15,4, PSTR("km/h"), 0); |
} |
if((UBX_class == 1) && (UBX_id == 2)) //POSLLH |
{ |
uint32_t lon = join_4_bytes(&UBX_buffer[4]); |
write_ndigit_number_u (10, 5, (uint16_t)(lon/10000000), 2, 0,0); |
lcd_printp_at (12,5, PSTR("."), 0); |
write_ndigit_number_u (13, 5, (uint16_t)((lon/1000) % 10000), 4, 1,0); |
write_ndigit_number_u (17, 5, (uint16_t)((lon/10) % 100), 2, 1,0); |
uint32_t lat = join_4_bytes(&UBX_buffer[8]); |
write_ndigit_number_u (10, 6, (uint16_t)(lat/10000000), 2, 0,0); |
lcd_printp_at (12,6, PSTR("."), 0); |
write_ndigit_number_u (13, 6, (uint16_t)((lat/1000) % 10000), 4, 1,0); |
write_ndigit_number_u (17, 6, (uint16_t)((lat/10) % 100), 2, 1,0); |
uint16_t height = (uint16_t)(join_4_bytes(&UBX_buffer[16])/1000); |
write_ndigit_number_u (11, 7, height, 4, 0,0); |
lcd_printp_at (16,7, PSTR("m"), 0); |
} |
} |
} |
//-------------------------------------------------------------- |
union long_union |
{ |
uint32_t dword; |
uint8_t byte[4]; |
} longUnion; |
//-------------------------------------------------------------- |
union int_union |
{ |
uint16_t dword; |
uint8_t byte[2]; |
} intUnion; |
//-------------------------------------------------------------- |
uint32_t join_4_bytes(uint8_t Buffer[]) |
{ |
longUnion.byte[0] = *Buffer; |
longUnion.byte[1] = *(Buffer+1); |
longUnion.byte[2] = *(Buffer+2); |
longUnion.byte[3] = *(Buffer+3); |
return (longUnion.dword); |
} |
//-------------------------------------------------------------- |
void checksum(uint8_t data) |
{ |
ck_a += data; |
ck_b += ck_a; |
} |
#endif |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/gps/gps.h |
---|
0,0 → 1,40 |
/***************************************************************************** |
* Copyright (C) 2008 Thomas Kaiser, thomas@ft-fanpage.de * |
* Copyright (C) 2009 Peter "woggle" Mack, mac@denich.net * |
* Copyright (C) 2011 Christian "Cebra" Brandtner, brandtner@brandtner.net * |
* Copyright (C) 2011 Harald Bongartz * |
* * |
* This program is free software; you can redistribute it and/or modify * |
* it under the terms of the GNU General Public License as published by * |
* the Free Software Foundation; either version 2 of the License. * |
* * |
* This program is distributed in the hope that it will be useful, * |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
* GNU General Public License for more details. * |
* * |
* You should have received a copy of the GNU General Public License * |
* along with this program; if not, write to the * |
* Free Software Foundation, Inc., * |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
* * |
* * |
* Credits to: * |
* Holger Buss & Ingo Busker from mikrokopter.de for the MK project + SVN * |
* http://www.mikrokopter.de * |
* Gregor "killagreg" Stobrawa for his version of the MK code * |
* Thomas Kaiser "thkais" for the original project. See * |
* http://www.ft-fanpage.de/mikrokopter/ * |
* http://forum.mikrokopter.de/topic-4061-1.html * |
* Claas Anders "CaScAdE" Rathje for providing the font and his C-OSD code * |
* http://www.mylifesucks.de/oss/c-osd/ * |
* Harald Bongartz "HaraldB" for providing his Ideas and Code for usibility* |
*****************************************************************************/ |
#ifndef _GPS_H |
#define _GPS_H |
void gps (void); |
#endif |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/lcd/.directory |
---|
0,0 → 1,3 |
[Dolphin] |
Timestamp=2013,3,7,9,13,59 |
ViewMode=1 |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/lcd/Font8x8.c |
---|
0,0 → 1,273 |
/* |
* font8x8.c |
* LCD-OSD |
* |
* Created by Peter Mack on 26.12.09. |
* Copyright 2009 SCS GmbH & Co. KG. All rights reserved. |
* |
*/ |
#include <avr/pgmspace.h> |
const uint8_t Font8x8[256][8]PROGMEM= |
{ |
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x00 |
{0x7E,0x81,0x95,0xB1,0xB1,0x95,0x81,0x7E}, // 0x01 |
{0x7E,0xFF,0xEB,0xCF,0xCF,0xEB,0xFF,0x7E}, // 0x02 |
{0x0E,0x1F,0x3F,0x7E,0x3F,0x1F,0x0E,0x00}, // 0x03 |
{0x08,0x1C,0x3E,0x7F,0x3E,0x1C,0x08,0x00}, // 0x04 |
{0x38,0x3A,0x9F,0xFF,0x9F,0x3A,0x38,0x00}, // 0x05 |
{0x10,0x38,0xBC,0xFF,0xBC,0x38,0x10,0x00}, // 0x06 |
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x07 |
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x08 |
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x09 |
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x0A |
{0x70,0xF8,0x88,0x88,0xFD,0x7F,0x07,0x0F}, // 0x0B |
{0x00,0x4E,0x5F,0xF1,0xF1,0x5F,0x4E,0x00}, // 0x0C |
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x0D |
{0xC0,0xFF,0x7F,0x05,0x05,0x65,0x7F,0x3F}, // 0x0E |
{0x99,0x5A,0x3C,0xE7,0xE7,0x3C,0x5A,0x99}, // 0x0F |
{0x7F,0x3E,0x3E,0x1C,0x1C,0x08,0x08,0x00}, // 0x10 |
{0x08,0x08,0x1C,0x1C,0x3E,0x3E,0x7F,0x00}, // 0x11 |
{0x00,0x24,0x66,0xFF,0xFF,0x66,0x24,0x00}, // 0x12 |
{0x00,0x5F,0x5F,0x00,0x00,0x5F,0x5F,0x00}, // 0x13 |
{0x06,0x0F,0x09,0x7F,0x7F,0x01,0x7F,0x7F}, // 0x14 |
{0xDA,0xBF,0xA5,0xA5,0xFD,0x59,0x03,0x02}, // 0x15 |
{0x00,0x70,0x70,0x70,0x70,0x70,0x70,0x00}, // 0x16 |
{0x80,0x94,0xB6,0xFF,0xFF,0xB6,0x94,0x80}, // 0x17 |
{0x00,0x04,0x06,0x7F,0x7F,0x06,0x04,0x00}, // 0x18 |
{0x00,0x10,0x30,0x7F,0x7F,0x30,0x10,0x00}, // 0x19 |
{0x08,0x08,0x08,0x2A,0x3E,0x1C,0x08,0x00}, // 0x1A |
{0x08,0x1C,0x3E,0x2A,0x08,0x08,0x08,0x00}, // 0x1B |
{0x3C,0x3C,0x20,0x20,0x20,0x20,0x20,0x00}, // 0x1C |
{0x08,0x1C,0x3E,0x08,0x08,0x3E,0x1C,0x08}, // 0x1D |
{0x30,0x38,0x3C,0x3E,0x3E,0x3C,0x38,0x30}, // 0x1E |
{0x06,0x0E,0x1E,0x3E,0x3E,0x1E,0x0E,0x06}, // 0x1F |
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x20 |
{0x00,0x06,0x5F,0x5F,0x06,0x00,0x00,0x00}, // 0x21 |
{0x00,0x07,0x07,0x00,0x07,0x07,0x00,0x00}, // 0x22 |
{0x14,0x7F,0x7F,0x14,0x7F,0x7F,0x14,0x00}, // 0x23 |
{0x24,0x2E,0x6B,0x6B,0x3A,0x12,0x00,0x00}, // 0x24 |
{0x46,0x66,0x30,0x18,0x0C,0x66,0x62,0x00}, // 0x25 |
{0x30,0x7A,0x4F,0x5D,0x37,0x7A,0x48,0x00}, // 0x26 |
{0x04,0x07,0x03,0x00,0x00,0x00,0x00,0x00}, // 0x27 |
{0x00,0x1C,0x3E,0x63,0x41,0x00,0x00,0x00}, // 0x28 |
{0x00,0x41,0x63,0x3E,0x1C,0x00,0x00,0x00}, // 0x29 |
{0x08,0x2A,0x3E,0x1C,0x1C,0x3E,0x2A,0x08}, // 0x2A |
{0x08,0x08,0x3E,0x3E,0x08,0x08,0x00,0x00}, // 0x2B |
{0x00,0xA0,0xE0,0x60,0x00,0x00,0x00,0x00}, // 0x2C |
{0x08,0x08,0x08,0x08,0x08,0x08,0x00,0x00}, // 0x2D |
{0x00,0x00,0x60,0x60,0x00,0x00,0x00,0x00}, // 0x2E |
{0x60,0x30,0x18,0x0C,0x06,0x03,0x01,0x00}, // 0x2F |
{0x3E,0x7F,0x59,0x4D,0x7F,0x3E,0x00,0x00}, // 0x30 |
{0x42,0x42,0x7F,0x7F,0x40,0x40,0x00,0x00}, // 0x31 |
{0x62,0x73,0x59,0x49,0x6F,0x66,0x00,0x00}, // 0x32 |
{0x22,0x63,0x49,0x49,0x7F,0x36,0x00,0x00}, // 0x33 |
{0x18,0x1C,0x16,0x13,0x7F,0x7F,0x10,0x00}, // 0x34 |
{0x27,0x67,0x45,0x45,0x7D,0x39,0x00,0x00}, // 0x35 |
{0x3C,0x7E,0x4B,0x49,0x79,0x30,0x00,0x00}, // 0x36 |
{0x03,0x63,0x71,0x19,0x0F,0x07,0x00,0x00}, // 0x37 |
{0x36,0x7F,0x49,0x49,0x7F,0x36,0x00,0x00}, // 0x38 |
{0x06,0x4F,0x49,0x69,0x3F,0x1E,0x00,0x00}, // 0x39 |
{0x00,0x00,0x6C,0x6C,0x00,0x00,0x00,0x00}, // 0x3A |
{0x00,0xA0,0xEC,0x6C,0x00,0x00,0x00,0x00}, // 0x3B |
{0x08,0x1C,0x36,0x63,0x41,0x00,0x00,0x00}, // 0x3C |
{0x14,0x14,0x14,0x14,0x14,0x14,0x00,0x00}, // 0x3D |
{0x00,0x41,0x63,0x36,0x1C,0x08,0x00,0x00}, // 0x3E |
{0x02,0x03,0x51,0x59,0x0F,0x06,0x00,0x00}, // 0x3F |
{0x3E,0x7F,0x41,0x5D,0x5D,0x1F,0x1E,0x00}, // 0x40 |
{0x7C,0x7E,0x13,0x13,0x7E,0x7C,0x00,0x00}, // 0x41 |
{0x41,0x7F,0x7F,0x49,0x49,0x7F,0x36,0x00}, // 0x42 |
{0x1C,0x3E,0x63,0x41,0x41,0x63,0x22,0x00}, // 0x43 |
{0x41,0x7F,0x7F,0x41,0x63,0x7F,0x1C,0x00}, // 0x44 |
{0x41,0x7F,0x7F,0x49,0x5D,0x41,0x63,0x00}, // 0x45 |
{0x41,0x7F,0x7F,0x49,0x1D,0x01,0x03,0x00}, // 0x46 |
{0x1C,0x3E,0x63,0x41,0x51,0x73,0x72,0x00}, // 0x47 |
{0x7F,0x7F,0x08,0x08,0x7F,0x7F,0x00,0x00}, // 0x48 |
{0x00,0x41,0x7F,0x7F,0x41,0x00,0x00,0x00}, // 0x49 |
{0x30,0x70,0x40,0x41,0x7F,0x3F,0x01,0x00}, // 0x4A |
{0x41,0x7F,0x7F,0x08,0x1C,0x77,0x63,0x00}, // 0x4B |
{0x41,0x7F,0x7F,0x41,0x40,0x60,0x70,0x00}, // 0x4C |
{0x7F,0x7F,0x06,0x0C,0x06,0x7F,0x7F,0x00}, // 0x4D |
{0x7F,0x7F,0x06,0x0C,0x18,0x7F,0x7F,0x00}, // 0x4E |
{0x1C,0x3E,0x63,0x41,0x63,0x3E,0x1C,0x00}, // 0x4F |
{0x41,0x7F,0x7F,0x49,0x09,0x0F,0x06,0x00}, // 0x50 |
{0x1E,0x3F,0x21,0x71,0x7F,0x5E,0x00,0x00}, // 0x51 |
{0x41,0x7F,0x7F,0x19,0x39,0x6F,0x46,0x00}, // 0x52 |
{0x26,0x67,0x4D,0x59,0x7B,0x32,0x00,0x00}, // 0x53 |
{0x03,0x41,0x7F,0x7F,0x41,0x03,0x00,0x00}, // 0x54 |
{0x7F,0x7F,0x40,0x40,0x7F,0x7F,0x00,0x00}, // 0x55 |
{0x1F,0x3F,0x60,0x60,0x3F,0x1F,0x00,0x00}, // 0x56 |
{0x7F,0x7F,0x30,0x18,0x30,0x7F,0x7F,0x00}, // 0x57 |
{0x63,0x77,0x1C,0x08,0x1C,0x77,0x63,0x00}, // 0x58 |
{0x07,0x4F,0x78,0x78,0x4F,0x07,0x00,0x00}, // 0x59 |
{0x67,0x73,0x59,0x4D,0x47,0x63,0x71,0x00}, // 0x5A |
{0x00,0x7F,0x7F,0x41,0x41,0x00,0x00,0x00}, // 0x5B |
{0x01,0x03,0x06,0x0C,0x18,0x30,0x60,0x00}, // 0x5C |
{0x00,0x41,0x41,0x7F,0x7F,0x00,0x00,0x00}, // 0x5D |
{0x08,0x0C,0x06,0x03,0x06,0x0C,0x08,0x00}, // 0x5E |
{0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80}, // 0x5F |
{0x00,0x00,0x03,0x07,0x04,0x00,0x00,0x00}, // 0x60 |
{0x20,0x74,0x54,0x54,0x3C,0x78,0x40,0x00}, // 0x61 |
{0x41,0x3F,0x7F,0x44,0x44,0x7C,0x38,0x00}, // 0x62 |
{0x38,0x7C,0x44,0x44,0x6C,0x28,0x00,0x00}, // 0x63 |
{0x30,0x78,0x48,0x49,0x3F,0x7F,0x40,0x00}, // 0x64 |
{0x38,0x7C,0x54,0x54,0x5C,0x18,0x00,0x00}, // 0x65 |
{0x48,0x7E,0x7F,0x49,0x03,0x02,0x00,0x00}, // 0x66 |
{0x98,0xBC,0xA4,0xA4,0xF8,0x7C,0x04,0x00}, // 0x67 |
{0x41,0x7F,0x7F,0x08,0x04,0x7C,0x78,0x00}, // 0x68 |
{0x00,0x44,0x7D,0x7D,0x40,0x00,0x00,0x00}, // 0x69 |
{0x40,0xC4,0x84,0xFD,0x7D,0x00,0x00,0x00}, // 0x6A |
{0x41,0x7F,0x7F,0x10,0x38,0x6C,0x44,0x00}, // 0x6B |
{0x00,0x41,0x7F,0x7F,0x40,0x00,0x00,0x00}, // 0x6C |
{0x7C,0x7C,0x0C,0x18,0x0C,0x7C,0x78,0x00}, // 0x6D |
{0x7C,0x7C,0x04,0x04,0x7C,0x78,0x00,0x00}, // 0x6E |
{0x38,0x7C,0x44,0x44,0x7C,0x38,0x00,0x00}, // 0x6F |
{0x84,0xFC,0xF8,0xA4,0x24,0x3C,0x18,0x00}, // 0x70 |
{0x18,0x3C,0x24,0xA4,0xF8,0xFC,0x84,0x00}, // 0x71 |
{0x44,0x7C,0x78,0x44,0x1C,0x18,0x00,0x00}, // 0x72 |
{0x48,0x5C,0x54,0x54,0x74,0x24,0x00,0x00}, // 0x73 |
{0x00,0x04,0x3E,0x7F,0x44,0x24,0x00,0x00}, // 0x74 |
{0x3C,0x7C,0x40,0x40,0x3C,0x7C,0x40,0x00}, // 0x75 |
{0x1C,0x3C,0x60,0x60,0x3C,0x1C,0x00,0x00}, // 0x76 |
{0x3C,0x7C,0x60,0x30,0x60,0x7C,0x3C,0x00}, // 0x77 |
{0x44,0x6C,0x38,0x10,0x38,0x6C,0x44,0x00}, // 0x78 |
{0x9C,0xBC,0xA0,0xA0,0xFC,0x7C,0x00,0x00}, // 0x79 |
{0x4C,0x64,0x74,0x5C,0x4C,0x64,0x00,0x00}, // 0x7A |
{0x08,0x08,0x3E,0x77,0x41,0x41,0x00,0x00}, // 0x7B |
{0x00,0x00,0x00,0x77,0x77,0x00,0x00,0x00}, // 0x7C |
{0x41,0x41,0x77,0x3E,0x08,0x08,0x00,0x00}, // 0x7D |
{0x02,0x03,0x01,0x03,0x02,0x03,0x01,0x00}, // 0x7E |
{0x78,0x7C,0x46,0x43,0x46,0x7C,0x78,0x00}, // 0x7F |
{0x1E,0xBF,0xE1,0x61,0x33,0x12,0x00,0x00}, // 0x80 |
{0x3A,0x7A,0x40,0x40,0x7A,0x7A,0x40,0x00}, // 0x81 |
{0x38,0x7C,0x56,0x57,0x5D,0x18,0x00,0x00}, // 0x82 |
{0x02,0x23,0x75,0x55,0x55,0x7D,0x7B,0x42}, // 0x83 |
{0x21,0x75,0x54,0x54,0x7D,0x79,0x40,0x00}, // 0x84 |
{0x20,0x75,0x57,0x56,0x7C,0x78,0x40,0x00}, // 0x85 |
{0x00,0x22,0x77,0x55,0x55,0x7F,0x7A,0x40}, // 0x86 |
{0x1C,0xBE,0xE2,0x62,0x36,0x14,0x00,0x00}, // 0x87 |
{0x02,0x3B,0x7D,0x55,0x55,0x5D,0x1B,0x02}, // 0x88 |
{0x39,0x7D,0x54,0x54,0x5D,0x19,0x00,0x00}, // 0x89 |
{0x38,0x7D,0x57,0x56,0x5C,0x18,0x00,0x00}, // 0x8A |
{0x01,0x45,0x7C,0x7C,0x41,0x01,0x00,0x00}, // 0x8B |
{0x02,0x03,0x45,0x7D,0x7D,0x43,0x02,0x00}, // 0x8C |
{0x00,0x45,0x7F,0x7E,0x40,0x00,0x00,0x00}, // 0x8D |
{0x79,0x7D,0x26,0x26,0x7D,0x79,0x00,0x00}, // 0x8E |
{0x70,0x7A,0x2D,0x2D,0x7A,0x70,0x00,0x00}, // 0x8F |
{0x44,0x7C,0x7E,0x57,0x55,0x44,0x00,0x00}, // 0x90 |
{0x20,0x74,0x54,0x54,0x7C,0x7C,0x54,0x54}, // 0x91 |
{0x7C,0x7E,0x0B,0x09,0x7F,0x7F,0x49,0x00}, // 0x92 |
{0x32,0x7B,0x49,0x49,0x7B,0x32,0x00,0x00}, // 0x93 |
{0x32,0x7A,0x48,0x48,0x7A,0x32,0x00,0x00}, // 0x94 |
{0x30,0x79,0x4B,0x4A,0x78,0x30,0x00,0x00}, // 0x95 |
{0x3A,0x7B,0x41,0x41,0x7B,0x7A,0x40,0x00}, // 0x96 |
{0x38,0x79,0x43,0x42,0x78,0x78,0x40,0x00}, // 0x97 |
{0xBA,0xBA,0xA0,0xA0,0xFA,0x7A,0x00,0x00}, // 0x98 |
{0x39,0x7D,0x44,0x44,0x44,0x7D,0x39,0x00}, // 0x99 |
{0x3D,0x7D,0x40,0x40,0x7D,0x3D,0x00,0x00}, // 0x9A |
{0x38,0x7C,0x64,0x54,0x4C,0x7C,0x38,0x00}, // 0x9B |
{0x68,0x7E,0x7F,0x49,0x43,0x66,0x20,0x00}, // 0x9C |
{0x5C,0x3E,0x73,0x49,0x67,0x3E,0x1D,0x00}, // 0x9D |
{0x44,0x6C,0x38,0x38,0x6C,0x44,0x00,0x00}, // 0x9E |
{0x40,0xC8,0x88,0xFE,0x7F,0x09,0x0B,0x02}, // 0x9F |
{0x20,0x74,0x56,0x57,0x7D,0x78,0x40,0x00}, // 0xA0 |
{0x00,0x44,0x7E,0x7F,0x41,0x00,0x00,0x00}, // 0xA1 |
{0x30,0x78,0x48,0x4A,0x7B,0x31,0x00,0x00}, // 0xA2 |
{0x38,0x78,0x40,0x42,0x7B,0x79,0x40,0x00}, // 0xA3 |
{0x7A,0x7B,0x09,0x0B,0x7A,0x73,0x01,0x00}, // 0xA4 |
{0x7A,0x7B,0x19,0x33,0x7A,0x7B,0x01,0x00}, // 0xA5 |
{0x00,0x26,0x2F,0x29,0x2F,0x2F,0x28,0x00}, // 0xA6 |
{0x00,0x26,0x2F,0x29,0x29,0x2F,0x26,0x00}, // 0xA7 |
{0x30,0x78,0x4D,0x45,0x60,0x20,0x00,0x00}, // 0xA8 |
{0x1C,0x22,0x7D,0x4B,0x5B,0x65,0x22,0x1C}, // 0xA9 |
{0x08,0x08,0x08,0x08,0x38,0x38,0x00,0x00}, // 0xAA |
{0x61,0x3F,0x1F,0xCC,0xEE,0xAB,0xB9,0x90}, // 0xAB |
{0x61,0x3F,0x1F,0x4C,0x66,0x73,0xD9,0xF8}, // 0xAC |
{0x00,0x00,0x60,0xFA,0xFA,0x60,0x00,0x00}, // 0xAD |
{0x08,0x1C,0x36,0x22,0x08,0x1C,0x36,0x22}, // 0xAE |
{0x22,0x36,0x1C,0x08,0x22,0x36,0x1C,0x08}, // 0xAF |
{0xAA,0x00,0x55,0x00,0xAA,0x00,0x55,0x00}, // 0xB0 |
{0xAA,0x55,0xAA,0x55,0xAA,0x55,0xAA,0x55}, // 0xB1 |
{0x55,0xFF,0xAA,0xFF,0x55,0xFF,0xAA,0xFF}, // 0xB2 |
{0x00,0x00,0x00,0xFF,0xFF,0x00,0x00,0x00}, // 0xB3 |
{0x10,0x10,0x10,0xFF,0xFF,0x00,0x00,0x00}, // 0xB4 |
{0x70,0x78,0x2C,0x2E,0x7B,0x71,0x00,0x00}, // 0xB5 |
{0x72,0x79,0x2D,0x2D,0x79,0x72,0x00,0x00}, // 0xB6 |
{0x71,0x7B,0x2E,0x2C,0x78,0x70,0x00,0x00}, // 0xB7 |
{0x1C,0x22,0x5D,0x55,0x55,0x41,0x22,0x1C}, // 0xB8 |
{0x14,0x14,0xF7,0xF7,0x00,0xFF,0xFF,0x00}, // 0xB9 |
{0x00,0x00,0xFF,0xFF,0x00,0xFF,0xFF,0x00}, // 0xBA |
{0x14,0x14,0xF4,0xF4,0x04,0xFC,0xFC,0x00}, // 0xBB |
{0x14,0x14,0x17,0x17,0x10,0x1F,0x1F,0x00}, // 0xBC |
{0x18,0x3C,0x24,0xE7,0xE7,0x24,0x24,0x00}, // 0xBD |
{0x2B,0x2F,0xFC,0xFC,0x2F,0x2B,0x00,0x00}, // 0xBE |
{0x10,0x10,0x10,0xF0,0xF0,0x00,0x00,0x00}, // 0xBF |
{0x00,0x00,0x00,0x1F,0x1F,0x10,0x10,0x10}, // 0xC0 |
{0x10,0x10,0x10,0x1F,0x1F,0x10,0x10,0x10}, // 0xC1 |
{0x10,0x10,0x10,0xF0,0xF0,0x10,0x10,0x10}, // 0xC2 |
{0x00,0x00,0x00,0xFF,0xFF,0x10,0x10,0x10}, // 0xC3 |
{0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10}, // 0xC4 |
{0x10,0x10,0x10,0xFF,0xFF,0x10,0x10,0x10}, // 0xC5 |
{0x22,0x77,0x55,0x57,0x7E,0x7B,0x41,0x00}, // 0xC6 |
{0x72,0x7B,0x2D,0x2F,0x7A,0x73,0x01,0x00}, // 0xC7 |
{0x00,0x00,0x1F,0x1F,0x10,0x17,0x17,0x14}, // 0xC8 |
{0x00,0x00,0xFC,0xFC,0x04,0xF4,0xF4,0x14}, // 0xC9 |
{0x14,0x14,0x17,0x17,0x10,0x17,0x17,0x14}, // 0xCA |
{0x14,0x14,0xF4,0xF4,0x04,0xF4,0xF4,0x14}, // 0xCB |
{0x00,0x00,0xFF,0xFF,0x00,0xF7,0xF7,0x14}, // 0xCC |
{0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14}, // 0xCD |
{0x14,0x14,0xF7,0xF7,0x00,0xF7,0xF7,0x14}, // 0xCE |
{0x66,0x3C,0x3C,0x24,0x3C,0x3C,0x66,0x00}, // 0xCF |
{0x05,0x27,0x72,0x57,0x7D,0x38,0x00,0x00}, // 0xD0 |
{0x49,0x7F,0x7F,0x49,0x63,0x7F,0x1C,0x00}, // 0xD1 |
{0x46,0x7D,0x7D,0x55,0x55,0x46,0x00,0x00}, // 0xD2 |
{0x45,0x7D,0x7C,0x54,0x55,0x45,0x00,0x00}, // 0xD3 |
{0x44,0x7D,0x7F,0x56,0x54,0x44,0x00,0x00}, // 0xD4 |
{0x0A,0x0E,0x08,0x00,0x00,0x00,0x00,0x00}, // 0xD5 |
{0x00,0x44,0x7E,0x7F,0x45,0x00,0x00,0x00}, // 0xD6 |
{0x02,0x45,0x7D,0x7D,0x45,0x02,0x00,0x00}, // 0xD7 |
{0x01,0x45,0x7C,0x7C,0x45,0x01,0x00,0x00}, // 0xD8 |
{0x10,0x10,0x10,0x1F,0x1F,0x00,0x00,0x00}, // 0xD9 |
{0x00,0x00,0x00,0xF0,0xF0,0x10,0x10,0x10}, // 0xDA |
{0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}, // 0xDB |
{0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0}, // 0xDC |
{0x00,0x00,0x00,0x77,0x77,0x00,0x00,0x00}, // 0xDD |
{0x00,0x45,0x7F,0x7E,0x44,0x00,0x00,0x00}, // 0xDE |
{0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F}, // 0xDF |
{0x38,0x7C,0x46,0x47,0x45,0x7C,0x38,0x00}, // 0xE0 |
{0xFC,0xFE,0x2A,0x2A,0x3E,0x14,0x00,0x00}, // 0xE1 |
{0x3A,0x7D,0x45,0x45,0x45,0x7D,0x3A,0x00}, // 0xE2 |
{0x38,0x7C,0x45,0x47,0x46,0x7C,0x38,0x00}, // 0xE3 |
{0x32,0x7B,0x49,0x4B,0x7A,0x33,0x01,0x00}, // 0xE4 |
{0x3A,0x7F,0x45,0x47,0x46,0x7F,0x39,0x00}, // 0xE5 |
{0x80,0xFE,0x7E,0x20,0x20,0x3E,0x1E,0x00}, // 0xE6 |
{0x42,0x7E,0x7E,0x54,0x1C,0x08,0x00,0x00}, // 0xE7 |
{0x41,0x7F,0x7F,0x55,0x14,0x1C,0x08,0x00}, // 0xE8 |
{0x3C,0x7C,0x42,0x43,0x7D,0x3C,0x00,0x00}, // 0xE9 |
{0x3A,0x79,0x41,0x41,0x79,0x3A,0x00,0x00}, // 0xEA |
{0x3C,0x7D,0x43,0x42,0x7C,0x3C,0x00,0x00}, // 0xEB |
{0xB8,0xB8,0xA2,0xA3,0xF9,0x78,0x00,0x00}, // 0xEC |
{0x0C,0x5C,0x72,0x73,0x5D,0x0C,0x00,0x00}, // 0xED |
{0x02,0x02,0x02,0x02,0x02,0x02,0x00,0x00}, // 0xEE |
{0x00,0x00,0x02,0x03,0x01,0x00,0x00,0x00}, // 0xEF |
{0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00}, // 0xF0 |
{0x44,0x44,0x5F,0x5F,0x44,0x44,0x00,0x00}, // 0xF1 |
{0x28,0x28,0x28,0x28,0x28,0x28,0x00,0x00}, // 0xF2 |
{0x71,0x35,0x1F,0x4C,0x66,0x73,0xD9,0xF8}, // 0xF3 |
{0x06,0x0F,0x09,0x7F,0x7F,0x01,0x7F,0x7F}, // 0xF4 |
{0xDA,0xBF,0xA5,0xA5,0xFD,0x59,0x03,0x02}, // 0xF5 |
{0x08,0x08,0x6B,0x6B,0x08,0x08,0x00,0x00}, // 0xF6 |
{0x00,0x80,0xC0,0x40,0x00,0x00,0x00,0x00}, // 0xF7 |
{0x00,0x06,0x0F,0x09,0x0F,0x06,0x00,0x00}, // 0xF8 |
{0x02,0x02,0x00,0x00,0x02,0x02,0x00,0x00}, // 0xF9 |
{0x00,0x00,0x00,0x10,0x10,0x00,0x00,0x00}, // 0xFA |
{0x00,0x12,0x13,0x1F,0x1F,0x10,0x10,0x00}, // 0xFB |
{0x00,0x11,0x15,0x15,0x1F,0x1F,0x0A,0x00}, // 0xFC |
{0x00,0x19,0x1D,0x15,0x17,0x12,0x00,0x00}, // 0xFD |
{0x00,0x00,0x3C,0x3C,0x3C,0x3C,0x00,0x00}, // 0xFE |
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00} // 0xFF |
}; |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/lcd/Font8x8.h |
---|
0,0 → 1,31 |
/***************************************************************************** |
* Copyright (C) 2009 Peter "woggle" Mack, mac@denich.net * |
* - font provided by Claas Anders "CaScAdE" Rathje * |
* - umlauts and special characters by Peter "woggle" Mack * |
* * |
* This program is free software; you can redistribute it and/or modify * |
* it under the terms of the GNU General Public License as published by * |
* the Free Software Foundation; either version 2 of the License. * |
* * |
* This program is distributed in the hope that it will be useful, * |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
* GNU General Public License for more details. * |
* * |
* You should have received a copy of the GNU General Public License * |
* along with this program; if not, write to the * |
* Free Software Foundation, Inc., * |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
* * |
*****************************************************************************/ |
#ifndef _FONT8X8_H |
#define _FONT8X8_H |
#include <avr/pgmspace.h> |
extern const uint8_t Font8x8[256][8]; |
#endif |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/lcd/font8x6.c |
---|
0,0 → 1,172 |
/***************************************************************************** |
* Copyright (C) 2009 Peter "woggle" Mack, mac@denich.net * |
* - font provided by Claas Anders "CaScAdE" Rathje * |
* - umlauts and special characters by Peter "woggle" Mack * |
* * |
* This program is free software; you can redistribute it and/or modify * |
* it under the terms of the GNU General Public License as published by * |
* the Free Software Foundation; either version 2 of the License. * |
* * |
* This program is distributed in the hope that it will be useful, * |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
* GNU General Public License for more details. * |
* * |
* You should have received a copy of the GNU General Public License * |
* along with this program; if not, write to the * |
* Free Software Foundation, Inc., * |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
* * |
*****************************************************************************/ |
#include <avr/pgmspace.h> |
// one byte is a column |
// bit 7 is the bottom |
// |
// 123456 |
// L 1 | XXX | |
// O 2 |X X | |
// W 4 |X X | |
// 8 | XXX | |
// H 1 |X X | |
// I 2 |X X | |
// G 4 | XXX | |
// H 8 | | |
// |
// 0x36,0x49,0x49,0x49,0x36,0x00 |
// |
//prog_uint8_t font8x6[128][6] = // führt zu Fehler mit AVR-GCC 4.5.1 21.2.2012 Cebra |
const uint8_t font8x6[128][6] PROGMEM = |
{ |
{ 0x00,0x00,0x00,0x00,0x00,0x00 }, // ASCII - 0 00 (not useable) |
{ 0x78,0x15,0x14,0x15,0x78,0x00 }, // ASCII - 1 01 'Ä' |
{ 0x20,0x55,0x54,0x55,0x78,0x00 }, // ASCII - 2 02 'ä' |
{ 0x38,0x45,0x44,0x45,0x38,0x00 }, // ASCII - 3 03 'Ö' |
{ 0x30,0x49,0x48,0x49,0x30,0x00 }, // ASCII - 4 04 'ö' |
{ 0x3c,0x41,0x40,0x41,0x3c,0x00 }, // ASCII - 5 05 'Ü' |
{ 0x38,0x41,0x40,0x21,0x78,0x00 }, // ASCII - 6 06 'ü' |
{ 0x7e,0x15,0x15,0x15,0x0a,0x00 }, // ASCII - 7 07 'ß' |
{ 0x22,0x17,0x0F,0x17,0x22,0x00 }, // ASCII - 8 08 SAT Symbol |
{ 0x00,0x84,0x82,0xFF,0x82,0x84 }, // ASCII - 9 09 Altitude Symbol |
{ 0x00,0x00,0x00,0x00,0x00,0x00 }, // ASCII - 10 0A (not useable) |
{ 0x00,0x00,0x00,0x00,0x00,0x00 }, // ASCII - 11 0B |
{ 0x10,0x38,0x54,0x10,0x10,0x1e }, // ASCII - 12 0C Enter Symbol |
{ 0x00,0x00,0x00,0x00,0x00,0x00 }, // ASCII - 13 0D (not useable) |
{ 0x10,0x10,0x10,0x10,0x10,0x10 }, // ASCII - 14 0E hor. line |
{ 0x10,0x10,0x10,0x7c,0x10,0x10 }, // ASCII - 15 0F hor. line with tick mark |
{ 0x00,0x00,0x00,0x00,0x00,0x00 }, // ASCII - 16 10 |
{ 0x08,0x14,0x00,0x00,0x14,0x08 }, // ASCII - 17 11 <> Change |
{ 0x10,0x08,0x04,0x04,0x08,0x10 }, // ASCII - 18 12 /\ Up |
{ 0x08,0x10,0x20,0x20,0x10,0x08 }, // ASCII - 19 13 \/ Down |
{ 0x00,0x08,0x14,0x22,0x41,0x00 }, // ASCII - 20 14 < Left |
{ 0x00,0x41,0x22,0x14,0x08,0x00 }, // ASCII - 21 15 > Right |
{ 0x04,0x02,0x7f,0x02,0x04,0x00 }, // ASCII - 22 16 /|\ Arrow up |
{ 0x10,0x20,0x7f,0x20,0x10,0x00 }, // ASCII - 23 17 \|/ Arrow down |
{ 0x10,0x38,0x54,0x10,0x10,0x10 }, // ASCII - 24 18 <- Arrow left |
{ 0x10,0x10,0x10,0x54,0x38,0x10 }, // ASCII - 25 19 -> Arrow right |
{ 0x10,0x18,0x1c,0x1c,0x18,0x10 }, // ASCII - 26 1A ^ Triangle up |
{ 0x08,0x18,0x38,0x38,0x18,0x08 }, // ASCII - 27 1B v Triangle down |
{ 0x00,0x08,0x1c,0x3e,0x7f,0x00 }, // ASCII - 28 1C < Triangle left |
{ 0x00,0x7f,0x3e,0x1c,0x08,0x00 }, // ASCII - 29 1D > Triangle right |
{ 0x06,0x09,0x09,0x09,0x06,0x00 }, // ASCII - 30 1E '°' |
{ 0x06,0x49,0x7d,0x49,0x06,0x00 }, // ASCII - 31 1F Antenne |
{ 0x00,0x00,0x00,0x00,0x00,0x00 }, // ASCII - 32 20 ' ' |
{ 0x00,0x00,0x2f,0x00,0x00,0x00 }, // ASCII - 33 21 '!' |
{ 0x00,0x07,0x00,0x07,0x00,0x00 }, // ASCII - 34 22 '"' |
{ 0x14,0x7f,0x14,0x7f,0x14,0x00 }, // ASCII - 35 23 '#' |
{ 0x24,0x2a,0x6b,0x2a,0x12,0x00 }, // ASCII - 36 24 '$' |
{ 0x23,0x13,0x08,0x64,0x62,0x00 }, // ASCII - 37 25 '%' |
{ 0x36,0x49,0x55,0x22,0x50,0x00 }, // ASCII - 38 26 '&' |
{ 0x00,0x05,0x03,0x00,0x00,0x00 }, // ASCII - 39 27 ''' |
{ 0x00,0x1c,0x22,0x41,0x00,0x00 }, // ASCII - 40 28 '(' |
{ 0x00,0x41,0x22,0x1c,0x00,0x00 }, // ASCII - 41 29 ')' |
{ 0x14,0x08,0x3e,0x08,0x14,0x00 }, // ASCII - 42 2a '*' |
{ 0x08,0x08,0x3e,0x08,0x08,0x00 }, // ASCII - 43 2b '+' |
{ 0x00,0x50,0x30,0x00,0x00,0x00 }, // ASCII - 44 2c ',' |
{ 0x08,0x08,0x08,0x08,0x08,0x00 }, // ASCII - 45 2d '-' |
{ 0x00,0x60,0x60,0x00,0x00,0x00 }, // ASCII - 46 2e '.' |
{ 0x20,0x10,0x08,0x04,0x02,0x00 }, // ASCII - 47 2f '/' |
{ 0x3e,0x51,0x49,0x45,0x3e,0x00 }, // ASCII - 48 30 '0' |
{ 0x00,0x42,0x7f,0x40,0x00,0x00 }, // ASCII - 49 31 '1' |
{ 0x42,0x61,0x51,0x49,0x46,0x00 }, // ASCII - 50 32 '2' |
{ 0x21,0x41,0x45,0x4b,0x31,0x00 }, // ASCII - 51 33 '3' |
{ 0x18,0x14,0x12,0x7f,0x10,0x00 }, // ASCII - 52 34 '4' |
{ 0x27,0x45,0x45,0x45,0x39,0x00 }, // ASCII - 53 35 '5' |
{ 0x3c,0x4a,0x49,0x49,0x30,0x00 }, // ASCII - 54 36 '6' |
{ 0x03,0x01,0x71,0x09,0x07,0x00 }, // ASCII - 55 37 '7' |
{ 0x36,0x49,0x49,0x49,0x36,0x00 }, // ASCII - 56 38 '8' |
{ 0x06,0x49,0x49,0x29,0x1e,0x00 }, // ASCII - 57 39 '9' |
{ 0x00,0x36,0x36,0x00,0x00,0x00 }, // ASCII - 58 3a ':' |
{ 0x00,0x56,0x36,0x00,0x00,0x00 }, // ASCII - 59 3b ';' |
{ 0x08,0x14,0x22,0x41,0x00,0x00 }, // ASCII - 60 3c '<' |
{ 0x14,0x14,0x14,0x14,0x14,0x00 }, // ASCII - 61 3d '=' |
{ 0x00,0x41,0x22,0x14,0x08,0x00 }, // ASCII - 62 3e '>' |
{ 0x02,0x01,0x51,0x09,0x06,0x00 }, // ASCII - 63 3f '?' |
{ 0x32,0x49,0x79,0x41,0x3e,0x00 }, // ASCII - 64 40 '@' |
{ 0x7e,0x11,0x11,0x11,0x7e,0x00 }, // ASCII - 65 41 'A' |
{ 0x7f,0x49,0x49,0x49,0x36,0x00 }, // ASCII - 66 42 'B' |
{ 0x3e,0x41,0x41,0x41,0x22,0x00 }, // ASCII - 67 43 'C' |
{ 0x7f,0x41,0x41,0x22,0x1c,0x00 }, // ASCII - 68 44 'D' |
{ 0x7f,0x49,0x49,0x49,0x41,0x00 }, // ASCII - 69 45 'E' |
{ 0x7f,0x09,0x09,0x09,0x01,0x00 }, // ASCII - 70 46 'F' |
{ 0x3e,0x41,0x49,0x49,0x7a,0x00 }, // ASCII - 71 47 'G' |
{ 0x7f,0x08,0x08,0x08,0x7f,0x00 }, // ASCII - 72 48 'H' |
{ 0x00,0x41,0x7f,0x41,0x00,0x00 }, // ASCII - 73 49 'I' |
{ 0x20,0x40,0x41,0x3f,0x01,0x00 }, // ASCII - 74 4a 'J' |
{ 0x7f,0x08,0x14,0x22,0x41,0x00 }, // ASCII - 75 4b 'K' |
{ 0x7f,0x40,0x40,0x40,0x40,0x00 }, // ASCII - 76 4c 'L' |
{ 0x7f,0x02,0x0c,0x02,0x7f,0x00 }, // ASCII - 77 4d 'M' |
{ 0x7f,0x04,0x08,0x10,0x7f,0x00 }, // ASCII - 78 4e 'N' |
{ 0x3e,0x41,0x41,0x41,0x3e,0x00 }, // ASCII - 79 4f 'O' |
{ 0x7f,0x09,0x09,0x09,0x06,0x00 }, // ASCII - 80 50 'P' |
{ 0x3e,0x41,0x51,0x21,0x5e,0x00 }, // ASCII - 81 51 'Q' |
{ 0x7f,0x09,0x19,0x29,0x46,0x00 }, // ASCII - 82 52 'R' |
{ 0x46,0x49,0x49,0x49,0x31,0x00 }, // ASCII - 83 53 'S' |
{ 0x01,0x01,0x7f,0x01,0x01,0x00 }, // ASCII - 84 54 'T' |
{ 0x3f,0x40,0x40,0x40,0x3f,0x00 }, // ASCII - 85 55 'U' |
{ 0x1f,0x20,0x40,0x20,0x1f,0x00 }, // ASCII - 86 56 'V' |
{ 0x3f,0x40,0x38,0x40,0x3f,0x00 }, // ASCII - 87 57 'W' |
{ 0x63,0x14,0x08,0x14,0x63,0x00 }, // ASCII - 88 58 'X' |
{ 0x07,0x08,0x70,0x08,0x07,0x00 }, // ASCII - 89 59 'Y' |
{ 0x61,0x51,0x49,0x45,0x43,0x00 }, // ASCII - 90 5a 'Z' |
{ 0x7f,0x41,0x41,0x00,0x00,0x00 }, // ASCII - 91 5b '[' |
{ 0x02,0x04,0x08,0x10,0x20,0x00 }, // ASCII - 92 5c '\' |
{ 0x00,0x41,0x41,0x7f,0x00,0x00 }, // ASCII - 93 5d ']' |
{ 0x04,0x02,0x01,0x02,0x04,0x00 }, // ASCII - 94 5e '^' |
{ 0x40,0x40,0x40,0x40,0x40,0x00 }, // ASCII - 95 5f '_' |
{ 0x00,0x01,0x02,0x04,0x00,0x00 }, // ASCII - 96 60 '`' |
{ 0x20,0x54,0x54,0x54,0x78,0x00 }, // ASCII - 97 61 'a' |
{ 0x7f,0x48,0x44,0x44,0x38,0x00 }, // ASCII - 98 62 'b' |
{ 0x38,0x44,0x44,0x44,0x20,0x00 }, // ASCII - 99 63 'c' |
{ 0x38,0x44,0x44,0x48,0x7f,0x00 }, // ASCII - 100 64 'd' |
{ 0x38,0x54,0x54,0x54,0x18,0x00 }, // ASCII - 101 65 'e' |
{ 0x08,0x7e,0x09,0x01,0x02,0x00 }, // ASCII - 102 66 'f' |
{ 0x0c,0x52,0x52,0x52,0x3e,0x00 }, // ASCII - 103 67 'g' |
{ 0x7f,0x08,0x04,0x04,0x78,0x00 }, // ASCII - 104 68 'h' |
{ 0x00,0x44,0x7d,0x40,0x00,0x00 }, // ASCII - 105 69 'i' |
{ 0x20,0x40,0x44,0x3d,0x00,0x00 }, // ASCII - 106 6a 'j' |
{ 0x7f,0x10,0x28,0x44,0x00,0x00 }, // ASCII - 107 6b 'k' |
{ 0x00,0x41,0x7f,0x40,0x00,0x00 }, // ASCII - 108 6c 'l' |
{ 0x7c,0x04,0x18,0x04,0x78,0x00 }, // ASCII - 109 6d 'm' |
{ 0x7c,0x08,0x04,0x04,0x78,0x00 }, // ASCII - 110 6e 'n' |
{ 0x38,0x44,0x44,0x44,0x38,0x00 }, // ASCII - 111 6f 'o' |
{ 0x7c,0x14,0x14,0x14,0x08,0x00 }, // ASCII - 112 70 'p' |
{ 0x08,0x14,0x14,0x18,0x7c,0x00 }, // ASCII - 113 71 'q' |
{ 0x7c,0x08,0x04,0x04,0x08,0x00 }, // ASCII - 114 72 'r' |
{ 0x48,0x54,0x54,0x54,0x20,0x00 }, // ASCII - 115 73 's' |
{ 0x04,0x3f,0x44,0x40,0x20,0x00 }, // ASCII - 116 74 't' |
{ 0x3c,0x40,0x40,0x20,0x7c,0x00 }, // ASCII - 117 75 'u' |
{ 0x1c,0x20,0x40,0x20,0x1c,0x00 }, // ASCII - 118 76 'v' |
{ 0x3c,0x40,0x38,0x40,0x3c,0x00 }, // ASCII - 119 77 'w' |
{ 0x44,0x28,0x10,0x28,0x44,0x00 }, // ASCII - 120 78 'x' |
{ 0x0c,0x50,0x50,0x50,0x3c,0x00 }, // ASCII - 121 79 'y' |
{ 0x44,0x64,0x54,0x4c,0x44,0x00 }, // ASCII - 122 7a 'z' |
{ 0x00,0x08,0x36,0x41,0x00,0x00 }, // ASCII - 123 7b '{' |
{ 0x00,0x00,0x7f,0x00,0x00,0x00 }, // ASCII - 124 7c '|' |
{ 0x00,0x41,0x36,0x08,0x00,0x00 }, // ASCII - 125 7d '}' |
{ 0x08,0x08,0x2a,0x1c,0x08,0x00 }, // ASCII - 126 7e -> |
{ 0x08,0x1c,0x2a,0x08,0x08,0x00 }, // ASCII - 127 7f <- |
}; |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/lcd/font8x6.h |
---|
0,0 → 1,30 |
/***************************************************************************** |
* Copyright (C) 2009 Peter "woggle" Mack, mac@denich.net * |
* - font provided by Claas Anders "CaScAdE" Rathje * |
* - umlauts and special characters by Peter "woggle" Mack * |
* * |
* This program is free software; you can redistribute it and/or modify * |
* it under the terms of the GNU General Public License as published by * |
* the Free Software Foundation; either version 2 of the License. * |
* * |
* This program is distributed in the hope that it will be useful, * |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
* GNU General Public License for more details. * |
* * |
* You should have received a copy of the GNU General Public License * |
* along with this program; if not, write to the * |
* Free Software Foundation, Inc., * |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
* * |
*****************************************************************************/ |
#ifndef _FONT8X6_H |
#define _FONT8X6_H |
#include <avr/pgmspace.h> |
//extern prog_uint8_t font8x6[128][6]; |
extern const uint8_t font8x6[128][6]; |
#endif |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/lcd/lcd/.directory |
---|
0,0 → 1,3 |
[Dolphin] |
Timestamp=2013,3,7,9,14,6 |
ViewMode=1 |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/lcd/lcd/lcd.c |
---|
0,0 → 1,1402 |
/***************************************************************************** |
* Copyright (C) 2009 Peter "woggle" Mack, mac@denich.net * |
* - original LCD control by Thomas "thkais" Kaiser * |
* - special number formating routines taken from C-OSD * |
* from Claas Anders "CaScAdE" Rathje * |
* - some extension, ellipse and circ_line by Peter "woggle" Mack * |
* * |
* This program is free software; you can redistribute it and/or modify * |
* it under the terms of the GNU General Public License as published by * |
* the Free Software Foundation; either version 2 of the License. * |
* * |
* This program is distributed in the hope that it will be useful, * |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
* GNU General Public License for more details. * |
* * |
* You should have received a copy of the GNU General Public License * |
* along with this program; if not, write to the * |
* Free Software Foundation, Inc., * |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
* * |
*****************************************************************************/ |
#include "../cpu.h" |
#include <avr/io.h> |
#include <avr/pgmspace.h> |
#include <util/delay.h> |
#include <stdlib.h> |
#include <string.h> |
#include <math.h> |
#include "font8x6.h" |
#include "Font8x8.h" |
#include "../eeprom/eeprom.h" |
#include "lcd.h" |
#include "../main.h" |
#include "../HAL_HW3_9.h" |
#define DISP_W 128 |
#define DISP_H 64 |
#define DISP_BUFFER ((DISP_H * DISP_W) / 8) |
#define LINE_BUFFER (((DISP_H/8) * DISP_W) / 8) |
#define Jeti 1 // Jeti Routinen |
volatile uint8_t display_buffer[DISP_BUFFER]; // Display-Puffer, weil nicht zurückgelesen werden kann |
volatile uint8_t line_buffer[LINE_BUFFER]; // Zeilen-Puffer, weil nicht zurückgelesen werden kann |
volatile uint16_t display_buffer_pointer; // Pointer auf das aktuell übertragene Byte |
volatile uint8_t display_buffer_counter; // Hilfszähler zur Selektierung der Page |
volatile uint8_t display_page_counter; // aktuelle Page-Nummer |
volatile uint8_t display_mode; // Modus für State-Machine |
volatile uint8_t LCD_ORIENTATION; |
// DOG: 128 x 64 with 6x8 Font => 21 x 8 |
// MAX7456: 30 x 16 |
uint8_t lcd_xpos; |
uint8_t lcd_ypos; |
//----------------------------------------------------------- |
void send_byte (uint8_t data) |
{ |
clr_cs (); |
SPDR = data; |
while (!(SPSR & (1<<SPIF))); |
//SPSR = SPSR; |
set_cs (); |
} |
//----------------------------------------------------------- |
// * Writes one command byte |
// * cmd - the command byte |
// |
void lcd_command(uint8_t cmd) |
{ |
// LCD_SELECT(); |
// LCD_CMD(); |
// spi_write(cmd); |
// LCD_UNSELECT(); |
clr_cs (); |
SPDR = cmd; |
while (!(SPSR & (1<<SPIF))); |
//SPSR = SPSR; |
set_cs (); |
} |
//----------------------------------------------------------- |
void lcd_cls (void) |
{ |
uint16_t i, j; |
// memset (display_buffer, 0, 1024); |
for (i = 0; i < DISP_BUFFER; i++) |
display_buffer[i] = 0x00; |
for (i = 0; i < 8; i++) |
{ |
clr_A0 (); |
send_byte (0xB0 + i); //1011xxxx |
send_byte (0x10); //00010000 |
// send_byte(0x04); //00000100 gedreht plus 4 Byte |
// send_byte(0x00); //00000000 |
send_byte (LCD_ORIENTATION); //00000000 |
set_A0 (); |
for (j = 0; j < 128; j++) |
send_byte (0x00); |
} |
lcd_xpos = 0; |
lcd_ypos = 0; |
} |
//----------------------------------------------------------- |
void lcd_cls_line (uint8_t x, uint8_t y, uint8_t w) |
{ |
uint8_t lcd_width; |
uint8_t lcd_zpos; |
uint8_t i; |
uint8_t max = 21; |
lcd_width = w; |
lcd_xpos = x; |
lcd_ypos = y; |
if ((lcd_xpos + lcd_width) > max) |
lcd_width = max - lcd_xpos; |
lcd_zpos = lcd_xpos + lcd_width; |
for (i = lcd_xpos; i < lcd_zpos; i++) |
lcd_putc (i, lcd_ypos, 0x20, 0); |
} |
//----------------------------------------------------------- |
void wait_1ms (void) |
{ |
_delay_ms (1); |
} |
//----------------------------------------------------------- |
void wait_ms (uint16_t time) |
{ |
uint16_t i; |
for (i = 0; i < time; i++) |
wait_1ms (); |
} |
//----------------------------------------------------------- |
void LCD_Init (uint8_t LCD_Mode) // LCD_Mode 0= Default Mode 1= EEPROM-Parameter) |
{ |
lcd_xpos = 0; |
lcd_ypos = 0; |
// DDRB = 0xFF; |
// SPI max. speed |
// the DOGM128 lcd controller can work at 20 MHz |
SPCR = (1 << SPE) | (1 << MSTR) | (1 << CPHA) | (1 << CPOL); |
SPSR = (1 << SPI2X); |
set_cs (); |
clr_reset (); |
wait_ms (10); |
set_reset (); |
clr_cs (); |
clr_A0 (); |
send_byte (0x40); //Display start line = 0 |
if (LCD_Mode == 1) |
{ |
if (LCD_ORIENTATION == 0) |
{ |
send_byte (0xA1); // A1 normal A0 reverse(original) |
send_byte (0xC0); // C0 normal C8 reverse(original) |
} |
else |
{ |
send_byte (0xA0); // A1 normal A0 reverse(original) |
send_byte (0xC8); // C0 normal C8 reverse(original) |
} |
} |
else |
{ |
send_byte (0xA1); // A1 normal A0 reverse(original) |
send_byte (0xC0); // C0 normal C8 reverse(original) |
} |
if (LCD_Mode == 1) |
{ |
if (Config.LCD_DisplayMode == 0) |
send_byte (0xA6); //Display normal, not mirrored |
else |
send_byte (0xA7); //Display reverse, not mirrored |
} |
else |
send_byte (0xA6); |
send_byte (0xA2); //Set bias 1/9 (Duty 1/65) |
send_byte (0x2F); //Booster, regulator and follower on |
send_byte (0xF8); //Set internal booster to 4x |
send_byte (0x00); //Set internal booster to 4x |
send_byte (0x27); //resistor ratio set |
if (LCD_Mode == 1) |
{ |
send_byte (0x81); //Electronic volume register set |
send_byte (Config.LCD_Kontrast); //Electronic volume register set |
} |
else |
{ |
send_byte (0x81); |
send_byte (0x16); |
} |
send_byte (0xAC); //Cursor |
send_byte (0x00); //No Cursor |
send_byte (0xAF); //No indicator |
if (Config.HWSound==0) |
{ |
if (LCD_Mode == 1) |
{ |
// Helligkeit setzen |
OCR2A = Config.LCD_Helligkeit * 2.55; |
} |
else |
{ |
OCR2A = 255; |
} |
} |
lcd_cls (); |
} |
//----------------------------------------------------------- |
void set_adress (uint16_t adress, uint8_t data) |
{ |
uint8_t page; |
uint8_t column; |
page = adress >> 7; |
clr_A0 (); |
send_byte (0xB0 + page); |
column = (adress & 0x7F) + LCD_ORIENTATION; |
send_byte (0x10 + (column >> 4)); |
send_byte (column & 0x0F); |
set_A0 (); |
send_byte (data); |
} |
//----------------------------------------------------------- |
void scroll (void) |
{ |
uint16_t adress; |
for (adress = 0; adress < 896; adress++) |
{ |
display_buffer[adress] = display_buffer[adress + 128]; |
set_adress (adress, display_buffer[adress]); |
} |
for (adress = 896; adress < 1024; adress++) |
{ |
display_buffer[adress] = 0; |
set_adress (adress, 0); |
} |
} |
//----------------------------------------------------------- |
// sicher eine Zeile für die Statusanzeige |
void copy_line (uint8_t y) |
{ |
uint8_t i; |
uint16_t adress; |
adress = y * 128 + 0 * 6; |
adress &= 0x3FF; |
for (i = 0; i < 6*21; i++) |
{ |
line_buffer[i] = display_buffer[adress+i]; |
set_adress (adress + i, display_buffer[adress + i]); |
} |
} |
//----------------------------------------------------------- |
// holt gesicherte Zeile wieder zurück |
void paste_line (uint8_t y) |
{ |
uint8_t i; |
uint16_t adress; |
adress = y * 128 + 0 * 6; |
adress &= 0x3FF; |
for (i = 0; i < 6*21; i++) |
{ |
display_buffer[adress+i] =line_buffer[i]; |
set_adress (adress + i, display_buffer[adress + i]); |
} |
} |
//----------------------------------------------------------- |
void lcd_puts_at(uint8_t x, uint8_t y,const char *s, uint8_t mode ) |
{ |
while (*s) |
{ |
lcd_putc(x, y, *s++, mode); |
x++; |
} |
}/* lcd_puts */ |
//----------------------------------------------------------- |
void lcd_putc (uint8_t x, uint8_t y, uint8_t c, uint8_t mode) |
{ |
uint8_t ch; |
uint8_t i; |
uint16_t adress; |
if (mode == 2) |
lcd_frect ((x*6),(y*8),5,7,1); // invertierte Darstellung |
if (mode == 3) lcd_putc_jeti (x, y, c,0); |
else |
if (mode == 4) lcd_putc_jeti (x, y, c,2); |
else |
{ |
switch (c) |
{ // ISO 8859-1 |
case 0xc4: // Ä |
c = 0x01; |
break; |
case 0xe4: // ä |
c = 0x02; |
break; |
case 0xd6: // Ö |
c = 0x03; |
break; |
case 0xf6: // ö |
c = 0x04; |
break; |
case 0xdc: // Ü |
c = 0x05; |
break; |
case 0xfc: // ü |
c = 0x06; |
break; |
case 0xdf: // ß |
//c = 0x07; |
c = 0x1e; // ° (used by Jeti) |
break; |
} |
c &= 0x7f; |
adress = y * 128 + x * 6; |
adress &= 0x3FF; |
for (i = 0; i < 6; i++) |
{ |
ch = pgm_read_byte (&font8x6[0][0] + i + c * 6); |
switch (mode) |
{ |
case 0: |
display_buffer[adress+i] = ch; |
break; |
case 1: |
display_buffer[adress+i] |= ch; |
break; |
case 2: |
display_buffer[adress+i] ^= ch; |
break; |
case 3: |
display_buffer[adress+i] &= ch; |
break; |
case 4: |
display_buffer[adress+i] &= ~ch; |
break; |
} |
set_adress (adress + i, display_buffer[adress + i]); |
} |
} |
} |
#if Jeti |
//----------------------------------------------------------- |
void lcd_putc_jeti (uint8_t x, uint8_t y, uint8_t c, uint8_t mode) |
{ |
uint8_t ch; |
uint8_t i; |
uint16_t adress; |
if (mode == 2) |
lcd_frect ((x*8),(y*8),8,8,1); // invertierte Darstellung |
switch (c) |
{ |
case 0x7e: |
c = 0x1a; // -> |
break; |
case 0x7f: |
c = 0x1b; // <- |
break; |
case 0xdf: |
c = 0xf8; // ° |
break; |
} |
adress = y * 128 + x * 8; |
adress &= 0x3FF; |
for (i = 0; i < 8; i++) |
{ |
ch = pgm_read_byte (&Font8x8[0][0] + i + c * 8); |
switch (mode) |
{ |
case 0: |
display_buffer[adress+i] = ch; |
break; |
case 1: |
display_buffer[adress+i] |= ch; |
break; |
case 2: |
display_buffer[adress+i] ^= ch; |
break; |
case 3: |
display_buffer[adress+i] &= ch; |
break; |
case 4: |
display_buffer[adress+i] &= ~ch; |
break; |
} |
set_adress (adress + i, display_buffer[adress + i]); |
} |
} |
//----------------------------------------------------------- |
void lcd_printpj (const char *text, uint8_t mode) |
{ |
while (pgm_read_byte(text)) |
{ |
switch (pgm_read_byte(text)) |
{ |
case 0x0D: |
lcd_xpos = 0; |
break; |
case 0x0A: |
new_line(); |
break; |
default: |
lcd_putc_jeti (lcd_xpos, lcd_ypos, pgm_read_byte(text), mode); |
lcd_xpos++; |
if (lcd_xpos > 20) |
{ |
lcd_xpos = 0; |
new_line (); |
} |
break; |
} |
text++; |
} |
} |
//----------------------------------------------------------- |
void lcd_printpj_at (uint8_t x, uint8_t y, const char *text, uint8_t mode) |
{ |
lcd_xpos = x; |
lcd_ypos = y; |
lcd_printpj (text, mode); |
} |
#endif |
//----------------------------------------------------------- |
void new_line (void) |
{ |
lcd_ypos++; |
if (lcd_ypos > 7) |
{ |
scroll (); |
lcd_ypos = 7; |
} |
} |
//----------------------------------------------------------- |
void lcd_printpns (const char *text, uint8_t mode) |
{ |
while (pgm_read_byte(text)) |
{ |
switch (pgm_read_byte(text)) |
{ |
case 0x0D: |
lcd_xpos = 0; |
break; |
case 0x0A: |
new_line(); |
break; |
default: |
lcd_putc (lcd_xpos, lcd_ypos, pgm_read_byte(text), mode); |
lcd_xpos++; |
if (lcd_xpos > 21) |
{ |
lcd_xpos = 0; |
// new_line (); |
} |
break; |
} |
text++; |
} |
} |
//----------------------------------------------------------- |
void lcd_printpns_at (uint8_t x, uint8_t y, const char *text, uint8_t mode) |
{ |
lcd_xpos = x; |
lcd_ypos = y; |
lcd_printpns (text, mode); |
} |
//----------------------------------------------------------- |
void lcd_printp (const char *text, uint8_t mode) |
{ |
while (pgm_read_byte(text)) |
{ |
switch (pgm_read_byte(text)) |
{ |
case 0x0D: |
lcd_xpos = 0; |
break; |
case 0x0A: |
new_line(); |
break; |
default: |
lcd_putc (lcd_xpos, lcd_ypos, pgm_read_byte(text), mode); |
lcd_xpos++; |
if (lcd_xpos > 21) |
{ |
lcd_xpos = 0; |
new_line (); |
} |
break; |
} |
text++; |
} |
} |
//----------------------------------------------------------- |
void lcd_printp_at (uint8_t x, uint8_t y, const char *text, uint8_t mode) |
{ |
lcd_xpos = x; |
lcd_ypos = y; |
lcd_printp (text, mode); |
} |
//----------------------------------------------------------- |
void lcd_print (uint8_t *text, uint8_t mode) |
{ |
while (*text) |
{ |
switch (*text) |
{ |
case 0x0D: |
lcd_xpos = 0; |
break; |
case 0x0A: |
new_line(); |
break; |
default: |
lcd_putc (lcd_xpos, lcd_ypos, *text, mode); |
lcd_xpos++; |
if (lcd_xpos > 21) |
{ |
lcd_xpos = 0; |
new_line (); |
} |
break; |
} |
text++; |
} |
} |
//----------------------------------------------------------- |
void lcd_print_at (uint8_t x, uint8_t y, uint8_t *text, uint8_t mode) |
{ |
lcd_xpos = x; |
lcd_ypos = y; |
lcd_print (text, mode); |
} |
//----------------------------------------------------------- |
void print_display (uint8_t *text) |
{ |
while (*text) |
{ |
lcd_putc (lcd_xpos, lcd_ypos, *text, 0); |
lcd_xpos++; |
if (lcd_xpos >= 20) |
{ |
lcd_xpos = 0; |
new_line (); |
} |
text++; |
} |
} |
//----------------------------------------------------------- |
void print_display_at (uint8_t x, uint8_t y, uint8_t *text) |
{ |
lcd_xpos = x; |
lcd_ypos = y; |
print_display (text); |
} |
//----------------------------------------------------------- |
// + Plot (set one Pixel) |
//----------------------------------------------------------- |
// mode: |
// 0=Clear, 1=Set, 2=XOR |
void lcd_plot (uint8_t xpos, uint8_t ypos, uint8_t mode) |
{ |
uint16_t adress; |
uint8_t mask; |
if ((xpos < DISP_W) && (ypos < DISP_H)) |
{ |
adress = (ypos / 8) * DISP_W + xpos; // adress = 0/8 * 128 + 0 = 0 |
mask = 1 << (ypos & 0x07); // mask = 1<<0 = 1 |
adress &= DISP_BUFFER - 1; |
switch (mode) |
{ |
case 0: |
display_buffer[adress] &= ~mask; |
break; |
case 1: |
display_buffer[adress] |= mask; |
break; |
case 2: |
display_buffer[adress] ^= mask; |
break; |
} |
set_adress (adress, display_buffer[adress]); |
} |
} |
//----------------------------------------------------------- |
// + Line (draws a line from x1,y1 to x2,y2 |
// + Based on Bresenham line-Algorithm |
// + found in the internet, modified by thkais 2007 |
//----------------------------------------------------------- |
void lcd_line (unsigned char x1, unsigned char y1, unsigned char x2, unsigned char y2, uint8_t mode) |
{ |
int x, y, count, xs, ys, xm, ym; |
x = (int) x1; |
y = (int) y1; |
xs = (int) x2 - (int) x1; |
ys = (int) y2 - (int) y1; |
if (xs < 0) |
xm = -1; |
else |
if (xs > 0) |
xm = 1; |
else |
xm = 0; |
if (ys < 0) |
ym = -1; |
else |
if (ys > 0) |
ym = 1; |
else |
ym = 0; |
if (xs < 0) |
xs = -xs; |
if (ys < 0) |
ys = -ys; |
lcd_plot ((unsigned char) x, (unsigned char) y, mode); |
if (xs > ys) // Flat Line <45 degrees |
{ |
count = -(xs / 2); |
while (x != x2) |
{ |
count = count + ys; |
x = x + xm; |
if (count > 0) |
{ |
y = y + ym; |
count = count - xs; |
} |
lcd_plot ((unsigned char) x, (unsigned char) y, mode); |
} |
} |
else // Line >=45 degrees |
{ |
count =- (ys / 2); |
while (y != y2) |
{ |
count = count + xs; |
y = y + ym; |
if (count > 0) |
{ |
x = x + xm; |
count = count - ys; |
} |
lcd_plot ((unsigned char) x, (unsigned char) y, mode); |
} |
} |
} |
//----------------------------------------------------------- |
// + Filled rectangle |
// + x1, y1 = upper left corner |
//----------------------------------------------------------- |
void lcd_frect (uint8_t x1, uint8_t y1, uint8_t widthx, uint8_t widthy, uint8_t mode) |
{ |
uint16_t x2, y2; |
uint16_t i; |
if (x1 >= DISP_W) |
x1 = DISP_W - 1; |
if (y1 >= DISP_H) |
y1 = DISP_H - 1; |
x2 = x1 + widthx; |
y2 = y1 + widthy; |
if (x2 > DISP_W) |
x2 = DISP_W; |
if (y2 > DISP_H) |
y2 = DISP_H; |
for (i = y1; i <= y2; i++) |
{ |
lcd_line (x1, i, x2, i, mode); |
} |
} |
//----------------------------------------------------------- |
// + outline of rectangle |
// + x1, y1 = upper left corner |
//----------------------------------------------------------- |
void lcd_rect (uint8_t x1, uint8_t y1, uint8_t widthx, uint8_t widthy, uint8_t mode) |
{ |
uint16_t x2, y2; |
if (x1 >= DISP_W) |
x1 = DISP_W - 1; |
if (y1 >= DISP_H) |
y1 = DISP_H - 1; |
x2 = x1 + widthx; |
y2 = y1 + widthy; |
if (x2 > DISP_W) |
x2 = DISP_W; |
if (y2 > DISP_H) |
y2 = DISP_H; |
lcd_line (x1, y1, x2, y1, mode); |
lcd_line (x2, y1, x2, y2, mode); |
lcd_line (x2, y2, x1, y2, mode); |
lcd_line (x1, y2, x1, y1, mode); |
} |
//----------------------------------------------------------- |
// + outline of a circle |
// + Based on Bresenham-algorithm found in wikipedia |
// + modified by thkais (2007) |
//----------------------------------------------------------- |
void lcd_circle (int16_t x0, int16_t y0, int16_t radius, uint8_t mode) |
{ |
int16_t f = 1 - radius; |
int16_t ddF_x = 0; |
int16_t ddF_y = -2 * radius; |
int16_t x = 0; |
int16_t y = radius; |
lcd_plot (x0, y0 + radius, mode); |
lcd_plot (x0, y0 - radius, mode); |
lcd_plot (x0 + radius, y0, mode); |
lcd_plot (x0 - radius, y0, mode); |
while (x < y) |
{ |
if (f >= 0) |
{ |
y --; |
ddF_y += 2; |
f += ddF_y; |
} |
x ++; |
ddF_x += 2; |
f += ddF_x + 1; |
lcd_plot (x0 + x, y0 + y, mode); |
lcd_plot (x0 - x, y0 + y, mode); |
lcd_plot (x0 + x, y0 - y, mode); |
lcd_plot (x0 - x, y0 - y, mode); |
lcd_plot (x0 + y, y0 + x, mode); |
lcd_plot (x0 - y, y0 + x, mode); |
lcd_plot (x0 + y, y0 - x, mode); |
lcd_plot (x0 - y, y0 - x, mode); |
} |
} |
//----------------------------------------------------------- |
// + filled Circle |
// + modified circle-algorithm thkais (2007) |
//----------------------------------------------------------- |
void lcd_fcircle (int16_t x0, int16_t y0, int16_t radius,uint8_t mode) |
{ |
int16_t f = 1 - radius; |
int16_t ddF_x = 0; |
int16_t ddF_y = -2 * radius; |
int16_t x = 0; |
int16_t y = radius; |
lcd_line (x0, y0 + radius, x0, y0 - radius, mode); |
lcd_line (x0 + radius, y0, x0 - radius, y0, mode); |
while (x < y) |
{ |
if (f >= 0) |
{ |
y--; |
ddF_y += 2; |
f += ddF_y; |
} |
x++; |
ddF_x += 2; |
f += ddF_x + 1; |
lcd_line (x0 + x, y0 + y, x0 - x, y0 + y, mode); |
lcd_line (x0 + x, y0 - y, x0 - x, y0 - y, mode); |
lcd_line (x0 + y, y0 + x, x0 - y, y0 + x, mode); |
lcd_line (x0 + y, y0 - x, x0 - y, y0 - x, mode); |
} |
} |
//----------------------------------------------------------- |
// |
void lcd_circ_line (uint8_t x, uint8_t y, uint8_t r, uint16_t deg, uint8_t mode) |
{ |
uint8_t xc, yc; |
double deg_rad; |
deg_rad = (deg * M_PI) / 180.0; |
yc = y - (uint8_t) round (cos (deg_rad) * (double) r); |
xc = x + (uint8_t) round (sin (deg_rad) * (double) r); |
lcd_line (x, y, xc, yc, mode); |
} |
//----------------------------------------------------------- |
// |
void lcd_ellipse_line (uint8_t x, uint8_t y, uint8_t rx, uint8_t ry, uint16_t deg, uint8_t mode) |
{ |
uint8_t xc, yc; |
double deg_rad; |
deg_rad = (deg * M_PI) / 180.0; |
yc = y - (uint8_t) round (cos (deg_rad) * (double) ry); |
xc = x + (uint8_t) round (sin (deg_rad) * (double) rx); |
lcd_line (x, y, xc, yc, mode); |
} |
//----------------------------------------------------------- |
// |
void lcd_ellipse (int16_t x0, int16_t y0, int16_t rx, int16_t ry, uint8_t mode) |
{ |
const int16_t rx2 = rx * rx; |
const int16_t ry2 = ry * ry; |
int16_t F = round (ry2 - rx2 * ry + 0.25 * rx2); |
int16_t ddF_x = 0; |
int16_t ddF_y = 2 * rx2 * ry; |
int16_t x = 0; |
int16_t y = ry; |
lcd_plot (x0, y0 + ry, mode); |
lcd_plot (x0, y0 - ry, mode); |
lcd_plot (x0 + rx, y0, mode); |
lcd_plot (x0 - rx, y0, mode); |
// while ( 2*ry2*x < 2*rx2*y ) { we can use ddF_x and ddF_y |
while (ddF_x < ddF_y) |
{ |
if(F >= 0) |
{ |
y -= 1; // south |
ddF_y -= 2 * rx2; |
F -= ddF_y; |
} |
x += 1; // east |
ddF_x += 2 * ry2; |
F += ddF_x + ry2; |
lcd_plot (x0 + x, y0 + y, mode); |
lcd_plot (x0 + x, y0 - y, mode); |
lcd_plot (x0 - x, y0 + y, mode); |
lcd_plot (x0 - x, y0 - y, mode); |
} |
F = round (ry2 * (x + 0.5) * (x + 0.5) + rx2 * (y - 1) * (y - 1) - rx2 * ry2); |
while(y > 0) |
{ |
if(F <= 0) |
{ |
x += 1; // east |
ddF_x += 2 * ry2; |
F += ddF_x; |
} |
y -= 1; // south |
ddF_y -= 2 * rx2; |
F += rx2 - ddF_y; |
lcd_plot (x0 + x, y0 + y, mode); |
lcd_plot (x0 + x, y0 - y, mode); |
lcd_plot (x0 - x, y0 + y, mode); |
lcd_plot (x0 - x, y0 - y, mode); |
} |
} |
//----------------------------------------------------------- |
// |
void lcd_ecircle (int16_t x0, int16_t y0, int16_t radius, uint8_t mode) |
{ |
lcd_ellipse (x0, y0, radius + 3, radius, mode); |
} |
//----------------------------------------------------------- |
// |
void lcd_ecirc_line (uint8_t x, uint8_t y, uint8_t r, uint16_t deg, uint8_t mode) |
{ |
lcd_ellipse_line(x, y, r + 3, r, deg, mode); |
} |
//----------------------------------------------------------- |
// |
void lcd_view_font (uint8_t page) |
{ |
int x; |
int y; |
lcd_cls (); |
lcd_printp (PSTR(" 0123456789ABCDEF\r\n"), 0); |
lcd_printpns_at (0, 7, PSTR(" \x1a \x1b Exit"), 0); |
lcd_ypos = 2; |
for (y = page * 4 ; y < (page * 4 + 4); y++) |
{ |
if (y < 10) |
{ |
lcd_putc (0, lcd_ypos, '0' + y, 0); |
} |
else |
{ |
lcd_putc (0, lcd_ypos, 'A' + y - 10, 0); |
} |
lcd_xpos = 2; |
for (x = 0; x < 16; x++) |
{ |
lcd_putc (lcd_xpos, lcd_ypos, y * 16 + x, 0); |
lcd_xpos++; |
} |
lcd_ypos++; |
} |
} |
//----------------------------------------------------------- |
uint8_t hdigit (uint8_t d) |
{ |
if (d < 10) |
{ |
return '0' + d; |
} |
else |
{ |
return 'A' + d - 10; |
} |
} |
//----------------------------------------------------------- |
void lcd_print_hex_at (uint8_t x, uint8_t y, uint8_t h, uint8_t mode) |
{ |
lcd_xpos = x; |
lcd_ypos = y; |
lcd_putc (lcd_xpos++, lcd_ypos, hdigit (h >> 4), mode); |
lcd_putc (lcd_xpos, lcd_ypos, hdigit (h & 0x0f), mode); |
} |
//----------------------------------------------------------- |
void lcd_print_hex (uint8_t h, uint8_t mode) |
{ |
// lcd_xpos = x; |
// lcd_ypos = y; |
lcd_putc (lcd_xpos++, lcd_ypos, hdigit (h >> 4), mode); |
lcd_putc (lcd_xpos++, lcd_ypos, hdigit (h & 0x0f), mode); |
lcd_putc (lcd_xpos++, lcd_ypos, ' ', mode); |
} |
//----------------------------------------------------------- |
void lcd_write_number_u (uint8_t number) |
{ |
uint8_t num = 100; |
uint8_t started = 0; |
while (num > 0) |
{ |
uint8_t b = number / num; |
if (b > 0 || started || num == 1) |
{ |
lcd_putc (lcd_xpos++, lcd_ypos, '0' + b, 0); |
started = 1; |
} |
number -= b * num; |
num /= 10; |
} |
} |
//----------------------------------------------------------- |
void lcd_write_number_u_at (uint8_t x, uint8_t y, uint8_t number) |
{ |
lcd_xpos = x; |
lcd_ypos = y; |
lcd_write_number_u (number); |
} |
//----------------------------------------------------------- |
// Write only some digits of a unsigned <number> at <x>/<y> to MAX7456 display memory |
// <num> represents the largest multiple of 10 that will still be displayable as |
// the first digit, so num = 10 will be 0-99 and so on |
// <pad> = 1 will cause blank spaced to be filled up with zeros e.g. 007 instead of 7 |
// |
void write_ndigit_number_u (uint8_t x, uint8_t y, uint16_t number, int16_t length, uint8_t pad, uint8_t mode) |
{ |
char s[7]; |
utoa(number, s, 10 ); |
uint8_t len = strlen(s); |
if (length < len) |
{ |
for (uint8_t i = 0; i < length; i++) |
{ |
lcd_putc (x++, y, '*', mode); |
} |
return; |
} |
for (uint8_t i = 0; i < length - len; i++) |
{ |
if (pad==1) |
{ |
lcd_putc (x++, y, '0', mode); |
} |
else |
{ |
lcd_putc (x++, y, ' ', mode); |
} |
} |
lcd_print_at(x, y, (uint8_t*)s, mode); |
} |
//----------------------------------------------------------- |
// Write only some digits of a signed <number> at <x>/<y> to MAX7456 display memory |
// <num> represents the largest multiple of 10 that will still be displayable as |
// the first digit, so num = 10 will be 0-99 and so on |
// <pad> = 1 will cause blank spaced to be filled up with zeros e.g. 007 instead of 7 |
// |
void write_ndigit_number_s (uint8_t x, uint8_t y, int16_t number, int16_t length, uint8_t pad, uint8_t mode) |
{ |
char s[7]; |
itoa(number, s, 10 ); |
uint8_t len = strlen(s); |
if (length < len) |
{ |
for (uint8_t i = 0; i < length; i++) |
{ |
lcd_putc (x++, y, '*', mode); |
} |
return; |
} |
for (uint8_t i = 0; i < length - len; i++) |
{ |
if (pad) |
{ |
lcd_putc (x++, y, '0', mode); |
} |
else |
{ |
lcd_putc (x++, y, ' ', mode); |
} |
} |
lcd_print_at(x, y, (uint8_t*)s, mode); |
} |
//----------------------------------------------------------- |
// Write only some digits of a unsigned <number> at <x>/<y> to MAX7456 display memory |
// as /10th of the value |
// <num> represents the largest multiple of 10 that will still be displayable as |
// the first digit, so num = 10 will be 0-99 and so on |
// <pad> = 1 will cause blank spaced to be filled up with zeros e.g. 007 instead of 7 |
// |
void write_ndigit_number_u_10th (uint8_t x, uint8_t y, uint16_t number, int16_t length, uint8_t pad, uint8_t mode) |
{ |
char s[7]; |
itoa(number, s, 10 ); |
uint8_t len = strlen(s); |
if (length < len) |
{ |
for (uint8_t i = 0; i < length; i++) |
{ |
lcd_putc (x++, y, '*', mode); |
} |
return; |
} |
for (uint8_t i = 0; i < length - len; i++) |
{ |
if (pad) |
{ |
lcd_putc (x++, y, '0', mode); |
} |
else |
{ |
lcd_putc (x++, y, ' ', mode); |
} |
} |
char rest = s[len - 1]; |
s[len - 1] = 0; |
if (len == 1) |
{ |
lcd_putc (x-1, y, '0', mode); |
} |
else if (len == 2 && s[0] == '-') |
{ |
lcd_putc (x-1, y, '-', mode); |
lcd_putc (x, y, '0', mode); |
} |
else |
{ |
lcd_print_at(x, y, (uint8_t*)s, mode); |
} |
x += len - 1; |
lcd_putc (x++, y, '.', mode); |
lcd_putc (x++, y, rest, mode); |
} |
//----------------------------------------------------------- |
void write_ndigit_number_u_100th (uint8_t x, uint8_t y, uint16_t number, int16_t length, uint8_t pad) |
{ |
uint8_t num = 100; |
while (num > 0) |
{ |
uint8_t b = number / num; |
if ((num / 10) == 1) |
{ |
lcd_putc (x++, y, '.', 0); |
} |
lcd_putc (x++, y, '0' + b, 0); |
number -= b * num; |
num /= 10; |
} |
} |
//----------------------------------------------------------- |
// Write only some digits of a signed <number> at <x>/<y> to MAX7456 display memory |
// as /10th of the value |
// <num> represents the largest multiple of 10 that will still be displayable as |
// the first digit, so num = 10 will be 0-99 and so on |
// <pad> = 1 will cause blank spaced to be filled up with zeros e.g. 007 instead of 7 |
// |
void write_ndigit_number_s_10th (uint8_t x, uint8_t y, int16_t number, int16_t length, uint8_t pad, uint8_t mode) |
{ |
char s[7]; |
itoa (number, s, 10 ); |
uint8_t len = strlen(s); |
if (length < len) |
{ |
for (uint8_t i = 0; i < length; i++) |
{ |
lcd_putc (x++, y, '*', mode); |
} |
return; |
} |
for (uint8_t i = 0; i < length - len; i++) |
{ |
if (pad) |
{ |
lcd_putc (x++, y, '0', mode); |
} |
else |
{ |
lcd_putc (x++, y, ' ', mode); |
} |
} |
char rest = s[len - 1]; |
s[len - 1] = 0; |
if (len == 1) |
{ |
lcd_putc (x-1, y, '0', mode); |
} |
else if (len == 2 && s[0] == '-') |
{ |
lcd_putc (x-1, y, '-', mode); |
lcd_putc (x, y, '0', mode); |
} |
else |
{ |
lcd_print_at(x, y, (uint8_t*)s, mode); |
} |
x += len - 1; |
lcd_putc (x++, y, '.', mode); |
lcd_putc (x++, y, rest, mode); |
} |
//----------------------------------------------------------- |
// write <seconds> as human readable time at <x>/<y> to MAX7456 display mem |
// |
void write_time (uint8_t x, uint8_t y, uint16_t seconds) |
{ |
uint16_t min = seconds / 60; |
seconds -= min * 60; |
write_ndigit_number_u (x, y, min, 2, 0,0); |
lcd_putc (x + 2, y, ':', 0); |
write_ndigit_number_u (x + 3, y, seconds, 2, 1,0); |
} |
//----------------------------------------------------------- |
// wirte a <position> at <x>/<y> assuming it is a gps position for long-/latitude |
// |
void write_gps_pos (uint8_t x, uint8_t y, int32_t position) |
{ |
if (position < 0) |
{ |
position ^= ~0; |
position++; |
lcd_putc (x++, y, '-', 0); |
} |
else |
{ |
lcd_putc (x++, y, ' ', 0); |
} |
write_ndigit_number_u (x, y, (uint16_t) (position / (int32_t) 10000000), 3, 1,0); |
lcd_putc (x + 3, y, '.', 0); |
position = position - ((position / (int32_t) 10000000) * (int32_t) 10000000); |
write_ndigit_number_u (x + 4, y, (uint16_t) (position / (int32_t) 1000), 4, 1,0); |
position = position - ((uint16_t) (position / (int32_t) 1000) * (int32_t) 1000); |
write_ndigit_number_u (x + 8, y, (uint16_t) position, 3, 1,0); |
lcd_putc (x + 11, y, 0x1e, 0); // degree symbol |
} |
//------------------------------------------------------------------------------------ |
// Show PKT Baudrate at given position |
// |
void show_baudrate (uint8_t x, uint8_t y, uint8_t Baudrate, uint8_t mode) |
{ |
switch (Baudrate) |
{ |
case Baud_2400: lcd_printp_at (x, y, PSTR("2400"), mode);break; |
case Baud_4800: lcd_printp_at (x, y, PSTR("4800"), mode);break; |
case Baud_9600: lcd_printp_at (x, y, PSTR("9600"), mode);break; |
case Baud_19200: lcd_printp_at (x, y, PSTR("19200"), mode);break; |
case Baud_38400: lcd_printp_at (x, y, PSTR("38400"), mode);break; |
case Baud_57600: lcd_printp_at (x, y, PSTR("57600"), mode);break; |
case Baud_115200: lcd_printp_at (x, y, PSTR("115200"), mode);break; |
break; |
} |
} |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/lcd/lcd/lcd.h |
---|
0,0 → 1,282 |
/***************************************************************************** |
* Copyright (C) 2009 Peter "woggle" Mack, mac@denich.net * |
* - original LCD control by Thomas "thkais" Kaiser * |
* - special number formating routines taken from C-OSD * |
* from Claas Anders "CaScAdE" Rathje * |
* - some extension, ellipse and circ_line by Peter "woggle" Mack * |
* Thanks to Oliver Schwaneberg for adding several functions to this library!* |
* * |
* Author: Jan Michel (jan at mueschelsoft dot de) * |
* License: GNU General Public License, version 3 * |
* Version: v0.93 September 2010 * |
* * |
* This program is free software; you can redistribute it and/or modify * |
* it under the terms of the GNU General Public License as published by * |
* the Free Software Foundation; either version 2 of the License. * |
* * |
* This program is distributed in the hope that it will be useful, * |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
* GNU General Public License for more details. * |
* * |
* You should have received a copy of the GNU General Public License * |
* along with this program; if not, write to the * |
* Free Software Foundation, Inc., * |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
* * |
*****************************************************************************/ |
#ifndef _LCD_H |
#define _LCD_H |
/* |
//----------------------------------------------------------------------------- |
// Command Codes |
//----------------------------------------------------------------------------- |
//1: Display on/off |
#define LCD_DISPLAY_ON 0xAF //switch display on |
#define LCD_DISPLAY_OFF 0xAE //switch display off |
//2: display start line set (lower 6 bits select first line on lcd from 64 lines in memory) |
#define LCD_START_LINE 0x40 |
//3: Page address set (lower 4 bits select one of 8 pages) |
#define LCD_PAGE_ADDRESS 0xB0 |
//4: column address (lower 4 bits are upper / lower nibble of column address) |
#define LCD_COL_ADDRESS_MSB 0x10 |
#define LCD_COL_ADDRESS_LSB 0x00 //second part of column address |
//8: select orientation (black side of the display should be further away from viewer) |
#define LCD_BOTTOMVIEW 0xA1 //6 o'clock view |
#define LCD_TOPVIEW 0xA0 //12 o'clock view |
//9: select normal (white background, black pixels) or reverse (black background, white pixels) mode |
#define LCD_DISPLAY_POSITIVE 0xA6 //not inverted mode |
#define LCD_DISPLAY_INVERTED 0xA7 //inverted display |
//10: show memory content or switch all pixels on |
#define LCD_SHOW_NORMAL 0xA4 //show dram content |
#define LCD_SHOW_ALL_POINTS 0xA5 //show all points |
//11: lcd bias set |
#define LCD_BIAS_1_9 0xA2 |
#define LCD_BIAS_1_7 0xA3 |
//14: Reset Controller |
#define LCD_RESET_CMD 0xE2 |
//15: output mode select (turns display upside-down) |
#define LCD_SCAN_DIR_NORMAL 0xC0 //normal scan direction |
#define LCD_SCAN_DIR_REVERSE 0xC8 //reversed scan direction |
//16: power control set (lower 3 bits select operating mode) |
//Bit 0: Voltage follower on/off - Bit 1: Voltage regulator on/off - Bit 2: Booster circuit on/off |
#define LCD_POWER_CONTROL 0x28 //base command |
#define LCD_POWER_LOW_POWER 0x2F |
#define LCD_POWER_WIDE_RANGE 0x2F |
#define LCD_POWER_LOW_VOLTAGE 0x2B |
//17: voltage regulator resistor ratio set (lower 3 bits select ratio) |
//selects lcd voltage - 000 is low (~ -2V), 111 is high (~ - 10V), also depending on volume mode. Datasheet suggests 011 |
#define LCD_VOLTAGE 0x20 |
//18: Volume mode set (2-byte command, lower 6 bits in second word select value, datasheet suggests 0x1F) |
#define LCD_VOLUME_MODE_1 0x81 |
#define LCD_VOLUME_MODE_2 0x00 |
//#if DISPLAY_TYPE == 128 || DISPLAY_TYPE == 132 |
//19: static indicator (2-byte command), first on/off, then blinking mode |
#define LCD_INDICATOR_ON 0xAD //static indicator on |
#define LCD_INDICATOR_OFF 0xAC //static indicator off |
#define LCD_INDICATOR_MODE_OFF 0x00 |
#define LCD_INDICATOR_MODE_1HZ 0x01 |
#define LCD_INDICATOR_MODE_2HZ 0x10 |
#define LCD_INDICATOR_MODE_ON 0x11 |
//20: booster ratio set (2-byte command) |
#define LCD_BOOSTER_SET 0xF8 //set booster ratio |
#define LCD_BOOSTER_234 0x00 //2x-4x |
#define LCD_BOOSTER_5 0x01 //5x |
#define LCD_BOOSTER_6 0x03 //6x |
//#endif |
//22: NOP command |
#define LCD_NOP 0xE3 |
//#if DISPLAY_TYPE == 102 |
////25: advanced program control |
//#define LCD_ADV_PROG_CTRL 0xFA |
//#define LCD_ADV_PROG_CTRL2 0x10 |
//#endif |
//----------------------------------------------------------------------------- |
// Makros to execute commands |
//----------------------------------------------------------------------------- |
#define LCD_SWITCH_ON() lcd_command(LCD_DISPLAY_ON) |
#define LCD_SWITCH_OFF() lcd_command(LCD_DISPLAY_OFF) |
#define LCD_SET_FIRST_LINE(i) lcd_command(LCD_START_LINE | ((i) & 0x3F)) |
#define LCD_SET_PAGE_ADDR(i) lcd_command(LCD_PAGE_ADDRESS | ((i) & 0x0F)) |
#define LCD_SET_COLUMN_ADDR(i) lcd_command(LCD_COL_ADDRESS_MSB | ((i>>4) & 0x0F)); \ |
lcd_command(LCD_COL_ADDRESS_LSB | ((i) & 0x0F)) |
#define LCD_GOTO_ADDRESS(page,col); lcd_command(LCD_PAGE_ADDRESS | ((page) & 0x0F)); \ |
lcd_command(LCD_COL_ADDRESS_MSB | ((col>>4) & 0x0F)); \ |
lcd_command(LCD_COL_ADDRESS_LSB | ((col) & 0x0F)); |
#define LCD_SET_BOTTOM_VIEW() lcd_command(LCD_BOTTOMVIEW) |
#define LCD_SET_TOP_VIEW() lcd_command(LCD_TOPVIEW) |
#define LCD_SET_MODE_POSITIVE() lcd_command(LCD_DISPLAY_POSITIVE) |
#define LCD_SET_MODE_INVERTED() lcd_command(LCD_DISPLAY_INVERTED) |
#define LCD_SHOW_ALL_PIXELS_ON() lcd_command(LCD_SHOW_ALL_POINTS) |
#define LCD_SHOW_ALL_PIXELS_OFF() lcd_command(LCD_SHOW_NORMAL) |
#define LCD_SET_BIAS_RATIO_1_7() lcd_command(LCD_BIAS_1_7) |
#define LCD_SET_BIAS_RATIO_1_9() lcd_command(LCD_BIAS_1_9) |
#define LCD_SEND_RESET() lcd_command(LCD_RESET_CMD) |
#define LCD_ORIENTATION_NORMAL() lcd_command(LCD_SCAN_DIR_NORMAL) |
#define LCD_ORIENTATION_UPSIDEDOWN() lcd_command(LCD_SCAN_DIR_REVERSE) |
#define LCD_SET_POWER_CONTROL(i) lcd_command(LCD_POWER_CONTROL | ((i) & 0x07)) |
#define LCD_SET_LOW_POWER() lcd_command(LCD_POWER_LOW_POWER) |
#define LCD_SET_WIDE_RANGE() lcd_command(LCD_POWER_WIDE_RANGE) |
#define LCD_SET_LOW_VOLTAGE() lcd_command(LCD_POWER_LOW_VOLTAGE) |
#define LCD_SET_BIAS_VOLTAGE(i) lcd_command(LCD_VOLTAGE | ((i) & 0x07)) |
#define LCD_SET_VOLUME_MODE(i) lcd_command(LCD_VOLUME_MODE_1); \ |
lcd_command(LCD_VOLUME_MODE_2 | ((i) & 0x3F)) |
//#if DISPLAY_TYPE == 128 || DISPLAY_TYPE == 132 |
#define LCD_SET_INDICATOR_OFF() lcd_command(LCD_INDICATOR_OFF); \ |
lcd_command(LCD_INDICATOR_MODE_OFF) |
#define LCD_SET_INDICATOR_STATIC() lcd_command(LCD_INDICATOR_ON); \ |
lcd_command(LCD_INDICATOR_MODE_ON) |
#define LCD_SET_INDICATOR_1HZ() lcd_command(LCD_INDICATOR_ON); \ |
lcd_command(LCD_INDICATOR_MODE_1HZ) |
#define LCD_SET_INDICATOR_2HZ() lcd_command(LCD_INDICATOR_ON); \ |
lcd_command(LCD_INDICATOR_MODE_2HZ) |
#define LCD_SET_INDICATOR(i,j) lcd_command(LCD_INDICATOR_OFF | ((i) & 1)); \ |
lcd_command(((j) & 2)) |
#define LCD_SLEEP_MODE lcd_command(LCD_INDICATOR_OFF); \ |
lcd_command(LCD_DISPLAY_OFF); \ |
lcd_command(LCD_SHOW_ALL_POINTS) |
//#endif |
//#if DISPLAY_TYPE == 102 |
//#define LCD_TEMPCOMP_HIGH 0x80 |
//#define LCD_COLWRAP 0x02 |
//#define LCD_PAGEWRAP 0x01 |
//#define LCD_SET_ADV_PROG_CTRL(i) lcd_command(LCD_ADV_PROG_CTRL); |
// lcd_command(LCD_ADV_PROG_CTRL2 & i) |
//#endif |
*/ |
extern volatile uint8_t LCD_ORIENTATION; |
//#define LCD_LINES 8 |
//#define LCD_COLS 21 |
extern uint8_t lcd_xpos; |
extern uint8_t lcd_ypos; |
void lcd_command(uint8_t cmd); |
void send_byte (uint8_t data); |
void LCD_Init (uint8_t LCD_Mode); |
void new_line (void); |
void lcd_puts_at(uint8_t x, uint8_t y,const char *s, uint8_t mode ); |
void lcd_putc (uint8_t x, uint8_t y, uint8_t c, uint8_t mode); |
void send_byte (uint8_t data); |
void lcd_print (uint8_t *text, uint8_t mode); |
void lcd_print_at (uint8_t x, uint8_t y, uint8_t *text, uint8_t mode); |
void lcd_printp (const char *text, uint8_t mode); |
void lcd_printp_at (uint8_t x, uint8_t y, const char *text, uint8_t mode); |
void lcd_printpns (const char *text, uint8_t mode); |
void lcd_printpns_at (uint8_t x, uint8_t y, const char *text, uint8_t mode); |
void lcd_cls (void); |
void lcd_cls_line (uint8_t x, uint8_t y, uint8_t w); |
void print_display (uint8_t *text); |
void print_display_at (uint8_t x, uint8_t y, uint8_t *text); |
void copy_line (uint8_t y); |
void paste_line (uint8_t y); |
// Jeti |
void lcd_putc_jeti (uint8_t x, uint8_t y, uint8_t c, uint8_t mode); |
void lcd_printpj (const char *text, uint8_t mode); |
void lcd_printpj_at (uint8_t x, uint8_t y, const char *text, uint8_t mode); |
void lcd_plot (uint8_t x, uint8_t y, uint8_t mode); |
void lcd_line (unsigned char x1, unsigned char y1, unsigned char x2, unsigned char y2, uint8_t mode); |
void lcd_rect (uint8_t x1, uint8_t y1, uint8_t widthx, uint8_t widthy, uint8_t mode); |
void lcd_frect (uint8_t x1, uint8_t y1, uint8_t widthx, uint8_t widthy, uint8_t mode); |
void lcd_circle (int16_t x0, int16_t y0, int16_t radius, uint8_t mode); |
void lcd_fcircle (int16_t x0, int16_t y0, int16_t radius, uint8_t mode); |
void lcd_circ_line (uint8_t x, uint8_t y, uint8_t r, uint16_t deg, uint8_t mode); |
void lcd_ellipse (int16_t x0, int16_t y0, int16_t rx, int16_t ry, uint8_t mode); |
void lcd_ellipse_line (uint8_t x, uint8_t y, uint8_t rx, uint8_t ry, uint16_t deg, uint8_t mode); |
void lcd_ecircle (int16_t x0, int16_t y0, int16_t radius, uint8_t mode); |
void lcd_ecirc_line (uint8_t x, uint8_t y, uint8_t r, uint16_t deg, uint8_t mode); |
void lcd_view_font (uint8_t page); |
void lcd_print_hex_at (uint8_t x, uint8_t y, uint8_t h, uint8_t mode); |
void lcd_write_number_u (uint8_t number); |
void lcd_write_number_u_at (uint8_t x, uint8_t y, uint8_t number); |
void lcd_print_hex (uint8_t h, uint8_t mode); |
/** |
* Write only some digits of a unsigned <number> at <x>/<y> |
* <length> represents the length to rightbound the number |
* <pad> = 1 will cause blank spaced to be filled up with zeros e.g. 007 instead of 7 |
*/ |
void write_ndigit_number_u (uint8_t x, uint8_t y, uint16_t number, int16_t length, uint8_t pad,uint8_t mode); |
/** |
* Write only some digits of a signed <number> at <x>/<y> |
* <length> represents the length to rightbound the number |
* <pad> = 1 will cause blank spaced to be filled up with zeros e.g. 007 instead of 7 |
*/ |
void write_ndigit_number_s (uint8_t x, uint8_t y, int16_t number, int16_t length, uint8_t pad, uint8_t mode); |
/** |
* Write only some digits of a unsigned <number> at <x>/<y> as /10th of the value |
* <length> represents the length to rightbound the number |
* <pad> = 1 will cause blank spaced to be filled up with zeros e.g. 00.7 instead of .7 |
*/ |
void write_ndigit_number_u_10th (uint8_t x, uint8_t y, uint16_t number, int16_t length, uint8_t pad, uint8_t mode); |
/** |
* Write only some digits of a unsigned <number> at <x>/<y> as /100th of the value |
* <length> represents the length to rightbound the number |
* <pad> = 1 will cause blank spaced to be filled up with zeros e.g. 00.7 instead of .7 |
*/ |
void write_ndigit_number_u_100th (uint8_t x, uint8_t y, uint16_t number, int16_t length, uint8_t pad); |
/** |
* Write only some digits of a signed <number> at <x>/<y> as /10th of the value |
* <length> represents the length to rightbound the number |
* <pad> = 1 will cause blank spaced to be filled up with zeros e.g. 00.7 instead of .7 |
*/ |
void write_ndigit_number_s_10th (uint8_t x, uint8_t y, int16_t number, int16_t length, uint8_t pad, uint8_t mode); |
/** |
* write <seconds> as human readable time at <x>/<y> |
*/ |
void write_time (uint8_t x, uint8_t y, uint16_t seconds); |
/** |
* wirte a <position> at <x>/<y> assuming it is a gps position for long-/latitude |
*/ |
void write_gps_pos (uint8_t x, uint8_t y, int32_t position); |
//------------------------------------------------------------------------------------ |
// Show PKT Baudrate at given position |
// |
void show_baudrate (uint8_t x, uint8_t y, uint8_t Baudrate, uint8_t mode); |
#endif |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/lcd/lcd.c |
---|
0,0 → 1,1453 |
/***************************************************************************** |
* Copyright (C) 2009 Peter "woggle" Mack, mac@denich.net * |
* - original LCD control by Thomas "thkais" Kaiser * |
* - special number formating routines taken from C-OSD * |
* from Claas Anders "CaScAdE" Rathje * |
* - some extension, ellipse and circ_line by Peter "woggle" Mack * |
* * |
* This program is free software; you can redistribute it and/or modify * |
* it under the terms of the GNU General Public License as published by * |
* the Free Software Foundation; either version 2 of the License. * |
* * |
* This program is distributed in the hope that it will be useful, * |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
* GNU General Public License for more details. * |
* * |
* You should have received a copy of the GNU General Public License * |
* along with this program; if not, write to the * |
* Free Software Foundation, Inc., * |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
* * |
*****************************************************************************/ |
//############################################################################ |
//# HISTORY lcd.c |
//# |
//# 07.03.2013 OG |
//# - del: Kompatibilitaetsfunktion lcd_printpj_at() entfernt |
//# |
//# 06.03.2013 OG |
//# - lcdx_putc() wurde erweitert mit Unterstuetzung des 8x8 Font (alte Jeti |
//# Funktionen) und Pixel-Verschiebung (xoffs,yoffs) |
//# - etliche Char basierte Funktionen wurden erweitert um Parameter xoffs,yoffs |
//# um die Ausgabe um +/- Pixel zu verschieben. Fuer Pixelgenaue Positionierung |
//# von OSD-Screen Elementen. |
//# Die neuen Funktionen mit Pixel-Verschiebung beginnen mit lcdx_, writex_ ... |
//# - add: Kompatibilitaet gewaehrleistet durch Mapper-Funktionen |
//# - add: defines fuer Char-Drawmode's (MNORMAL, MINVERS, MBIG, MBIGINVERS) |
//# - del: Jeti-Funktionen (teilweise ersetzt durch Kompatibilitaetsfunktionen) |
//############################################################################ |
#include "../cpu.h" |
#include <avr/io.h> |
#include <avr/pgmspace.h> |
#include <util/delay.h> |
#include <stdlib.h> |
#include <string.h> |
#include <math.h> |
#include "font8x6.h" |
#include "Font8x8.h" |
#include "../eeprom/eeprom.h" |
#include "lcd.h" |
#include "../main.h" |
#include "../HAL_HW3_9.h" |
#define DISP_W 128 |
#define DISP_H 64 |
#define DISP_BUFFER ((DISP_H * DISP_W) / 8) |
#define LINE_BUFFER (((DISP_H/8) * DISP_W) / 8) |
#define Jeti 1 // Jeti Routinen |
volatile uint8_t display_buffer[DISP_BUFFER]; // Display-Puffer, weil nicht zurückgelesen werden kann |
volatile uint8_t line_buffer[LINE_BUFFER]; // Zeilen-Puffer, weil nicht zurückgelesen werden kann |
volatile uint16_t display_buffer_pointer; // Pointer auf das aktuell übertragene Byte |
volatile uint8_t display_buffer_counter; // Hilfszähler zur Selektierung der Page |
volatile uint8_t display_page_counter; // aktuelle Page-Nummer |
volatile uint8_t display_mode; // Modus für State-Machine |
volatile uint8_t LCD_ORIENTATION; |
// DOG: 128 x 64 with 6x8 Font => 21 x 8 |
// MAX7456: 30 x 16 |
uint8_t lcd_xpos; |
uint8_t lcd_ypos; |
char s[7]; |
//----------------------------------------------------------- |
void send_byte (uint8_t data) |
{ |
clr_cs (); |
SPDR = data; |
while (!(SPSR & (1<<SPIF))); |
//SPSR = SPSR; |
set_cs (); |
} |
//----------------------------------------------------------- |
// * Writes one command byte |
// * cmd - the command byte |
// |
void lcd_command(uint8_t cmd) |
{ |
// LCD_SELECT(); |
// LCD_CMD(); |
// spi_write(cmd); |
// LCD_UNSELECT(); |
clr_cs (); |
SPDR = cmd; |
while (!(SPSR & (1<<SPIF))); |
//SPSR = SPSR; |
set_cs (); |
} |
//----------------------------------------------------------- |
void lcd_cls (void) |
{ |
uint16_t i, j; |
// memset (display_buffer, 0, 1024); |
for (i = 0; i < DISP_BUFFER; i++) |
display_buffer[i] = 0x00; |
for (i = 0; i < 8; i++) |
{ |
clr_A0 (); |
send_byte (0xB0 + i); //1011xxxx |
send_byte (0x10); //00010000 |
// send_byte(0x04); //00000100 gedreht plus 4 Byte |
// send_byte(0x00); //00000000 |
send_byte (LCD_ORIENTATION); //00000000 |
set_A0 (); |
for (j = 0; j < 128; j++) |
send_byte (0x00); |
} |
lcd_xpos = 0; |
lcd_ypos = 0; |
} |
//----------------------------------------------------------- |
void set_adress (uint16_t adress, uint8_t data) |
{ |
uint8_t page; |
uint8_t column; |
page = adress >> 7; |
clr_A0 (); |
send_byte (0xB0 + page); |
column = (adress & 0x7F) + LCD_ORIENTATION; |
send_byte (0x10 + (column >> 4)); |
send_byte (column & 0x0F); |
set_A0 (); |
send_byte (data); |
} |
//----------------------------------------------------------- |
void scroll (void) |
{ |
uint16_t adress; |
for (adress = 0; adress < 896; adress++) |
{ |
display_buffer[adress] = display_buffer[adress + 128]; |
set_adress (adress, display_buffer[adress]); |
} |
for (adress = 896; adress < 1024; adress++) |
{ |
display_buffer[adress] = 0; |
set_adress (adress, 0); |
} |
} |
//#################################################################################### |
//#################################################################################### |
//----------------------------------------------------------- |
// + Plot (set one Pixel) |
//----------------------------------------------------------- |
// mode: |
// 0=Clear, 1=Set, 2=XOR |
void lcd_plot (uint8_t xpos, uint8_t ypos, uint8_t mode) |
{ |
uint16_t adress; |
uint8_t mask; |
if ((xpos < DISP_W) && (ypos < DISP_H)) |
{ |
adress = (ypos / 8) * DISP_W + xpos; // adress = 0/8 * 128 + 0 = 0 |
mask = 1 << (ypos & 0x07); // mask = 1<<0 = 1 |
adress &= DISP_BUFFER - 1; |
switch (mode) |
{ |
case 0: |
display_buffer[adress] &= ~mask; |
break; |
case 1: |
display_buffer[adress] |= mask; |
break; |
case 2: |
display_buffer[adress] ^= mask; |
break; |
} |
set_adress (adress, display_buffer[adress]); |
} |
} |
//----------------------------------------------------------- |
//----------------------------------------------------------- |
void lcdx_putc( uint8_t x, uint8_t y, uint8_t c, uint8_t mode, int8_t xoffs, int8_t yoffs ) |
{ |
uint8_t ch; |
uint16_t adress; |
uint8_t x1,y1; |
uint8_t x0,y0; |
uint8_t xw; |
uint8_t mask; |
uint8_t bit; |
uint8_t *font; |
//------------------------ |
// char translate |
//------------------------ |
switch (c) |
{ // ISO 8859-1 |
case 0xc4: c = 0x01; break; // Ä |
case 0xe4: c = 0x02; break; // ä |
case 0xd6: c = 0x03; break; // Ö |
case 0xf6: c = 0x04; break; // ö |
case 0xdc: c = 0x05; break; // Ü |
case 0xfc: c = 0x06; break; // ü |
case 0xdf: c = 0x1e; break; // ß c = 0x07; ° (used by Jeti) |
} |
c &= 0x7f; |
//------------------------ |
// Font Parameter setzen |
//------------------------ |
if( mode <=2 ) // normaler font (8x6) |
{ |
font = (uint8_t *) &font8x6[0][0]; |
xw = 6; |
} |
else // grosser font (8x8) |
{ |
font = (uint8_t *) &Font8x8[0][0]; |
xw = 8; |
} |
//------------------------ |
//------------------------ |
x0 = (x*xw) + xoffs; |
y0 = (y*8) + yoffs; |
if( yoffs == 0) |
{ |
//---------------------------------------------------------- |
// orginaler Character Algo |
// |
// funktioniert auch mit x Verschiebung aber nicht |
// mit y Verschiebung. |
// |
// Da 8 Bit aufeinmal gesetzt werden ist dieser Algo |
// bzgl. Geschwindigkeit effektiver als der Y-Algo. |
//---------------------------------------------------------- |
if( mode==MINVERS || mode==MBIGINVERS ) |
lcd_frect( (x*xw)+xoffs, (y*8), xw-1, 7, 1); // invertierte Darstellung |
adress = y * 128 + x * xw + xoffs; |
adress &= 0x3FF; |
for( x1 = 0; x1 < xw; x1++) |
{ |
ch = pgm_read_byte (font + x1 + c * xw); |
if( mode==MINVERS || mode==MBIGINVERS ) |
display_buffer[adress + x1] ^= ch; |
else |
display_buffer[adress + x1] = ch; |
set_adress (adress + x1, display_buffer[adress + x1]); |
} |
} |
else |
{ |
//---------------------------------------------------------- |
// Y-Algo |
// neuer Character Algo (nur wenn Pixel y-Verschiebung) |
//---------------------------------------------------------- |
for( x1 = 0; x1 < xw; x1++ ) |
{ |
ch = pgm_read_byte (font + x1 + c * xw); |
mask = 1; |
for( y1 = 0; y1 < 8; y1++ ) |
{ |
bit = (ch & mask); |
if( bit ) |
lcd_plot( x0+x1, y0+y1, ( (mode==MINVERS || mode==MBIGINVERS) ? 0 : 1) ); |
else |
lcd_plot( x0+x1, y0+y1, ( (mode==MINVERS || mode==MBIGINVERS) ? 1 : 0) ); |
mask = (mask << 1); |
} |
} |
} |
} |
//----------------------------------------------------------- |
//--- Kompatibilitaet |
//----------------------------------------------------------- |
void lcd_putc( uint8_t x, uint8_t y, uint8_t c, uint8_t mode ) |
{ |
lcdx_putc( x, y, c, mode, 0,0 ); |
} |
//#################################################################################### |
//#################################################################################### |
//----------------------------------------------------------- |
void lcd_cls_line (uint8_t x, uint8_t y, uint8_t w) |
{ |
uint8_t lcd_width; |
uint8_t lcd_zpos; |
uint8_t i; |
uint8_t max = 21; |
lcd_width = w; |
lcd_xpos = x; |
lcd_ypos = y; |
if ((lcd_xpos + lcd_width) > max) |
lcd_width = max - lcd_xpos; |
lcd_zpos = lcd_xpos + lcd_width; |
for (i = lcd_xpos; i < lcd_zpos; i++) |
lcd_putc (i, lcd_ypos, 0x20, 0); |
} |
//----------------------------------------------------------- |
void wait_1ms (void) |
{ |
_delay_ms (1); |
} |
//----------------------------------------------------------- |
void wait_ms (uint16_t time) |
{ |
uint16_t i; |
for (i = 0; i < time; i++) |
wait_1ms (); |
} |
//----------------------------------------------------------- |
void LCD_Init (uint8_t LCD_Mode) // LCD_Mode 0= Default Mode 1= EEPROM-Parameter) |
{ |
lcd_xpos = 0; |
lcd_ypos = 0; |
// DDRB = 0xFF; |
// SPI max. speed |
// the DOGM128 lcd controller can work at 20 MHz |
SPCR = (1 << SPE) | (1 << MSTR) | (1 << CPHA) | (1 << CPOL); |
SPSR = (1 << SPI2X); |
set_cs (); |
clr_reset (); |
wait_ms (10); |
set_reset (); |
clr_cs (); |
clr_A0 (); |
send_byte (0x40); //Display start line = 0 |
if (LCD_Mode == 1) |
{ |
if (LCD_ORIENTATION == 0) |
{ |
send_byte (0xA1); // A1 normal A0 reverse(original) |
send_byte (0xC0); // C0 normal C8 reverse(original) |
} |
else |
{ |
send_byte (0xA0); // A1 normal A0 reverse(original) |
send_byte (0xC8); // C0 normal C8 reverse(original) |
} |
} |
else |
{ |
send_byte (0xA1); // A1 normal A0 reverse(original) |
send_byte (0xC0); // C0 normal C8 reverse(original) |
} |
if (LCD_Mode == 1) |
{ |
if (Config.LCD_DisplayMode == 0) |
send_byte (0xA6); //Display normal, not mirrored |
else |
send_byte (0xA7); //Display reverse, not mirrored |
} |
else |
send_byte (0xA6); |
send_byte (0xA2); //Set bias 1/9 (Duty 1/65) |
send_byte (0x2F); //Booster, regulator and follower on |
send_byte (0xF8); //Set internal booster to 4x |
send_byte (0x00); //Set internal booster to 4x |
send_byte (0x27); //resistor ratio set |
if (LCD_Mode == 1) |
{ |
send_byte (0x81); //Electronic volume register set |
send_byte (Config.LCD_Kontrast); //Electronic volume register set |
} |
else |
{ |
send_byte (0x81); |
send_byte (0x16); |
} |
send_byte (0xAC); //Cursor |
send_byte (0x00); //No Cursor |
send_byte (0xAF); //No indicator |
if (Config.HWSound==0) |
{ |
if (LCD_Mode == 1) |
{ |
// Helligkeit setzen |
OCR2A = Config.LCD_Helligkeit * 2.55; |
} |
else |
{ |
OCR2A = 255; |
} |
} |
lcd_cls (); |
} |
//----------------------------------------------------------- |
// sicher eine Zeile für die Statusanzeige |
void copy_line (uint8_t y) |
{ |
uint8_t i; |
uint16_t adress; |
adress = y * 128 + 0 * 6; |
adress &= 0x3FF; |
for (i = 0; i < 6*21; i++) |
{ |
line_buffer[i] = display_buffer[adress+i]; |
set_adress (adress + i, display_buffer[adress + i]); |
} |
} |
//----------------------------------------------------------- |
// holt gesicherte Zeile wieder zurück |
void paste_line (uint8_t y) |
{ |
uint8_t i; |
uint16_t adress; |
adress = y * 128 + 0 * 6; |
adress &= 0x3FF; |
for (i = 0; i < 6*21; i++) |
{ |
display_buffer[adress+i] =line_buffer[i]; |
set_adress (adress + i, display_buffer[adress + i]); |
} |
} |
//----------------------------------------------------------- |
//----------------------------------------------------------- |
void lcdx_puts_at( uint8_t x, uint8_t y, const char *s, uint8_t mode, int8_t xoffs, int8_t yoffs) |
{ |
while (*s) |
{ |
lcdx_putc(x, y, *s++, mode, xoffs,yoffs); |
x++; |
} |
}/* lcd_puts */ |
//----------------------------------------------------------- |
//----------------------------------------------------------- |
void lcd_puts_at( uint8_t x, uint8_t y, const char *s, uint8_t mode ) |
{ |
lcdx_puts_at( x, y, s, mode, 0,0 ); |
} |
//----------------------------------------------------------- |
void new_line (void) |
{ |
lcd_ypos++; |
if (lcd_ypos > 7) |
{ |
scroll (); |
lcd_ypos = 7; |
} |
} |
//----------------------------------------------------------- |
void lcd_printpns (const char *text, uint8_t mode) |
{ |
while (pgm_read_byte(text)) |
{ |
switch (pgm_read_byte(text)) |
{ |
case 0x0D: |
lcd_xpos = 0; |
break; |
case 0x0A: |
new_line(); |
break; |
default: |
lcd_putc (lcd_xpos, lcd_ypos, pgm_read_byte(text), mode); |
lcd_xpos++; |
if (lcd_xpos > 21) |
{ |
lcd_xpos = 0; |
// new_line (); |
} |
break; |
} |
text++; |
} |
} |
//----------------------------------------------------------- |
void lcd_printpns_at (uint8_t x, uint8_t y, const char *text, uint8_t mode) |
{ |
lcd_xpos = x; |
lcd_ypos = y; |
lcd_printpns (text, mode); |
} |
//----------------------------------------------------------- |
//----------------------------------------------------------- |
void lcdx_printp (const char *text, uint8_t mode, int8_t xoffs, int8_t yoffs) |
{ |
while( pgm_read_byte(text) ) |
{ |
switch (pgm_read_byte(text)) |
{ |
case 0x0D: |
lcd_xpos = 0; |
break; |
case 0x0A: |
new_line(); |
break; |
default: |
lcdx_putc (lcd_xpos, lcd_ypos, pgm_read_byte(text), mode, xoffs,yoffs); |
lcd_xpos++; |
if (lcd_xpos > 21) |
{ |
lcd_xpos = 0; |
new_line (); |
} |
break; |
} |
text++; |
} |
} |
//----------------------------------------------------------- |
//----------------------------------------------------------- |
void lcd_printp (const char *text, uint8_t mode) |
{ |
lcdx_printp ( text, mode, 0,0); |
} |
//----------------------------------------------------------- |
//----------------------------------------------------------- |
void lcdx_printp_at (uint8_t x, uint8_t y, const char *text, uint8_t mode, int8_t xoffs, int8_t yoffs) |
{ |
lcd_xpos = x; |
lcd_ypos = y; |
lcdx_printp (text, mode, xoffs,yoffs); |
} |
//----------------------------------------------------------- |
//----------------------------------------------------------- |
void lcd_printp_at (uint8_t x, uint8_t y, const char *text, uint8_t mode) |
{ |
lcdx_printp_at ( x, y, text, mode, 0,0); |
} |
//----------------------------------------------------------- |
void lcdx_print (uint8_t *text, uint8_t mode, int8_t xoffs, int8_t yoffs) |
{ |
while (*text) |
{ |
switch (*text) |
{ |
case 0x0D: |
lcd_xpos = 0; |
break; |
case 0x0A: |
new_line(); |
break; |
default: |
lcdx_putc (lcd_xpos, lcd_ypos, *text, mode, xoffs,yoffs); |
lcd_xpos++; |
if (lcd_xpos > 21) |
{ |
lcd_xpos = 0; |
new_line (); |
} |
break; |
} |
text++; |
} |
} |
//----------------------------------------------------------- |
//--- lcd_print: Kompatibilitaet |
//----------------------------------------------------------- |
void lcd_print (uint8_t *text, uint8_t mode ) |
{ |
lcdx_print (text, mode, 0,0 ); |
} |
//----------------------------------------------------------- |
void lcdx_print_at (uint8_t x, uint8_t y, uint8_t *text, uint8_t mode, int8_t xoffs, int8_t yoffs) |
{ |
lcd_xpos = x; |
lcd_ypos = y; |
lcdx_print (text, mode, xoffs, yoffs); |
} |
//----------------------------------------------------------- |
//--- lcd_print_at: Kompatibilitaet |
//----------------------------------------------------------- |
void lcd_print_at (uint8_t x, uint8_t y, uint8_t *text, uint8_t mode ) |
{ |
lcdx_print_at ( x, y, text, mode, 0,0); |
} |
//----------------------------------------------------------- |
void print_display (uint8_t *text) |
{ |
while (*text) |
{ |
lcd_putc (lcd_xpos, lcd_ypos, *text, 0); |
lcd_xpos++; |
if (lcd_xpos >= 20) |
{ |
lcd_xpos = 0; |
new_line (); |
} |
text++; |
} |
} |
//----------------------------------------------------------- |
void print_display_at (uint8_t x, uint8_t y, uint8_t *text) |
{ |
lcd_xpos = x; |
lcd_ypos = y; |
print_display (text); |
} |
//----------------------------------------------------------- |
// + Line (draws a line from x1,y1 to x2,y2 |
// + Based on Bresenham line-Algorithm |
// + found in the internet, modified by thkais 2007 |
//----------------------------------------------------------- |
void lcd_line (unsigned char x1, unsigned char y1, unsigned char x2, unsigned char y2, uint8_t mode) |
{ |
int x, y, count, xs, ys, xm, ym; |
x = (int) x1; |
y = (int) y1; |
xs = (int) x2 - (int) x1; |
ys = (int) y2 - (int) y1; |
if (xs < 0) |
xm = -1; |
else |
if (xs > 0) |
xm = 1; |
else |
xm = 0; |
if (ys < 0) |
ym = -1; |
else |
if (ys > 0) |
ym = 1; |
else |
ym = 0; |
if (xs < 0) |
xs = -xs; |
if (ys < 0) |
ys = -ys; |
lcd_plot ((unsigned char) x, (unsigned char) y, mode); |
if (xs > ys) // Flat Line <45 degrees |
{ |
count = -(xs / 2); |
while (x != x2) |
{ |
count = count + ys; |
x = x + xm; |
if (count > 0) |
{ |
y = y + ym; |
count = count - xs; |
} |
lcd_plot ((unsigned char) x, (unsigned char) y, mode); |
} |
} |
else // Line >=45 degrees |
{ |
count =- (ys / 2); |
while (y != y2) |
{ |
count = count + xs; |
y = y + ym; |
if (count > 0) |
{ |
x = x + xm; |
count = count - ys; |
} |
lcd_plot ((unsigned char) x, (unsigned char) y, mode); |
} |
} |
} |
//----------------------------------------------------------- |
// + Filled rectangle |
// + x1, y1 = upper left corner |
//----------------------------------------------------------- |
void lcd_frect (uint8_t x1, uint8_t y1, uint8_t widthx, uint8_t widthy, uint8_t mode) |
{ |
uint16_t x2, y2; |
uint16_t i; |
if (x1 >= DISP_W) |
x1 = DISP_W - 1; |
if (y1 >= DISP_H) |
y1 = DISP_H - 1; |
x2 = x1 + widthx; |
y2 = y1 + widthy; |
if (x2 > DISP_W) |
x2 = DISP_W; |
if (y2 > DISP_H) |
y2 = DISP_H; |
for (i = y1; i <= y2; i++) |
{ |
lcd_line (x1, i, x2, i, mode); |
} |
} |
//----------------------------------------------------------- |
// + outline of rectangle |
// + x1, y1 = upper left corner |
//----------------------------------------------------------- |
void lcd_rect (uint8_t x1, uint8_t y1, uint8_t widthx, uint8_t widthy, uint8_t mode) |
{ |
uint16_t x2, y2; |
if (x1 >= DISP_W) |
x1 = DISP_W - 1; |
if (y1 >= DISP_H) |
y1 = DISP_H - 1; |
x2 = x1 + widthx; |
y2 = y1 + widthy; |
if (x2 > DISP_W) |
x2 = DISP_W; |
if (y2 > DISP_H) |
y2 = DISP_H; |
lcd_line (x1, y1, x2, y1, mode); |
lcd_line (x2, y1, x2, y2, mode); |
lcd_line (x2, y2, x1, y2, mode); |
lcd_line (x1, y2, x1, y1, mode); |
} |
//----------------------------------------------------------- |
// + outline of a circle |
// + Based on Bresenham-algorithm found in wikipedia |
// + modified by thkais (2007) |
//----------------------------------------------------------- |
void lcd_circle (int16_t x0, int16_t y0, int16_t radius, uint8_t mode) |
{ |
int16_t f = 1 - radius; |
int16_t ddF_x = 0; |
int16_t ddF_y = -2 * radius; |
int16_t x = 0; |
int16_t y = radius; |
lcd_plot (x0, y0 + radius, mode); |
lcd_plot (x0, y0 - radius, mode); |
lcd_plot (x0 + radius, y0, mode); |
lcd_plot (x0 - radius, y0, mode); |
while (x < y) |
{ |
if (f >= 0) |
{ |
y --; |
ddF_y += 2; |
f += ddF_y; |
} |
x ++; |
ddF_x += 2; |
f += ddF_x + 1; |
lcd_plot (x0 + x, y0 + y, mode); |
lcd_plot (x0 - x, y0 + y, mode); |
lcd_plot (x0 + x, y0 - y, mode); |
lcd_plot (x0 - x, y0 - y, mode); |
lcd_plot (x0 + y, y0 + x, mode); |
lcd_plot (x0 - y, y0 + x, mode); |
lcd_plot (x0 + y, y0 - x, mode); |
lcd_plot (x0 - y, y0 - x, mode); |
} |
} |
//----------------------------------------------------------- |
// + filled Circle |
// + modified circle-algorithm thkais (2007) |
//----------------------------------------------------------- |
void lcd_fcircle (int16_t x0, int16_t y0, int16_t radius,uint8_t mode) |
{ |
int16_t f = 1 - radius; |
int16_t ddF_x = 0; |
int16_t ddF_y = -2 * radius; |
int16_t x = 0; |
int16_t y = radius; |
lcd_line (x0, y0 + radius, x0, y0 - radius, mode); |
lcd_line (x0 + radius, y0, x0 - radius, y0, mode); |
while (x < y) |
{ |
if (f >= 0) |
{ |
y--; |
ddF_y += 2; |
f += ddF_y; |
} |
x++; |
ddF_x += 2; |
f += ddF_x + 1; |
lcd_line (x0 + x, y0 + y, x0 - x, y0 + y, mode); |
lcd_line (x0 + x, y0 - y, x0 - x, y0 - y, mode); |
lcd_line (x0 + y, y0 + x, x0 - y, y0 + x, mode); |
lcd_line (x0 + y, y0 - x, x0 - y, y0 - x, mode); |
} |
} |
//----------------------------------------------------------- |
// |
void lcd_circ_line (uint8_t x, uint8_t y, uint8_t r, uint16_t deg, uint8_t mode) |
{ |
uint8_t xc, yc; |
double deg_rad; |
deg_rad = (deg * M_PI) / 180.0; |
yc = y - (uint8_t) round (cos (deg_rad) * (double) r); |
xc = x + (uint8_t) round (sin (deg_rad) * (double) r); |
lcd_line (x, y, xc, yc, mode); |
} |
//----------------------------------------------------------- |
// |
void lcd_ellipse_line (uint8_t x, uint8_t y, uint8_t rx, uint8_t ry, uint16_t deg, uint8_t mode) |
{ |
uint8_t xc, yc; |
double deg_rad; |
deg_rad = (deg * M_PI) / 180.0; |
yc = y - (uint8_t) round (cos (deg_rad) * (double) ry); |
xc = x + (uint8_t) round (sin (deg_rad) * (double) rx); |
lcd_line (x, y, xc, yc, mode); |
} |
//----------------------------------------------------------- |
// |
void lcd_ellipse (int16_t x0, int16_t y0, int16_t rx, int16_t ry, uint8_t mode) |
{ |
const int16_t rx2 = rx * rx; |
const int16_t ry2 = ry * ry; |
int16_t F = round (ry2 - rx2 * ry + 0.25 * rx2); |
int16_t ddF_x = 0; |
int16_t ddF_y = 2 * rx2 * ry; |
int16_t x = 0; |
int16_t y = ry; |
lcd_plot (x0, y0 + ry, mode); |
lcd_plot (x0, y0 - ry, mode); |
lcd_plot (x0 + rx, y0, mode); |
lcd_plot (x0 - rx, y0, mode); |
// while ( 2*ry2*x < 2*rx2*y ) { we can use ddF_x and ddF_y |
while (ddF_x < ddF_y) |
{ |
if(F >= 0) |
{ |
y -= 1; // south |
ddF_y -= 2 * rx2; |
F -= ddF_y; |
} |
x += 1; // east |
ddF_x += 2 * ry2; |
F += ddF_x + ry2; |
lcd_plot (x0 + x, y0 + y, mode); |
lcd_plot (x0 + x, y0 - y, mode); |
lcd_plot (x0 - x, y0 + y, mode); |
lcd_plot (x0 - x, y0 - y, mode); |
} |
F = round (ry2 * (x + 0.5) * (x + 0.5) + rx2 * (y - 1) * (y - 1) - rx2 * ry2); |
while(y > 0) |
{ |
if(F <= 0) |
{ |
x += 1; // east |
ddF_x += 2 * ry2; |
F += ddF_x; |
} |
y -= 1; // south |
ddF_y -= 2 * rx2; |
F += rx2 - ddF_y; |
lcd_plot (x0 + x, y0 + y, mode); |
lcd_plot (x0 + x, y0 - y, mode); |
lcd_plot (x0 - x, y0 + y, mode); |
lcd_plot (x0 - x, y0 - y, mode); |
} |
} |
//----------------------------------------------------------- |
// |
void lcd_ecircle (int16_t x0, int16_t y0, int16_t radius, uint8_t mode) |
{ |
lcd_ellipse (x0, y0, radius + 3, radius, mode); |
} |
//----------------------------------------------------------- |
// |
void lcd_ecirc_line (uint8_t x, uint8_t y, uint8_t r, uint16_t deg, uint8_t mode) |
{ |
lcd_ellipse_line(x, y, r + 3, r, deg, mode); |
} |
//----------------------------------------------------------- |
// |
void lcd_view_font (uint8_t page) |
{ |
int x; |
int y; |
lcd_cls (); |
lcd_printp (PSTR(" 0123456789ABCDEF\r\n"), 0); |
lcd_printpns_at (0, 7, PSTR(" \x1a \x1b Exit"), 0); |
lcd_ypos = 2; |
for (y = page * 4 ; y < (page * 4 + 4); y++) |
{ |
if (y < 10) |
{ |
lcd_putc (0, lcd_ypos, '0' + y, 0); |
} |
else |
{ |
lcd_putc (0, lcd_ypos, 'A' + y - 10, 0); |
} |
lcd_xpos = 2; |
for (x = 0; x < 16; x++) |
{ |
lcd_putc (lcd_xpos, lcd_ypos, y * 16 + x, 0); |
lcd_xpos++; |
} |
lcd_ypos++; |
} |
} |
//----------------------------------------------------------- |
uint8_t hdigit (uint8_t d) |
{ |
if (d < 10) |
{ |
return '0' + d; |
} |
else |
{ |
return 'A' + d - 10; |
} |
} |
//----------------------------------------------------------- |
void lcd_print_hex_at (uint8_t x, uint8_t y, uint8_t h, uint8_t mode) |
{ |
lcd_xpos = x; |
lcd_ypos = y; |
lcd_putc (lcd_xpos++, lcd_ypos, hdigit (h >> 4), mode); |
lcd_putc (lcd_xpos, lcd_ypos, hdigit (h & 0x0f), mode); |
} |
//----------------------------------------------------------- |
void lcd_print_hex (uint8_t h, uint8_t mode) |
{ |
// lcd_xpos = x; |
// lcd_ypos = y; |
lcd_putc (lcd_xpos++, lcd_ypos, hdigit (h >> 4), mode); |
lcd_putc (lcd_xpos++, lcd_ypos, hdigit (h & 0x0f), mode); |
lcd_putc (lcd_xpos++, lcd_ypos, ' ', mode); |
} |
//----------------------------------------------------------- |
void lcd_write_number_u (uint8_t number) |
{ |
uint8_t num = 100; |
uint8_t started = 0; |
while (num > 0) |
{ |
uint8_t b = number / num; |
if (b > 0 || started || num == 1) |
{ |
lcd_putc (lcd_xpos++, lcd_ypos, '0' + b, 0); |
started = 1; |
} |
number -= b * num; |
num /= 10; |
} |
} |
//----------------------------------------------------------- |
void lcd_write_number_u_at (uint8_t x, uint8_t y, uint8_t number) |
{ |
lcd_xpos = x; |
lcd_ypos = y; |
lcd_write_number_u (number); |
} |
//----------------------------------------------------------- |
// Write only some digits of a unsigned <number> at <x>/<y> to MAX7456 display memory |
// <num> represents the largest multiple of 10 that will still be displayable as |
// the first digit, so num = 10 will be 0-99 and so on |
// <pad> = 1 will cause blank spaced to be filled up with zeros e.g. 007 instead of 7 |
// |
void writex_ndigit_number_u (uint8_t x, uint8_t y, uint16_t number, int16_t length, uint8_t pad, uint8_t mode, int8_t xoffs, int8_t yoffs) |
{ |
//char s[7]; |
utoa(number, s, 10 ); |
uint8_t len = strlen(s); |
if (length < len) |
{ |
for (uint8_t i = 0; i < length; i++) |
{ |
lcdx_putc (x++, y, '*', mode, xoffs,yoffs); |
} |
return; |
} |
for (uint8_t i = 0; i < length - len; i++) |
{ |
if (pad==1) |
{ |
lcdx_putc (x++, y, '0', mode, xoffs,yoffs); |
} |
else |
{ |
lcdx_putc (x++, y, ' ', mode, xoffs,yoffs); |
} |
} |
lcdx_print_at(x, y, (uint8_t*)s, mode, xoffs,yoffs); |
} |
//----------------------------------------------------------- |
//----------------------------------------------------------- |
void write_ndigit_number_u (uint8_t x, uint8_t y, uint16_t number, int16_t length, uint8_t pad, uint8_t mode) |
{ |
writex_ndigit_number_u( x, y, number, length, pad, mode, 0,0); |
} |
//----------------------------------------------------------- |
// Write only some digits of a signed <number> at <x>/<y> to MAX7456 display memory |
// <num> represents the largest multiple of 10 that will still be displayable as |
// the first digit, so num = 10 will be 0-99 and so on |
// <pad> = 1 will cause blank spaced to be filled up with zeros e.g. 007 instead of 7 |
// |
void writex_ndigit_number_s (uint8_t x, uint8_t y, int16_t number, int16_t length, uint8_t pad, uint8_t mode, int8_t xoffs, int8_t yoffs) |
{ |
//char s[7]; |
itoa(number, s, 10 ); |
uint8_t len = strlen(s); |
if (length < len) |
{ |
for (uint8_t i = 0; i < length; i++) |
{ |
lcdx_putc (x++, y, '*', mode, xoffs,yoffs); |
} |
return; |
} |
for (uint8_t i = 0; i < length - len; i++) |
{ |
if (pad) |
{ |
lcdx_putc (x++, y, '0', mode, xoffs,yoffs); |
} |
else |
{ |
lcdx_putc (x++, y, ' ', mode, xoffs,yoffs); |
} |
} |
lcdx_print_at(x, y, (uint8_t*)s, mode, xoffs,yoffs); |
} |
//----------------------------------------------------------- |
//----------------------------------------------------------- |
void write_ndigit_number_s (uint8_t x, uint8_t y, int16_t number, int16_t length, uint8_t pad, uint8_t mode) |
{ |
writex_ndigit_number_s (x, y, number, length, pad, mode, 0,0); |
} |
//----------------------------------------------------------- |
// Write only some digits of a unsigned <number> at <x>/<y> to MAX7456 display memory |
// as /10th of the value |
// <num> represents the largest multiple of 10 that will still be displayable as |
// the first digit, so num = 10 will be 0-99 and so on |
// <pad> = 1 will cause blank spaced to be filled up with zeros e.g. 007 instead of 7 |
// |
void writex_ndigit_number_u_10th (uint8_t x, uint8_t y, uint16_t number, int16_t length, uint8_t pad, uint8_t mode, int8_t xoffs, int8_t yoffs) |
{ |
//char s[7]; |
itoa(number, s, 10 ); |
uint8_t len = strlen(s); |
if (length < len) |
{ |
for (uint8_t i = 0; i < length; i++) |
{ |
lcdx_putc (x++, y, '*', mode, xoffs,yoffs); |
} |
return; |
} |
for (uint8_t i = 0; i < length - len; i++) |
{ |
if (pad) |
{ |
lcdx_putc (x++, y, '0', mode, xoffs,yoffs); |
} |
else |
{ |
lcdx_putc (x++, y, ' ', mode, xoffs,yoffs); |
} |
} |
char rest = s[len - 1]; |
s[len - 1] = 0; |
if (len == 1) |
{ |
lcdx_putc (x-1, y, '0', mode, xoffs,yoffs); |
} |
else if (len == 2 && s[0] == '-') |
{ |
lcdx_putc (x-1, y, '-', mode, xoffs,yoffs); |
lcdx_putc (x, y, '0', mode, xoffs,yoffs); |
} |
else |
{ |
lcdx_print_at(x, y, (uint8_t*)s, mode, xoffs,yoffs); |
} |
x += len - 1; |
lcdx_putc (x++, y, '.', mode, xoffs,yoffs); |
lcdx_putc (x++, y, rest, mode, xoffs,yoffs); |
} |
//----------------------------------------------------------- |
//----------------------------------------------------------- |
void write_ndigit_number_u_10th (uint8_t x, uint8_t y, uint16_t number, int16_t length, uint8_t pad, uint8_t mode) |
{ |
writex_ndigit_number_u_10th ( x, y, number, length, pad, mode, 0,0); |
} |
//----------------------------------------------------------- |
//----------------------------------------------------------- |
void writex_ndigit_number_u_100th (uint8_t x, uint8_t y, uint16_t number, int16_t length, uint8_t pad, int8_t xoffs, int8_t yoffs) |
{ |
uint8_t num = 100; |
while (num > 0) |
{ |
uint8_t b = number / num; |
if ((num / 10) == 1) |
{ |
lcdx_putc (x++, y, '.', 0, xoffs,yoffs); |
} |
lcdx_putc (x++, y, '0' + b, 0, xoffs,yoffs); |
number -= b * num; |
num /= 10; |
} |
} |
//----------------------------------------------------------- |
//----------------------------------------------------------- |
void write_ndigit_number_u_100th (uint8_t x, uint8_t y, uint16_t number, int16_t length, uint8_t pad) |
{ |
writex_ndigit_number_u_100th ( x, y, number, length, pad, 0,0); |
} |
//----------------------------------------------------------- |
// Write only some digits of a signed <number> at <x>/<y> to MAX7456 display memory |
// as /10th of the value |
// <num> represents the largest multiple of 10 that will still be displayable as |
// the first digit, so num = 10 will be 0-99 and so on |
// <pad> = 1 will cause blank spaced to be filled up with zeros e.g. 007 instead of 7 |
// |
void writex_ndigit_number_s_10th (uint8_t x, uint8_t y, int16_t number, int16_t length, uint8_t pad, uint8_t mode, int8_t xoffs, int8_t yoffs) |
{ |
//char s[7]; |
itoa (number, s, 10 ); |
uint8_t len = strlen(s); |
if (length < len) |
{ |
for (uint8_t i = 0; i < length; i++) |
{ |
lcdx_putc (x++, y, '*', mode, xoffs, yoffs); |
} |
return; |
} |
for (uint8_t i = 0; i < length - len; i++) |
{ |
if (pad) |
{ |
lcdx_putc (x++, y, '0', mode, xoffs, yoffs); |
} |
else |
{ |
lcdx_putc (x++, y, ' ', mode, xoffs, yoffs); |
} |
} |
char rest = s[len - 1]; |
s[len - 1] = 0; |
if (len == 1) |
{ |
lcdx_putc (x-1, y, '0', mode, xoffs, yoffs); |
} |
else if (len == 2 && s[0] == '-') |
{ |
lcdx_putc (x-1, y, '-', mode, xoffs,yoffs); |
lcdx_putc (x, y, '0', mode, xoffs,yoffs); |
} |
else |
{ |
lcdx_print_at(x, y, (uint8_t*)s, mode, xoffs, yoffs); |
} |
x += len - 1; |
lcdx_putc (x++, y, '.', mode, xoffs, yoffs); |
lcdx_putc (x++, y, rest, mode, xoffs, yoffs); |
} |
//----------------------------------------------------------- |
//----------------------------------------------------------- |
void write_ndigit_number_s_10th (uint8_t x, uint8_t y, int16_t number, int16_t length, uint8_t pad, uint8_t mode) |
{ |
writex_ndigit_number_s_10th ( x, y, number, length, pad, mode, 0,0); |
} |
//----------------------------------------------------------- |
// write <seconds> as human readable time at <x>/<y> to MAX7456 display mem |
// |
void writex_time (uint8_t x, uint8_t y, uint16_t seconds, uint8_t mode, int8_t xoffs, int8_t yoffs) |
{ |
uint16_t min = seconds / 60; |
seconds -= min * 60; |
writex_ndigit_number_u (x, y, min, 2, 0,mode, xoffs,yoffs); |
lcd_putc (x + 2, y, ':', 0); |
writex_ndigit_number_u (x + 3, y, seconds, 2, 1,mode, xoffs,yoffs); |
} |
//----------------------------------------------------------- |
//----------------------------------------------------------- |
void write_time (uint8_t x, uint8_t y, uint16_t seconds) |
{ |
writex_time ( x, y, seconds, 0, 0,0); |
} |
//----------------------------------------------------------- |
// wirte a <position> at <x>/<y> assuming it is a gps position for long-/latitude |
// |
void write_gps_pos (uint8_t x, uint8_t y, int32_t position) |
{ |
if (position < 0) |
{ |
position ^= ~0; |
position++; |
lcd_putc (x++, y, '-', 0); |
} |
else |
{ |
lcd_putc (x++, y, ' ', 0); |
} |
write_ndigit_number_u (x, y, (uint16_t) (position / (int32_t) 10000000), 3, 1,0); |
lcd_putc (x + 3, y, '.', 0); |
position = position - ((position / (int32_t) 10000000) * (int32_t) 10000000); |
write_ndigit_number_u (x + 4, y, (uint16_t) (position / (int32_t) 1000), 4, 1,0); |
position = position - ((uint16_t) (position / (int32_t) 1000) * (int32_t) 1000); |
write_ndigit_number_u (x + 8, y, (uint16_t) position, 3, 1,0); |
lcd_putc (x + 11, y, 0x1e, 0); // degree symbol |
} |
//------------------------------------------------------------------------------------ |
// Show PKT Baudrate at given position |
// |
void show_baudrate (uint8_t x, uint8_t y, uint8_t Baudrate, uint8_t mode) |
{ |
switch (Baudrate) |
{ |
case Baud_2400: lcd_printp_at (x, y, PSTR("2400"), mode);break; |
case Baud_4800: lcd_printp_at (x, y, PSTR("4800"), mode);break; |
case Baud_9600: lcd_printp_at (x, y, PSTR("9600"), mode);break; |
case Baud_19200: lcd_printp_at (x, y, PSTR("19200"), mode);break; |
case Baud_38400: lcd_printp_at (x, y, PSTR("38400"), mode);break; |
case Baud_57600: lcd_printp_at (x, y, PSTR("57600"), mode);break; |
case Baud_115200: lcd_printp_at (x, y, PSTR("115200"), mode);break; |
break; |
} |
} |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/lcd/lcd.cold |
---|
0,0 → 1,1402 |
/***************************************************************************** |
* Copyright (C) 2009 Peter "woggle" Mack, mac@denich.net * |
* - original LCD control by Thomas "thkais" Kaiser * |
* - special number formating routines taken from C-OSD * |
* from Claas Anders "CaScAdE" Rathje * |
* - some extension, ellipse and circ_line by Peter "woggle" Mack * |
* * |
* This program is free software; you can redistribute it and/or modify * |
* it under the terms of the GNU General Public License as published by * |
* the Free Software Foundation; either version 2 of the License. * |
* * |
* This program is distributed in the hope that it will be useful, * |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
* GNU General Public License for more details. * |
* * |
* You should have received a copy of the GNU General Public License * |
* along with this program; if not, write to the * |
* Free Software Foundation, Inc., * |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
* * |
*****************************************************************************/ |
#include "../cpu.h" |
#include <avr/io.h> |
#include <avr/pgmspace.h> |
#include <util/delay.h> |
#include <stdlib.h> |
#include <string.h> |
#include <math.h> |
#include "font8x6.h" |
#include "Font8x8.h" |
#include "../eeprom/eeprom.h" |
#include "lcd.h" |
#include "../main.h" |
#include "../HAL_HW3_9.h" |
#define DISP_W 128 |
#define DISP_H 64 |
#define DISP_BUFFER ((DISP_H * DISP_W) / 8) |
#define LINE_BUFFER (((DISP_H/8) * DISP_W) / 8) |
#define Jeti 1 // Jeti Routinen |
volatile uint8_t display_buffer[DISP_BUFFER]; // Display-Puffer, weil nicht zurückgelesen werden kann |
volatile uint8_t line_buffer[LINE_BUFFER]; // Zeilen-Puffer, weil nicht zurückgelesen werden kann |
volatile uint16_t display_buffer_pointer; // Pointer auf das aktuell übertragene Byte |
volatile uint8_t display_buffer_counter; // Hilfszähler zur Selektierung der Page |
volatile uint8_t display_page_counter; // aktuelle Page-Nummer |
volatile uint8_t display_mode; // Modus für State-Machine |
volatile uint8_t LCD_ORIENTATION; |
// DOG: 128 x 64 with 6x8 Font => 21 x 8 |
// MAX7456: 30 x 16 |
uint8_t lcd_xpos; |
uint8_t lcd_ypos; |
//----------------------------------------------------------- |
void send_byte (uint8_t data) |
{ |
clr_cs (); |
SPDR = data; |
while (!(SPSR & (1<<SPIF))); |
//SPSR = SPSR; |
set_cs (); |
} |
//----------------------------------------------------------- |
// * Writes one command byte |
// * cmd - the command byte |
// |
void lcd_command(uint8_t cmd) |
{ |
// LCD_SELECT(); |
// LCD_CMD(); |
// spi_write(cmd); |
// LCD_UNSELECT(); |
clr_cs (); |
SPDR = cmd; |
while (!(SPSR & (1<<SPIF))); |
//SPSR = SPSR; |
set_cs (); |
} |
//----------------------------------------------------------- |
void lcd_cls (void) |
{ |
uint16_t i, j; |
// memset (display_buffer, 0, 1024); |
for (i = 0; i < DISP_BUFFER; i++) |
display_buffer[i] = 0x00; |
for (i = 0; i < 8; i++) |
{ |
clr_A0 (); |
send_byte (0xB0 + i); //1011xxxx |
send_byte (0x10); //00010000 |
// send_byte(0x04); //00000100 gedreht plus 4 Byte |
// send_byte(0x00); //00000000 |
send_byte (LCD_ORIENTATION); //00000000 |
set_A0 (); |
for (j = 0; j < 128; j++) |
send_byte (0x00); |
} |
lcd_xpos = 0; |
lcd_ypos = 0; |
} |
//----------------------------------------------------------- |
void lcd_cls_line (uint8_t x, uint8_t y, uint8_t w) |
{ |
uint8_t lcd_width; |
uint8_t lcd_zpos; |
uint8_t i; |
uint8_t max = 21; |
lcd_width = w; |
lcd_xpos = x; |
lcd_ypos = y; |
if ((lcd_xpos + lcd_width) > max) |
lcd_width = max - lcd_xpos; |
lcd_zpos = lcd_xpos + lcd_width; |
for (i = lcd_xpos; i < lcd_zpos; i++) |
lcd_putc (i, lcd_ypos, 0x20, 0); |
} |
//----------------------------------------------------------- |
void wait_1ms (void) |
{ |
_delay_ms (1); |
} |
//----------------------------------------------------------- |
void wait_ms (uint16_t time) |
{ |
uint16_t i; |
for (i = 0; i < time; i++) |
wait_1ms (); |
} |
//----------------------------------------------------------- |
void LCD_Init (uint8_t LCD_Mode) // LCD_Mode 0= Default Mode 1= EEPROM-Parameter) |
{ |
lcd_xpos = 0; |
lcd_ypos = 0; |
// DDRB = 0xFF; |
// SPI max. speed |
// the DOGM128 lcd controller can work at 20 MHz |
SPCR = (1 << SPE) | (1 << MSTR) | (1 << CPHA) | (1 << CPOL); |
SPSR = (1 << SPI2X); |
set_cs (); |
clr_reset (); |
wait_ms (10); |
set_reset (); |
clr_cs (); |
clr_A0 (); |
send_byte (0x40); //Display start line = 0 |
if (LCD_Mode == 1) |
{ |
if (LCD_ORIENTATION == 0) |
{ |
send_byte (0xA1); // A1 normal A0 reverse(original) |
send_byte (0xC0); // C0 normal C8 reverse(original) |
} |
else |
{ |
send_byte (0xA0); // A1 normal A0 reverse(original) |
send_byte (0xC8); // C0 normal C8 reverse(original) |
} |
} |
else |
{ |
send_byte (0xA1); // A1 normal A0 reverse(original) |
send_byte (0xC0); // C0 normal C8 reverse(original) |
} |
if (LCD_Mode == 1) |
{ |
if (Config.LCD_DisplayMode == 0) |
send_byte (0xA6); //Display normal, not mirrored |
else |
send_byte (0xA7); //Display reverse, not mirrored |
} |
else |
send_byte (0xA6); |
send_byte (0xA2); //Set bias 1/9 (Duty 1/65) |
send_byte (0x2F); //Booster, regulator and follower on |
send_byte (0xF8); //Set internal booster to 4x |
send_byte (0x00); //Set internal booster to 4x |
send_byte (0x27); //resistor ratio set |
if (LCD_Mode == 1) |
{ |
send_byte (0x81); //Electronic volume register set |
send_byte (Config.LCD_Kontrast); //Electronic volume register set |
} |
else |
{ |
send_byte (0x81); |
send_byte (0x16); |
} |
send_byte (0xAC); //Cursor |
send_byte (0x00); //No Cursor |
send_byte (0xAF); //No indicator |
if (Config.HWSound==0) |
{ |
if (LCD_Mode == 1) |
{ |
// Helligkeit setzen |
OCR2A = Config.LCD_Helligkeit * 2.55; |
} |
else |
{ |
OCR2A = 255; |
} |
} |
lcd_cls (); |
} |
//----------------------------------------------------------- |
void set_adress (uint16_t adress, uint8_t data) |
{ |
uint8_t page; |
uint8_t column; |
page = adress >> 7; |
clr_A0 (); |
send_byte (0xB0 + page); |
column = (adress & 0x7F) + LCD_ORIENTATION; |
send_byte (0x10 + (column >> 4)); |
send_byte (column & 0x0F); |
set_A0 (); |
send_byte (data); |
} |
//----------------------------------------------------------- |
void scroll (void) |
{ |
uint16_t adress; |
for (adress = 0; adress < 896; adress++) |
{ |
display_buffer[adress] = display_buffer[adress + 128]; |
set_adress (adress, display_buffer[adress]); |
} |
for (adress = 896; adress < 1024; adress++) |
{ |
display_buffer[adress] = 0; |
set_adress (adress, 0); |
} |
} |
//----------------------------------------------------------- |
// sicher eine Zeile für die Statusanzeige |
void copy_line (uint8_t y) |
{ |
uint8_t i; |
uint16_t adress; |
adress = y * 128 + 0 * 6; |
adress &= 0x3FF; |
for (i = 0; i < 6*21; i++) |
{ |
line_buffer[i] = display_buffer[adress+i]; |
set_adress (adress + i, display_buffer[adress + i]); |
} |
} |
//----------------------------------------------------------- |
// holt gesicherte Zeile wieder zurück |
void paste_line (uint8_t y) |
{ |
uint8_t i; |
uint16_t adress; |
adress = y * 128 + 0 * 6; |
adress &= 0x3FF; |
for (i = 0; i < 6*21; i++) |
{ |
display_buffer[adress+i] =line_buffer[i]; |
set_adress (adress + i, display_buffer[adress + i]); |
} |
} |
//----------------------------------------------------------- |
void lcd_puts_at(uint8_t x, uint8_t y,const char *s, uint8_t mode ) |
{ |
while (*s) |
{ |
lcd_putc(x, y, *s++, mode); |
x++; |
} |
}/* lcd_puts */ |
//----------------------------------------------------------- |
void lcd_putc (uint8_t x, uint8_t y, uint8_t c, uint8_t mode) |
{ |
uint8_t ch; |
uint8_t i; |
uint16_t adress; |
if (mode == 2) |
lcd_frect ((x*6),(y*8),5,7,1); // invertierte Darstellung |
if (mode == 3) lcd_putc_jeti (x, y, c,0); |
else |
if (mode == 4) lcd_putc_jeti (x, y, c,2); |
else |
{ |
switch (c) |
{ // ISO 8859-1 |
case 0xc4: // Ä |
c = 0x01; |
break; |
case 0xe4: // ä |
c = 0x02; |
break; |
case 0xd6: // Ö |
c = 0x03; |
break; |
case 0xf6: // ö |
c = 0x04; |
break; |
case 0xdc: // Ü |
c = 0x05; |
break; |
case 0xfc: // ü |
c = 0x06; |
break; |
case 0xdf: // ß |
//c = 0x07; |
c = 0x1e; // ° (used by Jeti) |
break; |
} |
c &= 0x7f; |
adress = y * 128 + x * 6; |
adress &= 0x3FF; |
for (i = 0; i < 6; i++) |
{ |
ch = pgm_read_byte (&font8x6[0][0] + i + c * 6); |
switch (mode) |
{ |
case 0: |
display_buffer[adress+i] = ch; |
break; |
case 1: |
display_buffer[adress+i] |= ch; |
break; |
case 2: |
display_buffer[adress+i] ^= ch; |
break; |
case 3: |
display_buffer[adress+i] &= ch; |
break; |
case 4: |
display_buffer[adress+i] &= ~ch; |
break; |
} |
set_adress (adress + i, display_buffer[adress + i]); |
} |
} |
} |
#if Jeti |
//----------------------------------------------------------- |
void lcd_putc_jeti (uint8_t x, uint8_t y, uint8_t c, uint8_t mode) |
{ |
uint8_t ch; |
uint8_t i; |
uint16_t adress; |
if (mode == 2) |
lcd_frect ((x*8),(y*8),8,8,1); // invertierte Darstellung |
switch (c) |
{ |
case 0x7e: |
c = 0x1a; // -> |
break; |
case 0x7f: |
c = 0x1b; // <- |
break; |
case 0xdf: |
c = 0xf8; // ° |
break; |
} |
adress = y * 128 + x * 8; |
adress &= 0x3FF; |
for (i = 0; i < 8; i++) |
{ |
ch = pgm_read_byte (&Font8x8[0][0] + i + c * 8); |
switch (mode) |
{ |
case 0: |
display_buffer[adress+i] = ch; |
break; |
case 1: |
display_buffer[adress+i] |= ch; |
break; |
case 2: |
display_buffer[adress+i] ^= ch; |
break; |
case 3: |
display_buffer[adress+i] &= ch; |
break; |
case 4: |
display_buffer[adress+i] &= ~ch; |
break; |
} |
set_adress (adress + i, display_buffer[adress + i]); |
} |
} |
//----------------------------------------------------------- |
void lcd_printpj (const char *text, uint8_t mode) |
{ |
while (pgm_read_byte(text)) |
{ |
switch (pgm_read_byte(text)) |
{ |
case 0x0D: |
lcd_xpos = 0; |
break; |
case 0x0A: |
new_line(); |
break; |
default: |
lcd_putc_jeti (lcd_xpos, lcd_ypos, pgm_read_byte(text), mode); |
lcd_xpos++; |
if (lcd_xpos > 20) |
{ |
lcd_xpos = 0; |
new_line (); |
} |
break; |
} |
text++; |
} |
} |
//----------------------------------------------------------- |
void lcd_printpj_at (uint8_t x, uint8_t y, const char *text, uint8_t mode) |
{ |
lcd_xpos = x; |
lcd_ypos = y; |
lcd_printpj (text, mode); |
} |
#endif |
//----------------------------------------------------------- |
void new_line (void) |
{ |
lcd_ypos++; |
if (lcd_ypos > 7) |
{ |
scroll (); |
lcd_ypos = 7; |
} |
} |
//----------------------------------------------------------- |
void lcd_printpns (const char *text, uint8_t mode) |
{ |
while (pgm_read_byte(text)) |
{ |
switch (pgm_read_byte(text)) |
{ |
case 0x0D: |
lcd_xpos = 0; |
break; |
case 0x0A: |
new_line(); |
break; |
default: |
lcd_putc (lcd_xpos, lcd_ypos, pgm_read_byte(text), mode); |
lcd_xpos++; |
if (lcd_xpos > 21) |
{ |
lcd_xpos = 0; |
// new_line (); |
} |
break; |
} |
text++; |
} |
} |
//----------------------------------------------------------- |
void lcd_printpns_at (uint8_t x, uint8_t y, const char *text, uint8_t mode) |
{ |
lcd_xpos = x; |
lcd_ypos = y; |
lcd_printpns (text, mode); |
} |
//----------------------------------------------------------- |
void lcd_printp (const char *text, uint8_t mode) |
{ |
while (pgm_read_byte(text)) |
{ |
switch (pgm_read_byte(text)) |
{ |
case 0x0D: |
lcd_xpos = 0; |
break; |
case 0x0A: |
new_line(); |
break; |
default: |
lcd_putc (lcd_xpos, lcd_ypos, pgm_read_byte(text), mode); |
lcd_xpos++; |
if (lcd_xpos > 21) |
{ |
lcd_xpos = 0; |
new_line (); |
} |
break; |
} |
text++; |
} |
} |
//----------------------------------------------------------- |
void lcd_printp_at (uint8_t x, uint8_t y, const char *text, uint8_t mode) |
{ |
lcd_xpos = x; |
lcd_ypos = y; |
lcd_printp (text, mode); |
} |
//----------------------------------------------------------- |
void lcd_print (uint8_t *text, uint8_t mode) |
{ |
while (*text) |
{ |
switch (*text) |
{ |
case 0x0D: |
lcd_xpos = 0; |
break; |
case 0x0A: |
new_line(); |
break; |
default: |
lcd_putc (lcd_xpos, lcd_ypos, *text, mode); |
lcd_xpos++; |
if (lcd_xpos > 21) |
{ |
lcd_xpos = 0; |
new_line (); |
} |
break; |
} |
text++; |
} |
} |
//----------------------------------------------------------- |
void lcd_print_at (uint8_t x, uint8_t y, uint8_t *text, uint8_t mode) |
{ |
lcd_xpos = x; |
lcd_ypos = y; |
lcd_print (text, mode); |
} |
//----------------------------------------------------------- |
void print_display (uint8_t *text) |
{ |
while (*text) |
{ |
lcd_putc (lcd_xpos, lcd_ypos, *text, 0); |
lcd_xpos++; |
if (lcd_xpos >= 20) |
{ |
lcd_xpos = 0; |
new_line (); |
} |
text++; |
} |
} |
//----------------------------------------------------------- |
void print_display_at (uint8_t x, uint8_t y, uint8_t *text) |
{ |
lcd_xpos = x; |
lcd_ypos = y; |
print_display (text); |
} |
//----------------------------------------------------------- |
// + Plot (set one Pixel) |
//----------------------------------------------------------- |
// mode: |
// 0=Clear, 1=Set, 2=XOR |
void lcd_plot (uint8_t xpos, uint8_t ypos, uint8_t mode) |
{ |
uint16_t adress; |
uint8_t mask; |
if ((xpos < DISP_W) && (ypos < DISP_H)) |
{ |
adress = (ypos / 8) * DISP_W + xpos; // adress = 0/8 * 128 + 0 = 0 |
mask = 1 << (ypos & 0x07); // mask = 1<<0 = 1 |
adress &= DISP_BUFFER - 1; |
switch (mode) |
{ |
case 0: |
display_buffer[adress] &= ~mask; |
break; |
case 1: |
display_buffer[adress] |= mask; |
break; |
case 2: |
display_buffer[adress] ^= mask; |
break; |
} |
set_adress (adress, display_buffer[adress]); |
} |
} |
//----------------------------------------------------------- |
// + Line (draws a line from x1,y1 to x2,y2 |
// + Based on Bresenham line-Algorithm |
// + found in the internet, modified by thkais 2007 |
//----------------------------------------------------------- |
void lcd_line (unsigned char x1, unsigned char y1, unsigned char x2, unsigned char y2, uint8_t mode) |
{ |
int x, y, count, xs, ys, xm, ym; |
x = (int) x1; |
y = (int) y1; |
xs = (int) x2 - (int) x1; |
ys = (int) y2 - (int) y1; |
if (xs < 0) |
xm = -1; |
else |
if (xs > 0) |
xm = 1; |
else |
xm = 0; |
if (ys < 0) |
ym = -1; |
else |
if (ys > 0) |
ym = 1; |
else |
ym = 0; |
if (xs < 0) |
xs = -xs; |
if (ys < 0) |
ys = -ys; |
lcd_plot ((unsigned char) x, (unsigned char) y, mode); |
if (xs > ys) // Flat Line <45 degrees |
{ |
count = -(xs / 2); |
while (x != x2) |
{ |
count = count + ys; |
x = x + xm; |
if (count > 0) |
{ |
y = y + ym; |
count = count - xs; |
} |
lcd_plot ((unsigned char) x, (unsigned char) y, mode); |
} |
} |
else // Line >=45 degrees |
{ |
count =- (ys / 2); |
while (y != y2) |
{ |
count = count + xs; |
y = y + ym; |
if (count > 0) |
{ |
x = x + xm; |
count = count - ys; |
} |
lcd_plot ((unsigned char) x, (unsigned char) y, mode); |
} |
} |
} |
//----------------------------------------------------------- |
// + Filled rectangle |
// + x1, y1 = upper left corner |
//----------------------------------------------------------- |
void lcd_frect (uint8_t x1, uint8_t y1, uint8_t widthx, uint8_t widthy, uint8_t mode) |
{ |
uint16_t x2, y2; |
uint16_t i; |
if (x1 >= DISP_W) |
x1 = DISP_W - 1; |
if (y1 >= DISP_H) |
y1 = DISP_H - 1; |
x2 = x1 + widthx; |
y2 = y1 + widthy; |
if (x2 > DISP_W) |
x2 = DISP_W; |
if (y2 > DISP_H) |
y2 = DISP_H; |
for (i = y1; i <= y2; i++) |
{ |
lcd_line (x1, i, x2, i, mode); |
} |
} |
//----------------------------------------------------------- |
// + outline of rectangle |
// + x1, y1 = upper left corner |
//----------------------------------------------------------- |
void lcd_rect (uint8_t x1, uint8_t y1, uint8_t widthx, uint8_t widthy, uint8_t mode) |
{ |
uint16_t x2, y2; |
if (x1 >= DISP_W) |
x1 = DISP_W - 1; |
if (y1 >= DISP_H) |
y1 = DISP_H - 1; |
x2 = x1 + widthx; |
y2 = y1 + widthy; |
if (x2 > DISP_W) |
x2 = DISP_W; |
if (y2 > DISP_H) |
y2 = DISP_H; |
lcd_line (x1, y1, x2, y1, mode); |
lcd_line (x2, y1, x2, y2, mode); |
lcd_line (x2, y2, x1, y2, mode); |
lcd_line (x1, y2, x1, y1, mode); |
} |
//----------------------------------------------------------- |
// + outline of a circle |
// + Based on Bresenham-algorithm found in wikipedia |
// + modified by thkais (2007) |
//----------------------------------------------------------- |
void lcd_circle (int16_t x0, int16_t y0, int16_t radius, uint8_t mode) |
{ |
int16_t f = 1 - radius; |
int16_t ddF_x = 0; |
int16_t ddF_y = -2 * radius; |
int16_t x = 0; |
int16_t y = radius; |
lcd_plot (x0, y0 + radius, mode); |
lcd_plot (x0, y0 - radius, mode); |
lcd_plot (x0 + radius, y0, mode); |
lcd_plot (x0 - radius, y0, mode); |
while (x < y) |
{ |
if (f >= 0) |
{ |
y --; |
ddF_y += 2; |
f += ddF_y; |
} |
x ++; |
ddF_x += 2; |
f += ddF_x + 1; |
lcd_plot (x0 + x, y0 + y, mode); |
lcd_plot (x0 - x, y0 + y, mode); |
lcd_plot (x0 + x, y0 - y, mode); |
lcd_plot (x0 - x, y0 - y, mode); |
lcd_plot (x0 + y, y0 + x, mode); |
lcd_plot (x0 - y, y0 + x, mode); |
lcd_plot (x0 + y, y0 - x, mode); |
lcd_plot (x0 - y, y0 - x, mode); |
} |
} |
//----------------------------------------------------------- |
// + filled Circle |
// + modified circle-algorithm thkais (2007) |
//----------------------------------------------------------- |
void lcd_fcircle (int16_t x0, int16_t y0, int16_t radius,uint8_t mode) |
{ |
int16_t f = 1 - radius; |
int16_t ddF_x = 0; |
int16_t ddF_y = -2 * radius; |
int16_t x = 0; |
int16_t y = radius; |
lcd_line (x0, y0 + radius, x0, y0 - radius, mode); |
lcd_line (x0 + radius, y0, x0 - radius, y0, mode); |
while (x < y) |
{ |
if (f >= 0) |
{ |
y--; |
ddF_y += 2; |
f += ddF_y; |
} |
x++; |
ddF_x += 2; |
f += ddF_x + 1; |
lcd_line (x0 + x, y0 + y, x0 - x, y0 + y, mode); |
lcd_line (x0 + x, y0 - y, x0 - x, y0 - y, mode); |
lcd_line (x0 + y, y0 + x, x0 - y, y0 + x, mode); |
lcd_line (x0 + y, y0 - x, x0 - y, y0 - x, mode); |
} |
} |
//----------------------------------------------------------- |
// |
void lcd_circ_line (uint8_t x, uint8_t y, uint8_t r, uint16_t deg, uint8_t mode) |
{ |
uint8_t xc, yc; |
double deg_rad; |
deg_rad = (deg * M_PI) / 180.0; |
yc = y - (uint8_t) round (cos (deg_rad) * (double) r); |
xc = x + (uint8_t) round (sin (deg_rad) * (double) r); |
lcd_line (x, y, xc, yc, mode); |
} |
//----------------------------------------------------------- |
// |
void lcd_ellipse_line (uint8_t x, uint8_t y, uint8_t rx, uint8_t ry, uint16_t deg, uint8_t mode) |
{ |
uint8_t xc, yc; |
double deg_rad; |
deg_rad = (deg * M_PI) / 180.0; |
yc = y - (uint8_t) round (cos (deg_rad) * (double) ry); |
xc = x + (uint8_t) round (sin (deg_rad) * (double) rx); |
lcd_line (x, y, xc, yc, mode); |
} |
//----------------------------------------------------------- |
// |
void lcd_ellipse (int16_t x0, int16_t y0, int16_t rx, int16_t ry, uint8_t mode) |
{ |
const int16_t rx2 = rx * rx; |
const int16_t ry2 = ry * ry; |
int16_t F = round (ry2 - rx2 * ry + 0.25 * rx2); |
int16_t ddF_x = 0; |
int16_t ddF_y = 2 * rx2 * ry; |
int16_t x = 0; |
int16_t y = ry; |
lcd_plot (x0, y0 + ry, mode); |
lcd_plot (x0, y0 - ry, mode); |
lcd_plot (x0 + rx, y0, mode); |
lcd_plot (x0 - rx, y0, mode); |
// while ( 2*ry2*x < 2*rx2*y ) { we can use ddF_x and ddF_y |
while (ddF_x < ddF_y) |
{ |
if(F >= 0) |
{ |
y -= 1; // south |
ddF_y -= 2 * rx2; |
F -= ddF_y; |
} |
x += 1; // east |
ddF_x += 2 * ry2; |
F += ddF_x + ry2; |
lcd_plot (x0 + x, y0 + y, mode); |
lcd_plot (x0 + x, y0 - y, mode); |
lcd_plot (x0 - x, y0 + y, mode); |
lcd_plot (x0 - x, y0 - y, mode); |
} |
F = round (ry2 * (x + 0.5) * (x + 0.5) + rx2 * (y - 1) * (y - 1) - rx2 * ry2); |
while(y > 0) |
{ |
if(F <= 0) |
{ |
x += 1; // east |
ddF_x += 2 * ry2; |
F += ddF_x; |
} |
y -= 1; // south |
ddF_y -= 2 * rx2; |
F += rx2 - ddF_y; |
lcd_plot (x0 + x, y0 + y, mode); |
lcd_plot (x0 + x, y0 - y, mode); |
lcd_plot (x0 - x, y0 + y, mode); |
lcd_plot (x0 - x, y0 - y, mode); |
} |
} |
//----------------------------------------------------------- |
// |
void lcd_ecircle (int16_t x0, int16_t y0, int16_t radius, uint8_t mode) |
{ |
lcd_ellipse (x0, y0, radius + 3, radius, mode); |
} |
//----------------------------------------------------------- |
// |
void lcd_ecirc_line (uint8_t x, uint8_t y, uint8_t r, uint16_t deg, uint8_t mode) |
{ |
lcd_ellipse_line(x, y, r + 3, r, deg, mode); |
} |
//----------------------------------------------------------- |
// |
void lcd_view_font (uint8_t page) |
{ |
int x; |
int y; |
lcd_cls (); |
lcd_printp (PSTR(" 0123456789ABCDEF\r\n"), 0); |
lcd_printpns_at (0, 7, PSTR(" \x1a \x1b Exit"), 0); |
lcd_ypos = 2; |
for (y = page * 4 ; y < (page * 4 + 4); y++) |
{ |
if (y < 10) |
{ |
lcd_putc (0, lcd_ypos, '0' + y, 0); |
} |
else |
{ |
lcd_putc (0, lcd_ypos, 'A' + y - 10, 0); |
} |
lcd_xpos = 2; |
for (x = 0; x < 16; x++) |
{ |
lcd_putc (lcd_xpos, lcd_ypos, y * 16 + x, 0); |
lcd_xpos++; |
} |
lcd_ypos++; |
} |
} |
//----------------------------------------------------------- |
uint8_t hdigit (uint8_t d) |
{ |
if (d < 10) |
{ |
return '0' + d; |
} |
else |
{ |
return 'A' + d - 10; |
} |
} |
//----------------------------------------------------------- |
void lcd_print_hex_at (uint8_t x, uint8_t y, uint8_t h, uint8_t mode) |
{ |
lcd_xpos = x; |
lcd_ypos = y; |
lcd_putc (lcd_xpos++, lcd_ypos, hdigit (h >> 4), mode); |
lcd_putc (lcd_xpos, lcd_ypos, hdigit (h & 0x0f), mode); |
} |
//----------------------------------------------------------- |
void lcd_print_hex (uint8_t h, uint8_t mode) |
{ |
// lcd_xpos = x; |
// lcd_ypos = y; |
lcd_putc (lcd_xpos++, lcd_ypos, hdigit (h >> 4), mode); |
lcd_putc (lcd_xpos++, lcd_ypos, hdigit (h & 0x0f), mode); |
lcd_putc (lcd_xpos++, lcd_ypos, ' ', mode); |
} |
//----------------------------------------------------------- |
void lcd_write_number_u (uint8_t number) |
{ |
uint8_t num = 100; |
uint8_t started = 0; |
while (num > 0) |
{ |
uint8_t b = number / num; |
if (b > 0 || started || num == 1) |
{ |
lcd_putc (lcd_xpos++, lcd_ypos, '0' + b, 0); |
started = 1; |
} |
number -= b * num; |
num /= 10; |
} |
} |
//----------------------------------------------------------- |
void lcd_write_number_u_at (uint8_t x, uint8_t y, uint8_t number) |
{ |
lcd_xpos = x; |
lcd_ypos = y; |
lcd_write_number_u (number); |
} |
//----------------------------------------------------------- |
// Write only some digits of a unsigned <number> at <x>/<y> to MAX7456 display memory |
// <num> represents the largest multiple of 10 that will still be displayable as |
// the first digit, so num = 10 will be 0-99 and so on |
// <pad> = 1 will cause blank spaced to be filled up with zeros e.g. 007 instead of 7 |
// |
void write_ndigit_number_u (uint8_t x, uint8_t y, uint16_t number, int16_t length, uint8_t pad, uint8_t mode) |
{ |
char s[7]; |
utoa(number, s, 10 ); |
uint8_t len = strlen(s); |
if (length < len) |
{ |
for (uint8_t i = 0; i < length; i++) |
{ |
lcd_putc (x++, y, '*', mode); |
} |
return; |
} |
for (uint8_t i = 0; i < length - len; i++) |
{ |
if (pad==1) |
{ |
lcd_putc (x++, y, '0', mode); |
} |
else |
{ |
lcd_putc (x++, y, ' ', mode); |
} |
} |
lcd_print_at(x, y, (uint8_t*)s, mode); |
} |
//----------------------------------------------------------- |
// Write only some digits of a signed <number> at <x>/<y> to MAX7456 display memory |
// <num> represents the largest multiple of 10 that will still be displayable as |
// the first digit, so num = 10 will be 0-99 and so on |
// <pad> = 1 will cause blank spaced to be filled up with zeros e.g. 007 instead of 7 |
// |
void write_ndigit_number_s (uint8_t x, uint8_t y, int16_t number, int16_t length, uint8_t pad, uint8_t mode) |
{ |
char s[7]; |
itoa(number, s, 10 ); |
uint8_t len = strlen(s); |
if (length < len) |
{ |
for (uint8_t i = 0; i < length; i++) |
{ |
lcd_putc (x++, y, '*', mode); |
} |
return; |
} |
for (uint8_t i = 0; i < length - len; i++) |
{ |
if (pad) |
{ |
lcd_putc (x++, y, '0', mode); |
} |
else |
{ |
lcd_putc (x++, y, ' ', mode); |
} |
} |
lcd_print_at(x, y, (uint8_t*)s, mode); |
} |
//----------------------------------------------------------- |
// Write only some digits of a unsigned <number> at <x>/<y> to MAX7456 display memory |
// as /10th of the value |
// <num> represents the largest multiple of 10 that will still be displayable as |
// the first digit, so num = 10 will be 0-99 and so on |
// <pad> = 1 will cause blank spaced to be filled up with zeros e.g. 007 instead of 7 |
// |
void write_ndigit_number_u_10th (uint8_t x, uint8_t y, uint16_t number, int16_t length, uint8_t pad, uint8_t mode) |
{ |
char s[7]; |
itoa(number, s, 10 ); |
uint8_t len = strlen(s); |
if (length < len) |
{ |
for (uint8_t i = 0; i < length; i++) |
{ |
lcd_putc (x++, y, '*', mode); |
} |
return; |
} |
for (uint8_t i = 0; i < length - len; i++) |
{ |
if (pad) |
{ |
lcd_putc (x++, y, '0', mode); |
} |
else |
{ |
lcd_putc (x++, y, ' ', mode); |
} |
} |
char rest = s[len - 1]; |
s[len - 1] = 0; |
if (len == 1) |
{ |
lcd_putc (x-1, y, '0', mode); |
} |
else if (len == 2 && s[0] == '-') |
{ |
lcd_putc (x-1, y, '-', mode); |
lcd_putc (x, y, '0', mode); |
} |
else |
{ |
lcd_print_at(x, y, (uint8_t*)s, mode); |
} |
x += len - 1; |
lcd_putc (x++, y, '.', mode); |
lcd_putc (x++, y, rest, mode); |
} |
//----------------------------------------------------------- |
void write_ndigit_number_u_100th (uint8_t x, uint8_t y, uint16_t number, int16_t length, uint8_t pad) |
{ |
uint8_t num = 100; |
while (num > 0) |
{ |
uint8_t b = number / num; |
if ((num / 10) == 1) |
{ |
lcd_putc (x++, y, '.', 0); |
} |
lcd_putc (x++, y, '0' + b, 0); |
number -= b * num; |
num /= 10; |
} |
} |
//----------------------------------------------------------- |
// Write only some digits of a signed <number> at <x>/<y> to MAX7456 display memory |
// as /10th of the value |
// <num> represents the largest multiple of 10 that will still be displayable as |
// the first digit, so num = 10 will be 0-99 and so on |
// <pad> = 1 will cause blank spaced to be filled up with zeros e.g. 007 instead of 7 |
// |
void write_ndigit_number_s_10th (uint8_t x, uint8_t y, int16_t number, int16_t length, uint8_t pad, uint8_t mode) |
{ |
char s[7]; |
itoa (number, s, 10 ); |
uint8_t len = strlen(s); |
if (length < len) |
{ |
for (uint8_t i = 0; i < length; i++) |
{ |
lcd_putc (x++, y, '*', mode); |
} |
return; |
} |
for (uint8_t i = 0; i < length - len; i++) |
{ |
if (pad) |
{ |
lcd_putc (x++, y, '0', mode); |
} |
else |
{ |
lcd_putc (x++, y, ' ', mode); |
} |
} |
char rest = s[len - 1]; |
s[len - 1] = 0; |
if (len == 1) |
{ |
lcd_putc (x-1, y, '0', mode); |
} |
else if (len == 2 && s[0] == '-') |
{ |
lcd_putc (x-1, y, '-', mode); |
lcd_putc (x, y, '0', mode); |
} |
else |
{ |
lcd_print_at(x, y, (uint8_t*)s, mode); |
} |
x += len - 1; |
lcd_putc (x++, y, '.', mode); |
lcd_putc (x++, y, rest, mode); |
} |
//----------------------------------------------------------- |
// write <seconds> as human readable time at <x>/<y> to MAX7456 display mem |
// |
void write_time (uint8_t x, uint8_t y, uint16_t seconds) |
{ |
uint16_t min = seconds / 60; |
seconds -= min * 60; |
write_ndigit_number_u (x, y, min, 2, 0,0); |
lcd_putc (x + 2, y, ':', 0); |
write_ndigit_number_u (x + 3, y, seconds, 2, 1,0); |
} |
//----------------------------------------------------------- |
// wirte a <position> at <x>/<y> assuming it is a gps position for long-/latitude |
// |
void write_gps_pos (uint8_t x, uint8_t y, int32_t position) |
{ |
if (position < 0) |
{ |
position ^= ~0; |
position++; |
lcd_putc (x++, y, '-', 0); |
} |
else |
{ |
lcd_putc (x++, y, ' ', 0); |
} |
write_ndigit_number_u (x, y, (uint16_t) (position / (int32_t) 10000000), 3, 1,0); |
lcd_putc (x + 3, y, '.', 0); |
position = position - ((position / (int32_t) 10000000) * (int32_t) 10000000); |
write_ndigit_number_u (x + 4, y, (uint16_t) (position / (int32_t) 1000), 4, 1,0); |
position = position - ((uint16_t) (position / (int32_t) 1000) * (int32_t) 1000); |
write_ndigit_number_u (x + 8, y, (uint16_t) position, 3, 1,0); |
lcd_putc (x + 11, y, 0x1e, 0); // degree symbol |
} |
//------------------------------------------------------------------------------------ |
// Show PKT Baudrate at given position |
// |
void show_baudrate (uint8_t x, uint8_t y, uint8_t Baudrate, uint8_t mode) |
{ |
switch (Baudrate) |
{ |
case Baud_2400: lcd_printp_at (x, y, PSTR("2400"), mode);break; |
case Baud_4800: lcd_printp_at (x, y, PSTR("4800"), mode);break; |
case Baud_9600: lcd_printp_at (x, y, PSTR("9600"), mode);break; |
case Baud_19200: lcd_printp_at (x, y, PSTR("19200"), mode);break; |
case Baud_38400: lcd_printp_at (x, y, PSTR("38400"), mode);break; |
case Baud_57600: lcd_printp_at (x, y, PSTR("57600"), mode);break; |
case Baud_115200: lcd_printp_at (x, y, PSTR("115200"), mode);break; |
break; |
} |
} |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/lcd/lcd.h |
---|
0,0 → 1,303 |
/***************************************************************************** |
* Copyright (C) 2009 Peter "woggle" Mack, mac@denich.net * |
* - original LCD control by Thomas "thkais" Kaiser * |
* - special number formating routines taken from C-OSD * |
* from Claas Anders "CaScAdE" Rathje * |
* - some extension, ellipse and circ_line by Peter "woggle" Mack * |
* Thanks to Oliver Schwaneberg for adding several functions to this library!* |
* * |
* Author: Jan Michel (jan at mueschelsoft dot de) * |
* License: GNU General Public License, version 3 * |
* Version: v0.93 September 2010 * |
* * |
* This program is free software; you can redistribute it and/or modify * |
* it under the terms of the GNU General Public License as published by * |
* the Free Software Foundation; either version 2 of the License. * |
* * |
* This program is distributed in the hope that it will be useful, * |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
* GNU General Public License for more details. * |
* * |
* You should have received a copy of the GNU General Public License * |
* along with this program; if not, write to the * |
* Free Software Foundation, Inc., * |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
* * |
*****************************************************************************/ |
#ifndef _LCD_H |
#define _LCD_H |
#define MNORMAL 0 // |
#define MINVERS 2 |
#define MBIG 3 |
#define MBIGINVERS 4 |
//------------------------------------------------------------------------------------ |
// X-tended |
void lcdx_putc( uint8_t x, uint8_t y, uint8_t c, uint8_t mode, int8_t xoffs, int8_t yoffs ); |
void lcdx_print (uint8_t *text, uint8_t mode, int8_t xoffs, int8_t yoffs); |
void lcdx_print_at (uint8_t x, uint8_t y, uint8_t *text, uint8_t mode, int8_t xoffs, int8_t yoffs); |
void lcdx_printp (const char *text, uint8_t mode, int8_t xoffs, int8_t yoffs); |
void lcdx_printp_at (uint8_t x, uint8_t y, const char *text, uint8_t mode, int8_t xoffs, int8_t yoffs); |
void writex_ndigit_number_s (uint8_t x, uint8_t y, int16_t number, int16_t length, uint8_t pad, uint8_t mode, int8_t xoffs, int8_t yoffs); |
void writex_ndigit_number_s_10th (uint8_t x, uint8_t y, int16_t number, int16_t length, uint8_t pad, uint8_t mode, int8_t xoffs, int8_t yoffs); |
void writex_ndigit_number_u (uint8_t x, uint8_t y, uint16_t number, int16_t length, uint8_t pad, uint8_t mode, int8_t xoffs, int8_t yoffs); |
void writex_ndigit_number_u_10th (uint8_t x, uint8_t y, uint16_t number, int16_t length, uint8_t pad, uint8_t mode, int8_t xoffs, int8_t yoffs); |
void writex_ndigit_number_u_100th (uint8_t x, uint8_t y, uint16_t number, int16_t length, uint8_t pad, int8_t xoffs, int8_t yoffs); |
void lcdx_puts_at(uint8_t x, uint8_t y, const char *s, uint8_t mode, int8_t xoffs, int8_t yoffs); |
void writex_time (uint8_t x, uint8_t y, uint16_t seconds, uint8_t mode, int8_t xoffs, int8_t yoffs); |
/* |
//----------------------------------------------------------------------------- |
// Command Codes |
//----------------------------------------------------------------------------- |
//1: Display on/off |
#define LCD_DISPLAY_ON 0xAF //switch display on |
#define LCD_DISPLAY_OFF 0xAE //switch display off |
//2: display start line set (lower 6 bits select first line on lcd from 64 lines in memory) |
#define LCD_START_LINE 0x40 |
//3: Page address set (lower 4 bits select one of 8 pages) |
#define LCD_PAGE_ADDRESS 0xB0 |
//4: column address (lower 4 bits are upper / lower nibble of column address) |
#define LCD_COL_ADDRESS_MSB 0x10 |
#define LCD_COL_ADDRESS_LSB 0x00 //second part of column address |
//8: select orientation (black side of the display should be further away from viewer) |
#define LCD_BOTTOMVIEW 0xA1 //6 o'clock view |
#define LCD_TOPVIEW 0xA0 //12 o'clock view |
//9: select normal (white background, black pixels) or reverse (black background, white pixels) mode |
#define LCD_DISPLAY_POSITIVE 0xA6 //not inverted mode |
#define LCD_DISPLAY_INVERTED 0xA7 //inverted display |
//10: show memory content or switch all pixels on |
#define LCD_SHOW_NORMAL 0xA4 //show dram content |
#define LCD_SHOW_ALL_POINTS 0xA5 //show all points |
//11: lcd bias set |
#define LCD_BIAS_1_9 0xA2 |
#define LCD_BIAS_1_7 0xA3 |
//14: Reset Controller |
#define LCD_RESET_CMD 0xE2 |
//15: output mode select (turns display upside-down) |
#define LCD_SCAN_DIR_NORMAL 0xC0 //normal scan direction |
#define LCD_SCAN_DIR_REVERSE 0xC8 //reversed scan direction |
//16: power control set (lower 3 bits select operating mode) |
//Bit 0: Voltage follower on/off - Bit 1: Voltage regulator on/off - Bit 2: Booster circuit on/off |
#define LCD_POWER_CONTROL 0x28 //base command |
#define LCD_POWER_LOW_POWER 0x2F |
#define LCD_POWER_WIDE_RANGE 0x2F |
#define LCD_POWER_LOW_VOLTAGE 0x2B |
//17: voltage regulator resistor ratio set (lower 3 bits select ratio) |
//selects lcd voltage - 000 is low (~ -2V), 111 is high (~ - 10V), also depending on volume mode. Datasheet suggests 011 |
#define LCD_VOLTAGE 0x20 |
//18: Volume mode set (2-byte command, lower 6 bits in second word select value, datasheet suggests 0x1F) |
#define LCD_VOLUME_MODE_1 0x81 |
#define LCD_VOLUME_MODE_2 0x00 |
//#if DISPLAY_TYPE == 128 || DISPLAY_TYPE == 132 |
//19: static indicator (2-byte command), first on/off, then blinking mode |
#define LCD_INDICATOR_ON 0xAD //static indicator on |
#define LCD_INDICATOR_OFF 0xAC //static indicator off |
#define LCD_INDICATOR_MODE_OFF 0x00 |
#define LCD_INDICATOR_MODE_1HZ 0x01 |
#define LCD_INDICATOR_MODE_2HZ 0x10 |
#define LCD_INDICATOR_MODE_ON 0x11 |
//20: booster ratio set (2-byte command) |
#define LCD_BOOSTER_SET 0xF8 //set booster ratio |
#define LCD_BOOSTER_234 0x00 //2x-4x |
#define LCD_BOOSTER_5 0x01 //5x |
#define LCD_BOOSTER_6 0x03 //6x |
//#endif |
//22: NOP command |
#define LCD_NOP 0xE3 |
//#if DISPLAY_TYPE == 102 |
////25: advanced program control |
//#define LCD_ADV_PROG_CTRL 0xFA |
//#define LCD_ADV_PROG_CTRL2 0x10 |
//#endif |
//----------------------------------------------------------------------------- |
// Makros to execute commands |
//----------------------------------------------------------------------------- |
#define LCD_SWITCH_ON() lcd_command(LCD_DISPLAY_ON) |
#define LCD_SWITCH_OFF() lcd_command(LCD_DISPLAY_OFF) |
#define LCD_SET_FIRST_LINE(i) lcd_command(LCD_START_LINE | ((i) & 0x3F)) |
#define LCD_SET_PAGE_ADDR(i) lcd_command(LCD_PAGE_ADDRESS | ((i) & 0x0F)) |
#define LCD_SET_COLUMN_ADDR(i) lcd_command(LCD_COL_ADDRESS_MSB | ((i>>4) & 0x0F)); \ |
lcd_command(LCD_COL_ADDRESS_LSB | ((i) & 0x0F)) |
#define LCD_GOTO_ADDRESS(page,col); lcd_command(LCD_PAGE_ADDRESS | ((page) & 0x0F)); \ |
lcd_command(LCD_COL_ADDRESS_MSB | ((col>>4) & 0x0F)); \ |
lcd_command(LCD_COL_ADDRESS_LSB | ((col) & 0x0F)); |
#define LCD_SET_BOTTOM_VIEW() lcd_command(LCD_BOTTOMVIEW) |
#define LCD_SET_TOP_VIEW() lcd_command(LCD_TOPVIEW) |
#define LCD_SET_MODE_POSITIVE() lcd_command(LCD_DISPLAY_POSITIVE) |
#define LCD_SET_MODE_INVERTED() lcd_command(LCD_DISPLAY_INVERTED) |
#define LCD_SHOW_ALL_PIXELS_ON() lcd_command(LCD_SHOW_ALL_POINTS) |
#define LCD_SHOW_ALL_PIXELS_OFF() lcd_command(LCD_SHOW_NORMAL) |
#define LCD_SET_BIAS_RATIO_1_7() lcd_command(LCD_BIAS_1_7) |
#define LCD_SET_BIAS_RATIO_1_9() lcd_command(LCD_BIAS_1_9) |
#define LCD_SEND_RESET() lcd_command(LCD_RESET_CMD) |
#define LCD_ORIENTATION_NORMAL() lcd_command(LCD_SCAN_DIR_NORMAL) |
#define LCD_ORIENTATION_UPSIDEDOWN() lcd_command(LCD_SCAN_DIR_REVERSE) |
#define LCD_SET_POWER_CONTROL(i) lcd_command(LCD_POWER_CONTROL | ((i) & 0x07)) |
#define LCD_SET_LOW_POWER() lcd_command(LCD_POWER_LOW_POWER) |
#define LCD_SET_WIDE_RANGE() lcd_command(LCD_POWER_WIDE_RANGE) |
#define LCD_SET_LOW_VOLTAGE() lcd_command(LCD_POWER_LOW_VOLTAGE) |
#define LCD_SET_BIAS_VOLTAGE(i) lcd_command(LCD_VOLTAGE | ((i) & 0x07)) |
#define LCD_SET_VOLUME_MODE(i) lcd_command(LCD_VOLUME_MODE_1); \ |
lcd_command(LCD_VOLUME_MODE_2 | ((i) & 0x3F)) |
//#if DISPLAY_TYPE == 128 || DISPLAY_TYPE == 132 |
#define LCD_SET_INDICATOR_OFF() lcd_command(LCD_INDICATOR_OFF); \ |
lcd_command(LCD_INDICATOR_MODE_OFF) |
#define LCD_SET_INDICATOR_STATIC() lcd_command(LCD_INDICATOR_ON); \ |
lcd_command(LCD_INDICATOR_MODE_ON) |
#define LCD_SET_INDICATOR_1HZ() lcd_command(LCD_INDICATOR_ON); \ |
lcd_command(LCD_INDICATOR_MODE_1HZ) |
#define LCD_SET_INDICATOR_2HZ() lcd_command(LCD_INDICATOR_ON); \ |
lcd_command(LCD_INDICATOR_MODE_2HZ) |
#define LCD_SET_INDICATOR(i,j) lcd_command(LCD_INDICATOR_OFF | ((i) & 1)); \ |
lcd_command(((j) & 2)) |
#define LCD_SLEEP_MODE lcd_command(LCD_INDICATOR_OFF); \ |
lcd_command(LCD_DISPLAY_OFF); \ |
lcd_command(LCD_SHOW_ALL_POINTS) |
//#endif |
//#if DISPLAY_TYPE == 102 |
//#define LCD_TEMPCOMP_HIGH 0x80 |
//#define LCD_COLWRAP 0x02 |
//#define LCD_PAGEWRAP 0x01 |
//#define LCD_SET_ADV_PROG_CTRL(i) lcd_command(LCD_ADV_PROG_CTRL); |
// lcd_command(LCD_ADV_PROG_CTRL2 & i) |
//#endif |
*/ |
extern volatile uint8_t LCD_ORIENTATION; |
//#define LCD_LINES 8 |
//#define LCD_COLS 21 |
extern uint8_t lcd_xpos; |
extern uint8_t lcd_ypos; |
void lcd_command(uint8_t cmd); |
void send_byte (uint8_t data); |
void LCD_Init (uint8_t LCD_Mode); |
void new_line (void); |
void lcd_puts_at(uint8_t x, uint8_t y,const char *s, uint8_t mode ); |
void lcd_putc (uint8_t x, uint8_t y, uint8_t c, uint8_t mode); |
void send_byte (uint8_t data); |
void lcd_print (uint8_t *text, uint8_t mode); |
void lcd_print_at (uint8_t x, uint8_t y, uint8_t *text, uint8_t mode); |
void lcd_printp (const char *text, uint8_t mode); |
void lcd_printp_at (uint8_t x, uint8_t y, const char *text, uint8_t mode); |
void lcd_printpns (const char *text, uint8_t mode); |
void lcd_printpns_at (uint8_t x, uint8_t y, const char *text, uint8_t mode); |
void lcd_cls (void); |
void lcd_cls_line (uint8_t x, uint8_t y, uint8_t w); |
void print_display (uint8_t *text); |
void print_display_at (uint8_t x, uint8_t y, uint8_t *text); |
void copy_line (uint8_t y); |
void paste_line (uint8_t y); |
void lcd_plot (uint8_t x, uint8_t y, uint8_t mode); |
void lcd_line (unsigned char x1, unsigned char y1, unsigned char x2, unsigned char y2, uint8_t mode); |
void lcd_rect (uint8_t x1, uint8_t y1, uint8_t widthx, uint8_t widthy, uint8_t mode); |
void lcd_frect (uint8_t x1, uint8_t y1, uint8_t widthx, uint8_t widthy, uint8_t mode); |
void lcd_circle (int16_t x0, int16_t y0, int16_t radius, uint8_t mode); |
void lcd_fcircle (int16_t x0, int16_t y0, int16_t radius, uint8_t mode); |
void lcd_circ_line (uint8_t x, uint8_t y, uint8_t r, uint16_t deg, uint8_t mode); |
void lcd_ellipse (int16_t x0, int16_t y0, int16_t rx, int16_t ry, uint8_t mode); |
void lcd_ellipse_line (uint8_t x, uint8_t y, uint8_t rx, uint8_t ry, uint16_t deg, uint8_t mode); |
void lcd_ecircle (int16_t x0, int16_t y0, int16_t radius, uint8_t mode); |
void lcd_ecirc_line (uint8_t x, uint8_t y, uint8_t r, uint16_t deg, uint8_t mode); |
void lcd_view_font (uint8_t page); |
void lcd_print_hex_at (uint8_t x, uint8_t y, uint8_t h, uint8_t mode); |
void lcd_write_number_u (uint8_t number); |
void lcd_write_number_u_at (uint8_t x, uint8_t y, uint8_t number); |
void lcd_print_hex (uint8_t h, uint8_t mode); |
/** |
* Write only some digits of a unsigned <number> at <x>/<y> |
* <length> represents the length to rightbound the number |
* <pad> = 1 will cause blank spaced to be filled up with zeros e.g. 007 instead of 7 |
*/ |
void write_ndigit_number_u (uint8_t x, uint8_t y, uint16_t number, int16_t length, uint8_t pad,uint8_t mode); |
/** |
* Write only some digits of a signed <number> at <x>/<y> |
* <length> represents the length to rightbound the number |
* <pad> = 1 will cause blank spaced to be filled up with zeros e.g. 007 instead of 7 |
*/ |
void write_ndigit_number_s (uint8_t x, uint8_t y, int16_t number, int16_t length, uint8_t pad, uint8_t mode); |
/** |
* Write only some digits of a unsigned <number> at <x>/<y> as /10th of the value |
* <length> represents the length to rightbound the number |
* <pad> = 1 will cause blank spaced to be filled up with zeros e.g. 00.7 instead of .7 |
*/ |
void write_ndigit_number_u_10th (uint8_t x, uint8_t y, uint16_t number, int16_t length, uint8_t pad, uint8_t mode); |
/** |
* Write only some digits of a unsigned <number> at <x>/<y> as /100th of the value |
* <length> represents the length to rightbound the number |
* <pad> = 1 will cause blank spaced to be filled up with zeros e.g. 00.7 instead of .7 |
*/ |
void write_ndigit_number_u_100th (uint8_t x, uint8_t y, uint16_t number, int16_t length, uint8_t pad); |
/** |
* Write only some digits of a signed <number> at <x>/<y> as /10th of the value |
* <length> represents the length to rightbound the number |
* <pad> = 1 will cause blank spaced to be filled up with zeros e.g. 00.7 instead of .7 |
*/ |
void write_ndigit_number_s_10th (uint8_t x, uint8_t y, int16_t number, int16_t length, uint8_t pad, uint8_t mode); |
/** |
* write <seconds> as human readable time at <x>/<y> |
*/ |
void write_time (uint8_t x, uint8_t y, uint16_t seconds); |
/** |
* wirte a <position> at <x>/<y> assuming it is a gps position for long-/latitude |
*/ |
void write_gps_pos (uint8_t x, uint8_t y, int32_t position); |
//------------------------------------------------------------------------------------ |
// Show PKT Baudrate at given position |
// |
void show_baudrate (uint8_t x, uint8_t y, uint8_t Baudrate, uint8_t mode); |
#endif |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/lcd/lcd.hold |
---|
0,0 → 1,282 |
/***************************************************************************** |
* Copyright (C) 2009 Peter "woggle" Mack, mac@denich.net * |
* - original LCD control by Thomas "thkais" Kaiser * |
* - special number formating routines taken from C-OSD * |
* from Claas Anders "CaScAdE" Rathje * |
* - some extension, ellipse and circ_line by Peter "woggle" Mack * |
* Thanks to Oliver Schwaneberg for adding several functions to this library!* |
* * |
* Author: Jan Michel (jan at mueschelsoft dot de) * |
* License: GNU General Public License, version 3 * |
* Version: v0.93 September 2010 * |
* * |
* This program is free software; you can redistribute it and/or modify * |
* it under the terms of the GNU General Public License as published by * |
* the Free Software Foundation; either version 2 of the License. * |
* * |
* This program is distributed in the hope that it will be useful, * |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
* GNU General Public License for more details. * |
* * |
* You should have received a copy of the GNU General Public License * |
* along with this program; if not, write to the * |
* Free Software Foundation, Inc., * |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
* * |
*****************************************************************************/ |
#ifndef _LCD_H |
#define _LCD_H |
/* |
//----------------------------------------------------------------------------- |
// Command Codes |
//----------------------------------------------------------------------------- |
//1: Display on/off |
#define LCD_DISPLAY_ON 0xAF //switch display on |
#define LCD_DISPLAY_OFF 0xAE //switch display off |
//2: display start line set (lower 6 bits select first line on lcd from 64 lines in memory) |
#define LCD_START_LINE 0x40 |
//3: Page address set (lower 4 bits select one of 8 pages) |
#define LCD_PAGE_ADDRESS 0xB0 |
//4: column address (lower 4 bits are upper / lower nibble of column address) |
#define LCD_COL_ADDRESS_MSB 0x10 |
#define LCD_COL_ADDRESS_LSB 0x00 //second part of column address |
//8: select orientation (black side of the display should be further away from viewer) |
#define LCD_BOTTOMVIEW 0xA1 //6 o'clock view |
#define LCD_TOPVIEW 0xA0 //12 o'clock view |
//9: select normal (white background, black pixels) or reverse (black background, white pixels) mode |
#define LCD_DISPLAY_POSITIVE 0xA6 //not inverted mode |
#define LCD_DISPLAY_INVERTED 0xA7 //inverted display |
//10: show memory content or switch all pixels on |
#define LCD_SHOW_NORMAL 0xA4 //show dram content |
#define LCD_SHOW_ALL_POINTS 0xA5 //show all points |
//11: lcd bias set |
#define LCD_BIAS_1_9 0xA2 |
#define LCD_BIAS_1_7 0xA3 |
//14: Reset Controller |
#define LCD_RESET_CMD 0xE2 |
//15: output mode select (turns display upside-down) |
#define LCD_SCAN_DIR_NORMAL 0xC0 //normal scan direction |
#define LCD_SCAN_DIR_REVERSE 0xC8 //reversed scan direction |
//16: power control set (lower 3 bits select operating mode) |
//Bit 0: Voltage follower on/off - Bit 1: Voltage regulator on/off - Bit 2: Booster circuit on/off |
#define LCD_POWER_CONTROL 0x28 //base command |
#define LCD_POWER_LOW_POWER 0x2F |
#define LCD_POWER_WIDE_RANGE 0x2F |
#define LCD_POWER_LOW_VOLTAGE 0x2B |
//17: voltage regulator resistor ratio set (lower 3 bits select ratio) |
//selects lcd voltage - 000 is low (~ -2V), 111 is high (~ - 10V), also depending on volume mode. Datasheet suggests 011 |
#define LCD_VOLTAGE 0x20 |
//18: Volume mode set (2-byte command, lower 6 bits in second word select value, datasheet suggests 0x1F) |
#define LCD_VOLUME_MODE_1 0x81 |
#define LCD_VOLUME_MODE_2 0x00 |
//#if DISPLAY_TYPE == 128 || DISPLAY_TYPE == 132 |
//19: static indicator (2-byte command), first on/off, then blinking mode |
#define LCD_INDICATOR_ON 0xAD //static indicator on |
#define LCD_INDICATOR_OFF 0xAC //static indicator off |
#define LCD_INDICATOR_MODE_OFF 0x00 |
#define LCD_INDICATOR_MODE_1HZ 0x01 |
#define LCD_INDICATOR_MODE_2HZ 0x10 |
#define LCD_INDICATOR_MODE_ON 0x11 |
//20: booster ratio set (2-byte command) |
#define LCD_BOOSTER_SET 0xF8 //set booster ratio |
#define LCD_BOOSTER_234 0x00 //2x-4x |
#define LCD_BOOSTER_5 0x01 //5x |
#define LCD_BOOSTER_6 0x03 //6x |
//#endif |
//22: NOP command |
#define LCD_NOP 0xE3 |
//#if DISPLAY_TYPE == 102 |
////25: advanced program control |
//#define LCD_ADV_PROG_CTRL 0xFA |
//#define LCD_ADV_PROG_CTRL2 0x10 |
//#endif |
//----------------------------------------------------------------------------- |
// Makros to execute commands |
//----------------------------------------------------------------------------- |
#define LCD_SWITCH_ON() lcd_command(LCD_DISPLAY_ON) |
#define LCD_SWITCH_OFF() lcd_command(LCD_DISPLAY_OFF) |
#define LCD_SET_FIRST_LINE(i) lcd_command(LCD_START_LINE | ((i) & 0x3F)) |
#define LCD_SET_PAGE_ADDR(i) lcd_command(LCD_PAGE_ADDRESS | ((i) & 0x0F)) |
#define LCD_SET_COLUMN_ADDR(i) lcd_command(LCD_COL_ADDRESS_MSB | ((i>>4) & 0x0F)); \ |
lcd_command(LCD_COL_ADDRESS_LSB | ((i) & 0x0F)) |
#define LCD_GOTO_ADDRESS(page,col); lcd_command(LCD_PAGE_ADDRESS | ((page) & 0x0F)); \ |
lcd_command(LCD_COL_ADDRESS_MSB | ((col>>4) & 0x0F)); \ |
lcd_command(LCD_COL_ADDRESS_LSB | ((col) & 0x0F)); |
#define LCD_SET_BOTTOM_VIEW() lcd_command(LCD_BOTTOMVIEW) |
#define LCD_SET_TOP_VIEW() lcd_command(LCD_TOPVIEW) |
#define LCD_SET_MODE_POSITIVE() lcd_command(LCD_DISPLAY_POSITIVE) |
#define LCD_SET_MODE_INVERTED() lcd_command(LCD_DISPLAY_INVERTED) |
#define LCD_SHOW_ALL_PIXELS_ON() lcd_command(LCD_SHOW_ALL_POINTS) |
#define LCD_SHOW_ALL_PIXELS_OFF() lcd_command(LCD_SHOW_NORMAL) |
#define LCD_SET_BIAS_RATIO_1_7() lcd_command(LCD_BIAS_1_7) |
#define LCD_SET_BIAS_RATIO_1_9() lcd_command(LCD_BIAS_1_9) |
#define LCD_SEND_RESET() lcd_command(LCD_RESET_CMD) |
#define LCD_ORIENTATION_NORMAL() lcd_command(LCD_SCAN_DIR_NORMAL) |
#define LCD_ORIENTATION_UPSIDEDOWN() lcd_command(LCD_SCAN_DIR_REVERSE) |
#define LCD_SET_POWER_CONTROL(i) lcd_command(LCD_POWER_CONTROL | ((i) & 0x07)) |
#define LCD_SET_LOW_POWER() lcd_command(LCD_POWER_LOW_POWER) |
#define LCD_SET_WIDE_RANGE() lcd_command(LCD_POWER_WIDE_RANGE) |
#define LCD_SET_LOW_VOLTAGE() lcd_command(LCD_POWER_LOW_VOLTAGE) |
#define LCD_SET_BIAS_VOLTAGE(i) lcd_command(LCD_VOLTAGE | ((i) & 0x07)) |
#define LCD_SET_VOLUME_MODE(i) lcd_command(LCD_VOLUME_MODE_1); \ |
lcd_command(LCD_VOLUME_MODE_2 | ((i) & 0x3F)) |
//#if DISPLAY_TYPE == 128 || DISPLAY_TYPE == 132 |
#define LCD_SET_INDICATOR_OFF() lcd_command(LCD_INDICATOR_OFF); \ |
lcd_command(LCD_INDICATOR_MODE_OFF) |
#define LCD_SET_INDICATOR_STATIC() lcd_command(LCD_INDICATOR_ON); \ |
lcd_command(LCD_INDICATOR_MODE_ON) |
#define LCD_SET_INDICATOR_1HZ() lcd_command(LCD_INDICATOR_ON); \ |
lcd_command(LCD_INDICATOR_MODE_1HZ) |
#define LCD_SET_INDICATOR_2HZ() lcd_command(LCD_INDICATOR_ON); \ |
lcd_command(LCD_INDICATOR_MODE_2HZ) |
#define LCD_SET_INDICATOR(i,j) lcd_command(LCD_INDICATOR_OFF | ((i) & 1)); \ |
lcd_command(((j) & 2)) |
#define LCD_SLEEP_MODE lcd_command(LCD_INDICATOR_OFF); \ |
lcd_command(LCD_DISPLAY_OFF); \ |
lcd_command(LCD_SHOW_ALL_POINTS) |
//#endif |
//#if DISPLAY_TYPE == 102 |
//#define LCD_TEMPCOMP_HIGH 0x80 |
//#define LCD_COLWRAP 0x02 |
//#define LCD_PAGEWRAP 0x01 |
//#define LCD_SET_ADV_PROG_CTRL(i) lcd_command(LCD_ADV_PROG_CTRL); |
// lcd_command(LCD_ADV_PROG_CTRL2 & i) |
//#endif |
*/ |
extern volatile uint8_t LCD_ORIENTATION; |
//#define LCD_LINES 8 |
//#define LCD_COLS 21 |
extern uint8_t lcd_xpos; |
extern uint8_t lcd_ypos; |
void lcd_command(uint8_t cmd); |
void send_byte (uint8_t data); |
void LCD_Init (uint8_t LCD_Mode); |
void new_line (void); |
void lcd_puts_at(uint8_t x, uint8_t y,const char *s, uint8_t mode ); |
void lcd_putc (uint8_t x, uint8_t y, uint8_t c, uint8_t mode); |
void send_byte (uint8_t data); |
void lcd_print (uint8_t *text, uint8_t mode); |
void lcd_print_at (uint8_t x, uint8_t y, uint8_t *text, uint8_t mode); |
void lcd_printp (const char *text, uint8_t mode); |
void lcd_printp_at (uint8_t x, uint8_t y, const char *text, uint8_t mode); |
void lcd_printpns (const char *text, uint8_t mode); |
void lcd_printpns_at (uint8_t x, uint8_t y, const char *text, uint8_t mode); |
void lcd_cls (void); |
void lcd_cls_line (uint8_t x, uint8_t y, uint8_t w); |
void print_display (uint8_t *text); |
void print_display_at (uint8_t x, uint8_t y, uint8_t *text); |
void copy_line (uint8_t y); |
void paste_line (uint8_t y); |
// Jeti |
void lcd_putc_jeti (uint8_t x, uint8_t y, uint8_t c, uint8_t mode); |
void lcd_printpj (const char *text, uint8_t mode); |
void lcd_printpj_at (uint8_t x, uint8_t y, const char *text, uint8_t mode); |
void lcd_plot (uint8_t x, uint8_t y, uint8_t mode); |
void lcd_line (unsigned char x1, unsigned char y1, unsigned char x2, unsigned char y2, uint8_t mode); |
void lcd_rect (uint8_t x1, uint8_t y1, uint8_t widthx, uint8_t widthy, uint8_t mode); |
void lcd_frect (uint8_t x1, uint8_t y1, uint8_t widthx, uint8_t widthy, uint8_t mode); |
void lcd_circle (int16_t x0, int16_t y0, int16_t radius, uint8_t mode); |
void lcd_fcircle (int16_t x0, int16_t y0, int16_t radius, uint8_t mode); |
void lcd_circ_line (uint8_t x, uint8_t y, uint8_t r, uint16_t deg, uint8_t mode); |
void lcd_ellipse (int16_t x0, int16_t y0, int16_t rx, int16_t ry, uint8_t mode); |
void lcd_ellipse_line (uint8_t x, uint8_t y, uint8_t rx, uint8_t ry, uint16_t deg, uint8_t mode); |
void lcd_ecircle (int16_t x0, int16_t y0, int16_t radius, uint8_t mode); |
void lcd_ecirc_line (uint8_t x, uint8_t y, uint8_t r, uint16_t deg, uint8_t mode); |
void lcd_view_font (uint8_t page); |
void lcd_print_hex_at (uint8_t x, uint8_t y, uint8_t h, uint8_t mode); |
void lcd_write_number_u (uint8_t number); |
void lcd_write_number_u_at (uint8_t x, uint8_t y, uint8_t number); |
void lcd_print_hex (uint8_t h, uint8_t mode); |
/** |
* Write only some digits of a unsigned <number> at <x>/<y> |
* <length> represents the length to rightbound the number |
* <pad> = 1 will cause blank spaced to be filled up with zeros e.g. 007 instead of 7 |
*/ |
void write_ndigit_number_u (uint8_t x, uint8_t y, uint16_t number, int16_t length, uint8_t pad,uint8_t mode); |
/** |
* Write only some digits of a signed <number> at <x>/<y> |
* <length> represents the length to rightbound the number |
* <pad> = 1 will cause blank spaced to be filled up with zeros e.g. 007 instead of 7 |
*/ |
void write_ndigit_number_s (uint8_t x, uint8_t y, int16_t number, int16_t length, uint8_t pad, uint8_t mode); |
/** |
* Write only some digits of a unsigned <number> at <x>/<y> as /10th of the value |
* <length> represents the length to rightbound the number |
* <pad> = 1 will cause blank spaced to be filled up with zeros e.g. 00.7 instead of .7 |
*/ |
void write_ndigit_number_u_10th (uint8_t x, uint8_t y, uint16_t number, int16_t length, uint8_t pad, uint8_t mode); |
/** |
* Write only some digits of a unsigned <number> at <x>/<y> as /100th of the value |
* <length> represents the length to rightbound the number |
* <pad> = 1 will cause blank spaced to be filled up with zeros e.g. 00.7 instead of .7 |
*/ |
void write_ndigit_number_u_100th (uint8_t x, uint8_t y, uint16_t number, int16_t length, uint8_t pad); |
/** |
* Write only some digits of a signed <number> at <x>/<y> as /10th of the value |
* <length> represents the length to rightbound the number |
* <pad> = 1 will cause blank spaced to be filled up with zeros e.g. 00.7 instead of .7 |
*/ |
void write_ndigit_number_s_10th (uint8_t x, uint8_t y, int16_t number, int16_t length, uint8_t pad, uint8_t mode); |
/** |
* write <seconds> as human readable time at <x>/<y> |
*/ |
void write_time (uint8_t x, uint8_t y, uint16_t seconds); |
/** |
* wirte a <position> at <x>/<y> assuming it is a gps position for long-/latitude |
*/ |
void write_gps_pos (uint8_t x, uint8_t y, int32_t position); |
//------------------------------------------------------------------------------------ |
// Show PKT Baudrate at given position |
// |
void show_baudrate (uint8_t x, uint8_t y, uint8_t Baudrate, uint8_t mode); |
#endif |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/lcd/lcd.zip |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/lipo/lipo.c |
---|
0,0 → 1,152 |
/***************************************************************************** |
* Copyright (C) 2008 Thomas Kaiser, thomas@ft-fanpage.de * |
* Copyright (C) 2009 Peter "woggle" Mack, mac@denich.net * |
* based on the key handling by Peter Dannegger * |
* see www.mikrocontroller.net * |
* Copyright (C) 2011 Christian "Cebra" Brandtner, brandtner@brandtner.net * |
* Copyright (C) 2011 Harald Bongartz * |
* * |
* This program is free software; you can redistribute it and/or modify * |
* it under the terms of the GNU General Public License as published by * |
* the Free Software Foundation; either version 2 of the License. * |
* * |
* This program is distributed in the hope that it will be useful, * |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
* GNU General Public License for more details. * |
* * |
* You should have received a copy of the GNU General Public License * |
* along with this program; if not, write to the * |
* Free Software Foundation, Inc., * |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
* * |
* * |
* Credits to: * |
* Holger Buss & Ingo Busker from mikrokopter.de for the MK project + SVN * |
* http://www.mikrokopter.de * |
* Gregor "killagreg" Stobrawa for his version of the MK code * |
* Thomas Kaiser "thkais" for the original project. See * |
* http://www.ft-fanpage.de/mikrokopter/ * |
* http://forum.mikrokopter.de/topic-4061-1.html * |
* Claas Anders "CaScAdE" Rathje for providing the font and his C-OSD code * |
* http://www.mylifesucks.de/oss/c-osd/ * |
* Harald Bongartz "HaraldB" for providing his Ideas and Code for usibility* |
*****************************************************************************/ |
#include "../cpu.h" |
#include <avr/io.h> |
#include <util/delay.h> |
#include <avr/interrupt.h> |
#include <inttypes.h> |
#include <stdlib.h> |
#include <avr/pgmspace.h> |
#include "../main.h" |
#include "../lcd/lcd.h" |
#include "lipo.h" |
#include "../eeprom/eeprom.h" |
#if defined HWVERSION1_3W || defined HWVERSION3_9 || defined HWVERSION1_2W |
// Global variables |
double accumulator = 0; //!< Accumulated 10-bit samples |
double Vin = 0; //!< 16-bit float number result |
short temp = 0; //!< Temporary variable |
short samples = 0; //!< Number of conversions |
uint16_t volt_avg = 0; |
//! ADC interrupt routine |
ISR (ADC_vect) |
{ |
accumulator += ADCW; |
samples++; |
if(samples>4095) |
{ |
oversampled(); |
} |
} |
//-------------------------------------------------------------- |
// |
void ADC_Init (void) |
{ |
DDRA &= ~(1<<DDA1); // MartinR |
PORTA &= ~(1<<PORTA1); // MartinR |
ADMUX = (0<<REFS1) | (1<<REFS0); // externe 5V Referenzspannung nutzen |
ADMUX = (ADMUX & ~(0x1F)) | (1 & 0x1F); // ADC1 verwenden |
ADCSRA = (1<<ADEN)|(1<<ADIE)|(1<<ADSC)|(1<<ADATE)|(1<<ADPS2)|(1<<ADPS1)|(1<<ADPS0); // Prescaler 128, Freilaufend, Interrupte frei |
} |
/*! Error compensation, Scaling 16-bit result, Rounding up |
, Calculate 16-bit result, Resets variables |
Quelle AVR121: Enhancing ADC resolution by versampling |
*/ |
void oversampled(void) |
{ |
cli(); |
accumulator += Config.Lipo_UOffset; //5150 Offset error compensation |
// accumulator *= 0.9993; // Gain error compensation |
accumulator *= 0.9600; //0.9800 Gain error compensation |
temp=(int)accumulator%64; |
accumulator/=64; // Scaling the answer |
if(temp>=32) |
{ |
accumulator += 1; // Round up |
} |
// Vin = (accumulator/65536)*4.910; // Calculating 16-bit result |
Vin =accumulator/7.5; |
volt_avg = Vin; |
// write_ndigit_number_u(0, 3, Vin, 5, 0,0); |
// write_ndigit_number_u(0, 4, volt_avg, 5, 0,0); |
samples = 0; |
accumulator = 0; |
sei(); |
} |
void show_Lipo(void) |
{ |
uint16_t Balken = 0; |
lcd_rect(103,2,1,3,1); |
if (volt_avg < 320) |
{ |
Balken = 0; |
lcd_frect(106 + Balken-1, 2, 19-Balken, 3, 0); // löschen |
} |
if (Config.PKT_Accutyp == true) //LiPO Akku |
{ |
lcd_rect(104, 0, 23, 7, 1); // Rahmen |
if (volt_avg >= 420) Balken = 19; |
if ((volt_avg > 320) && (volt_avg < 420)) Balken = (volt_avg-320)/5; |
lcd_frect(106 + Balken+1, 2, 19-Balken, 3, 0); // löschen |
} |
if (Config.PKT_Accutyp == false) // LiON Akku |
{ |
lcd_rect(104, 0, 22, 7, 1); // Rahmen |
if (volt_avg >= 410) Balken = 18; |
if ((volt_avg > 320) && (volt_avg < 410)) Balken = ((volt_avg-320)/5); |
lcd_frect(106 + Balken+1, 2, 18-Balken, 3, 0); // löschen |
} |
if (Balken > 0) lcd_frect(106, 2, Balken, 3, 1); // Füllung |
} |
#endif |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/lipo/lipo.h |
---|
0,0 → 1,50 |
/***************************************************************************** |
* Copyright (C) 2008 Thomas Kaiser, thomas@ft-fanpage.de * |
* Copyright (C) 2009 Peter "woggle" Mack, mac@denich.net * |
* based on the key handling by Peter Dannegger * |
* see www.mikrocontroller.net * |
* Copyright (C) 2011 Christian "Cebra" Brandtner, brandtner@brandtner.net * |
* Copyright (C) 2011 Harald Bongartz * |
* * |
* This program is free software; you can redistribute it and/or modify * |
* it under the terms of the GNU General Public License as published by * |
* the Free Software Foundation; either version 2 of the License. * |
* * |
* This program is distributed in the hope that it will be useful, * |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
* GNU General Public License for more details. * |
* * |
* You should have received a copy of the GNU General Public License * |
* along with this program; if not, write to the * |
* Free Software Foundation, Inc., * |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
* * |
* * |
* Credits to: * |
* Holger Buss & Ingo Busker from mikrokopter.de for the MK project + SVN * |
* http://www.mikrokopter.de * |
* Gregor "killagreg" Stobrawa for his version of the MK code * |
* Thomas Kaiser "thkais" for the original project. See * |
* http://www.ft-fanpage.de/mikrokopter/ * |
* http://forum.mikrokopter.de/topic-4061-1.html * |
* Claas Anders "CaScAdE" Rathje for providing the font and his C-OSD code * |
* http://www.mylifesucks.de/oss/c-osd/ * |
* Harald Bongartz "HaraldB" for providing his Ideas and Code for usibility* |
*****************************************************************************/ |
#ifndef _LIPO_H |
#define _LIPO_H |
short samples; //!< Number of conversions |
double Vin; |
double accumulator; |
uint16_t volt_avg; |
void ADC_Init (void); |
void oversampled(void); |
void show_Lipo(void); |
#endif |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/main.c |
---|
0,0 → 1,394 |
/***************************************************************************** |
* Copyright (C) 2008 Thomas Kaiser, thomas@ft-fanpage.de * |
* Copyright (C) 2009 Peter "woggle" Mack, mac@denich.net * |
* Copyright (C) 2011 Christian "Cebra" Brandtner, brandtner@brandtner.net * |
* Copyright (C) 2011 Harald Bongartz * |
* * |
* This program is free software; you can redistribute it and/or modify * |
* it under the terms of the GNU General Public License as published by * |
* the Free Software Foundation; either version 2 of the License. * |
* * |
* This program is distributed in the hope that it will be useful, * |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
* GNU General Public License for more details. * |
* * |
* You should have received a copy of the GNU General Public License * |
* along with this program; if not, write to the * |
* Free Software Foundation, Inc., * |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
* * |
* * |
* Credits to: * |
* Holger Buss & Ingo Busker from mikrokopter.de for the MK project + SVN * |
* http://www.mikrokopter.de * |
* Gregor "killagreg" Stobrawa for his version of the MK code * |
* Thomas Kaiser "thkais" for the original project. See * |
* http://www.ft-fanpage.de/mikrokopter/ * |
* http://forum.mikrokopter.de/topic-4061-1.html * |
* Claas Anders "CaScAdE" Rathje for providing the font and his C-OSD code * |
* http://www.mylifesucks.de/oss/c-osd/ * |
* Harald Bongartz "HaraldB" for providing his Ideas and Code for usibility* |
*****************************************************************************/ |
#include "cpu.h" |
#include <avr/io.h> |
#include <inttypes.h> |
#include <stdlib.h> |
#include <avr/pgmspace.h> |
#include <avr/wdt.h> |
#include <util/delay.h> |
#include <avr/eeprom.h> |
//************************************************************************************ |
// Watchdog integrieren und abschalten, wird für Bootloader benötigt |
// !!muss hier stehen bleiben!! |
//-------------------------------------------------------------- |
void wdt_init(void) __attribute__((naked)) __attribute__((section(".init1"))); |
//-------------------------------------------------------------- |
void wdt_init(void) |
{ |
MCUSR = 0; |
wdt_disable(); |
return; |
} |
//************************************************************************************ |
// erst ab hier weitere #includes |
#include "lipo/lipo.h" |
#include "main.h" |
#include "lcd/lcd.h" |
#include "uart/usart.h" |
#include "uart/uart1.h" |
#include "mk-data-structs.h" |
#include "parameter.h" |
#include "menu.h" |
#include "display.h" |
#include "timer/timer.h" |
#include "eeprom/eeprom.h" |
#include "wi232/Wi232.h" |
#include "motortest/twimaster.h" |
#include "messages.h" |
//#define MTEST 0 // Menu Test (skip FC/NC detection) |
Version_t *version; |
volatile uint8_t mode = 0; |
uint8_t hardware = 0; |
uint8_t current_hardware = 0; |
mk_param_struct_t *mk_param_struct; |
uint8_t searchMK(void) |
{ |
uint8_t timeout; |
uint8_t val =0; |
uint8_t spalte =0; |
uint8_t RetVal; |
// switch to NC |
USART_putc (0x1b); |
USART_putc (0x1b); |
USART_putc (0x55); |
USART_putc (0xaa); |
USART_putc (0x00); |
mode = 'V'; |
//#ifndef DEBUG |
do |
{ |
timeout = 50; |
lcd_cls(); |
lcd_puts_at(0, 4, strGet(START_SEARCHFC), 0); |
lcd_puts_at(12, 7, strGet(ENDE), 0); |
while (!rxd_buffer_locked && timeout) |
{ |
SendOutData('v', ADDRESS_ANY, 0); |
timer = 20; |
while (timer > 0); |
timeout--; |
if (spalte <= 20) |
{ |
lcd_printp_at (spalte,6,PSTR("?"),0); |
spalte++; |
} |
else |
{ |
lcd_cls_line (0,6,21); |
spalte=0; |
} |
if (get_key_press (1 << KEY_ESC)) |
{ |
get_key_press(KEY_ALL); |
for (;;) |
{ |
Config.Debug = 0; |
hardware = NO; |
main_menu (); |
} |
} |
} |
if(timeout == 0) |
{ |
// lcd_printp_at (0,5,PSTR("FC nicht gefunden!"), 0); |
lcd_puts_at(0, 5, strGet(START_FCNOTFOUND), 0); |
timer = 90; |
RetVal = false; |
while (timer > 0); |
} |
} |
while(timeout == 0); |
if (timeout != 0) |
Decode64 (); |
version = (Version_t *) pRxData; |
if (Config.PKT_StartInfo == true) |
{ |
lcd_cls (); |
lcd_puts_at(0, 0, strGet(START_FCFOUND), 0); |
lcd_puts_at(0, 1, strGet(START_FCFOUND1), 0); |
} |
if ((rxd_buffer[1] - 'a') == ADDRESS_FC) |
{ |
if (Config.PKT_StartInfo == true) |
{ |
lcd_puts_at(0, 2, strGet(START_FCFOUND2), 0); |
} |
hardware = FC; |
current_hardware = hardware; |
RetVal = true; |
} |
else if ((rxd_buffer[1] - 'a') == ADDRESS_NC) |
{ |
if (Config.PKT_StartInfo == true) |
{ |
// lcd_printp (PSTR("Navi-Ctrl\r\n"), 0); |
lcd_puts_at(0, 2, strGet(START_FCFOUND3), 0); |
} |
hardware = NC; |
current_hardware = hardware; |
RetVal = true; |
} |
if (Config.PKT_StartInfo == true) |
{ |
// lcd_printp (PSTR("Version: "), 0); |
lcd_puts_at(0, 3, strGet(START_VERSIONCHECK), 0); |
lcd_write_number_u_at (9, 3, version->SWMajor); |
lcd_printp_at (10,3,PSTR("."), 0); |
lcd_write_number_u_at (11,3,version->SWMinor); |
lcd_write_number_u_at (14,3, version->SWPatch + 'a'); |
_delay_ms(2500); |
} |
SwitchToFC(); |
//#else |
// if (PKT_StartInfo == true) |
// { |
// lcd_cls (); |
// lcd_printp (PSTR("PKT-Test DEBUG\r\n"), 0); |
// _delay_ms(1500); |
// } |
// |
//#endif |
#ifndef IgnoreFCVersion |
// EEprom Version / Struktur prüfen |
// val = load_setting(1); // Parameterset 1 holen |
val = load_setting(0xff); // aktuelles Parameterset holen |
if (!Config.Debug) |
{ |
if (mk_param_struct->Revision != EEProm_Version) |
{ |
lcd_cls (); |
lcd_printp_at (0, 0, PSTR("EEPromRev "), 0); |
lcd_write_number_u (EEProm_Version); |
lcd_puts_at(13, 0, strGet(START_VERSIONCHECK1), 0); |
// lcd_printp (PSTR("erwartet\r\n"), 0); |
lcd_printp_at (0, 2, PSTR("EEPromRev "), 0); |
lcd_write_number_u (mk_param_struct->Revision); |
lcd_puts_at(13, 2, strGet(START_VERSIONCHECK2), 0); |
// lcd_printp (PSTR(" gefunden\r\n"), 0); |
// lcd_printp (PSTR("PKT-Tool nur mit\r\n"), 0); |
// lcd_printp (PSTR("FC Software "), 0); |
lcd_puts_at(0, 4, strGet(START_VERSIONCHECK3), 0); |
lcd_puts_at(0, 5, strGet(START_VERSIONCHECK4), 0); |
// lcd_printp (PSTR(FC_Version), 0); |
lcd_printp_at (12, 5, PSTR(FC_Version), 0); |
// lcd_printp (PSTR("\r\nkompatibel"), 0); |
lcd_puts_at(0, 6, strGet(START_VERSIONCHECK5), 0); |
hardware = NO; |
set_beep ( 1500, 0x0040, BeepNormal); |
_delay_ms(4000); |
} |
} |
#endif |
mode = 0; |
rxd_buffer_locked = FALSE; |
timer = 50; |
while (timer > 0); |
return RetVal; |
} |
//-------------------------------------------------------------- |
int main (void) |
{ |
InitHWPorts(); // Hardwareanhängige Ports konfigurieren |
// dafür wird je nach Hardware die HAL_HWxxx verwendet |
// Define dazu in der main.h |
hardware = NO; |
current_hardware = 0; |
if (Config.PKT_StartInfo == true) |
{ |
lcd_cls (); |
lcd_puts_at(0, 0, strGet(START_MSG1), 0); |
lcd_puts_at(0, 1, strGet(START_MSG2), 0); |
lcd_puts_at(0, 3, strGet(GNU_GPL), 0); |
#ifdef HWVERSION1_2 |
// lcd_printp_at (0,4,PSTR("Hardware 1.2"), 0); |
// lcd_printp_at (0,5,PSTR("ATmega 644"), 0); |
lcd_puts_at(0, 4, strGet(HW12), 0); |
lcd_puts_at(0, 5, strGet(ATMEGA644), 0); |
#endif |
#ifdef HWVERSION1_2W |
// lcd_printp_at (0,4,PSTR("Hardware 1.2W"), 0); |
// lcd_printp_at (0,5,PSTR("ATmega 644"), 0); |
lcd_puts_at(0, 4, strGet(HW12W), 0); |
lcd_puts_at(0, 5, strGet(ATMEGA644), 0); |
#endif |
#ifdef HWVERSION1_3 |
// lcd_printp_at (0,4,PSTR("Hardware 1.3"), 0); |
// lcd_printp_at (0,5,PSTR("ATmega 644P"), 0); |
lcd_puts_at(0, 4, strGet(HW13), 0); |
lcd_puts_at(0, 5, strGet(ATMEGA644P), 0); |
#endif |
#ifdef HWVERSION1_3W |
// lcd_printp_at (0,4,PSTR("Hardware 1.3W"), 0); |
// lcd_printp_at (0,5,PSTR("ATmega 644P"), 0); |
lcd_puts_at(0, 4, strGet(HW13W), 0); |
lcd_puts_at(0, 5, strGet(ATMEGA644P), 0); |
#endif |
#ifdef HWVERSION3_9 |
lcd_puts_at(0, 4, strGet(HW39), 0); |
lcd_puts_at(0, 5, strGet(ATMEGA1284P), 0); |
#endif |
_delay_ms(1500); |
} |
//#ifndef DEBUG |
if (Config.LastLongitude>0x00000000 && Config.LastLatitude>0x00000000) |
{ |
lcd_cls (); |
// lcd_printp_at (0, 4, PSTR(" Letzte Position "), 2); |
// lcd_printp_at (0, 5, PSTR(" Breitengr Längengr "), 2); |
// lcd_printp_at (0, 7, PSTR("löschen weiter"), 0); |
lcd_puts_at(0, 0, strGet(START_LASTPOS), 2); |
lcd_puts_at(0, 1, strGet(START_LASTPOS3), 2); |
lcd_puts_at(0, 2, strGet(START_LASTPOS1), 2); |
lcd_puts_at(0, 7, strGet(START_LASTPOS2), 0); |
write_ndigit_number_u (1, 4, (uint16_t)(Config.LastLatitude/10000000), 2, 0,0); |
lcd_printp_at (3, 4, PSTR("."), 0); |
write_ndigit_number_u (4, 4, (uint16_t)((Config.LastLatitude/1000) % 10000), 4, 1,0); |
write_ndigit_number_u (8, 4, (uint16_t)((Config.LastLatitude/10) % 100), 2, 1,0); |
write_ndigit_number_u (12, 4, (uint16_t)(Config.LastLongitude/10000000), 2, 0,0); |
lcd_printp_at (14, 4, PSTR("."), 0); |
write_ndigit_number_u (15, 4, (uint16_t)((Config.LastLongitude/1000) % 10000), 4, 1,0); |
write_ndigit_number_u (19, 4, (uint16_t)((Config.LastLongitude/10) % 100), 2, 1,0); |
for (;;) |
{ |
if (get_key_press (1 << KEY_MINUS)) |
{ |
WriteLastPosition(0x00000000,0x00000000); // Löschen |
lcd_frect (0, (8*4), 128, 8, 0); // Zeile löschen (x, y, l, h, in Pixel) |
lcd_frect (0, (8*5), 128, 8, 0); |
// lcd_printp_at (0,5,PSTR(" gelöscht "), 0); |
lcd_puts_at(0, 5, strGet(START_LASTPOSDEL), 0); |
lcd_cls_line (0, 6, 21); |
lcd_cls_line (0, 7, 21); |
_delay_ms(1000); |
break; |
} |
if (get_key_press (1 << KEY_ENTER)) |
{ |
lcd_cls_line (0, 4, 21); |
lcd_cls_line (0, 5, 21); |
lcd_cls_line (0, 6, 21); |
lcd_cls_line (0, 7, 21); |
break; |
} |
} |
} |
//#endif |
searchMK(); // MK suchen |
for (;;) |
{ |
main_menu (); |
} |
} |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/main.h |
---|
0,0 → 1,119 |
/***************************************************************************** |
* Copyright (C) 2008 Thomas Kaiser, thomas@ft-fanpage.de * |
* Copyright (C) 2009 Peter "woggle" Mack, mac@denich.net * |
* Copyright (C) 2012 Christian "Cebra" Brandtner, brandtner@brandtner.net * |
* Copyright (C) 2012 Harald Bongartz * |
* * |
* This program is free software; you can redistribute it and/or modify * |
* it under the terms of the GNU General Public License as published by * |
* the Free Software Foundation; either version 2 of the License. * |
* * |
* This program is distributed in the hope that it will be useful, * |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
* GNU General Public License for more details. * |
* * |
* You should have received a copy of the GNU General Public License * |
* along with this program; if not, write to the * |
* Free Software Foundation, Inc., * |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
* * |
* * |
* Credits to: * |
* Holger Buss & Ingo Busker from mikrokopter.de for the MK project + SVN * |
* http://www.mikrokopter.de * |
* Gregor "killagreg" Stobrawa for his version of the MK code * |
* Thomas Kaiser "thkais" for the original project. See * |
* http://www.ft-fanpage.de/mikrokopter/ * |
* http://forum.mikrokopter.de/topic-4061-1.html * |
* Claas Anders "CaScAdE" Rathje for providing the font and his C-OSD code * |
* http://www.mylifesucks.de/oss/c-osd/ * |
* Harald Bongartz "HaraldB" for providing his Ideas and Code for usibility* |
*****************************************************************************/ |
/** |
* @Author Cebra |
* |
* ${tags} |
*/ |
//** |
// * |
// * |
// * |
// |
/* |
* File name: $HeadURL: http://mikrokopter.de/mikrosvn/Projects/Transportables_Koptertool/branch/GPL_PKT_V3_5_8a_FC086/main.h $ |
* Revision: $Revision: 1496 $ |
* Last modified: $Date: 2012-01-15 21:31:25 +0100 (So, 15 Jan 2012) $ |
* Last modified by: $Author: $ |
* $Id: main.h 1496 2012-01-15 20:31:25Z $ |
*/ |
#ifndef _MAIN_H |
#define _MAIN_H |
//#define MKVERSION088n |
#define MKVERSION090b |
// Version der Software |
#define PKTSWVersion "3.6.7f" // PKT Version |
//#define IgnoreFCVersion |
//#define DEBUG |
//#define analognames // Anzeige Analognames |
// Fusebits für Hardware 1.2 D7 DC FC |
// Fusebits für Hardware 1.3 D7 DC FC |
// Fusebits für Hardware 3.x D7 DC FC |
// avrdude -pm1284p -cavr109 -P/dev/ttyUSB1 -b115200 -V -Uflash:w:Dateiname.hex:a |
// hier die entsprechende Hardwareversion der Leiterplatte einstellen |
//#define HWVERSION1_2 // Hardware sebseb7 |
//#define HWVERSION1_2W // Hardware sebseb7 mit Wi232 Support |
//#define HWVERSION1_3 // Hardware sebseb7 |
//#define HWVERSION1_3W // Hardware sebseb7 mit Wi232 Support |
#define HWVERSION3_9 // Hardware Cebra Oktober 2011 ATmega1284P |
#if defined HWVERSION1_2W || defined HWVERSION1_2 |
#include "HAL_HW1_2.h" |
#endif |
#if defined HWVERSION1_3W || defined HWVERSION1_3 |
#include "HAL_HW1_3.h" |
#endif |
#ifdef HWVERSION3_9 |
#include "HAL_HW3_9.h" |
#endif |
#define NO 0 |
#define NC 1 |
#define FC 2 |
#define MK3MAG 3 |
#define MKGPS 4 |
#define Wi232 5 |
#define ENABLE_PWM |
// Baud Rate |
#define Baud_2400 0 |
#define Baud_9600 1 |
#define Baud_19200 2 |
#define Baud_38400 3 |
#define Baud_57600 4 |
#define Baud_115200 5 |
#define Baud_4800 6 |
extern volatile uint8_t mode; |
extern uint8_t hardware; |
extern uint8_t current_hardware; |
extern uint8_t searchMK(void); |
#endif |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/menu.c |
---|
0,0 → 1,778 |
/***************************************************************************** |
* Copyright (C) 2008 Thomas Kaiser, thomas@ft-fanpage.de * |
* Copyright (C) 2009 Peter "woggle" Mack, mac@denich.net * |
* Copyright (C) 2011 Christian "Cebra" Brandtner, brandtner@brandtner.net * |
* Copyright (C) 2011 Harald Bongartz * |
* * |
* This program is free software; you can redistribute it and/or modify * |
* it under the terms of the GNU General Public License as published by * |
* the Free Software Foundation; either version 2 of the License. * |
* * |
* This program is distributed in the hope that it will be useful, * |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
* GNU General Public License for more details. * |
* * |
* You should have received a copy of the GNU General Public License * |
* along with this program; if not, write to the * |
* Free Software Foundation, Inc., * |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
* * |
* * |
* Credits to: * |
* Holger Buss & Ingo Busker from mikrokopter.de for the MK project + SVN * |
* http://www.mikrokopter.de * |
* Gregor "killagreg" Stobrawa for his version of the MK code * |
* Thomas Kaiser "thkais" for the original project. See * |
* http://www.ft-fanpage.de/mikrokopter/ * |
* http://forum.mikrokopter.de/topic-4061-1.html * |
* Claas Anders "CaScAdE" Rathje for providing the font and his C-OSD code * |
* http://www.mylifesucks.de/oss/c-osd/ * |
* Harald Bongartz "HaraldB" for providing his Ideas and Code for usibility* |
*****************************************************************************/ |
//############################################################################ |
//# HISTORY menu.c |
//# |
//# 10.03.2013 Cebra |
//# - add: menu_select, gemeinsame Routine für alle Setupmenüs |
//############################################################################ |
#include "cpu.h" |
#include <avr/io.h> |
#include <inttypes.h> |
#include <stdlib.h> |
#include <avr/pgmspace.h> |
#include <avr/wdt.h> |
#include <util/delay.h> |
#include "main.h" |
#include "lcd/lcd.h" |
#include "parameter.h" |
#include "menu.h" |
#include "display.h" |
#include "debug.h" |
#include "timer/timer.h" |
#include "osd/osd.h" |
#include "motortest/motortest.h" |
#include "gps/gps.h" |
#include "eeprom/eeprom.h" |
#include "setup/setup.h" |
#include "uart/uart1.h" |
#include "mk-data-structs.h" |
#include "wi232/Wi232.h" |
#include "tracking/servo.h" |
#include "tools.h" |
#include "connect.h" |
#include "lipo/lipo.h" |
#include "messages.h" |
#include "bluetooth/bluetooth.h" |
#include "followme/followme.h" |
#include "tracking/ng_servo.h" |
#include "tracking/tracking.h" |
#include "stick/stick.h" |
//// Variablen für die Menüsteuerung |
uint8_t ii = 0; |
uint8_t offset = 0; |
uint8_t size = 0; |
uint8_t dmode = 0; |
uint8_t target_pos = 1; |
uint8_t val; |
#define ITEMS_NC 9 |
const prog_char param_menuitems_nc[ITEMS_NC][NUM_LANG][18]= // zeilen,zeichen+1 |
// German, English, French, Netherlands |
{ |
{"OSD ","OSD ","OSD "}, |
{"MK Display ","MK Display ","MK Display "}, |
{"Tracking ","Tracking ","Tracking "}, |
{"Parameter \x1d","Parameter \x1d","Parameters \x1d"}, |
{"Debug Data ","Debug Data ","Debug Data "}, |
{"GPS Info ","GPS Info ","GPS Info "}, |
{"Follow Me ","Follow Me ","Follow Me "}, |
{"Joystick ","Joystick ","Joystick "}, |
{"PKT Tools \x1d","PKT Tools \x1d","PKT Tools \x1d"}, |
}; |
#define ITEMS_FC 5 |
const prog_char param_menuitems_fc[ITEMS_FC][NUM_LANG][18]= // zeilen,zeichen+1 |
{ |
{"Joystick ","Joystick ","Joystick "}, // MartinR |
{"MK Display ","MK Display ","MK Display "}, |
{"Parameter \x1d","Parameter \x1d","Parameter \x1d"}, |
{"Debug Data ","Debug Data ","Debug Data "}, |
{"PKT Tools \x1d","PKT Tools \x1d","PKT Tools \x1d"}, |
}; |
#define ITEMS_NO 6 |
const prog_char param_menuitems_no[ITEMS_NO][NUM_LANG][18]= // zeilen,zeichen+1 |
{ |
{"Suche Mikrokopter","search Mikrokopt ","search Mikrokopt "}, |
{"BL-Ctrl. Tester ","BL-Ctrl. Tester ","BL-Ctrl. Tester "}, |
{"PC BT > Kopter ","PC BT > Kopter ","PC BT > Kopter "}, |
{"PC USB > Kopter ","PC USB > Kopter ","PC USB > Kopter "}, |
{"PKT Setup \x1d","PKT Setup \x1d","PKT Setup \x1d"}, |
{"PKT Version ","PKT Version ","PKT Versie "}, |
}; |
#define ITEMS_CR 12 |
const prog_char param_copyright[ITEMS_CR][22]= // zeilen,zeichen+1 |
{ |
" ", |
"(C) GNU GPL License ", |
" NO WARRANTY ", |
" ", |
"2008 Thomas Kaiser ", |
"2009-2010 Peter Mack ", |
"2010 Sebastian Boehm ", |
"2012 Chr. Brandtner &", |
" Harald Bongartz ", |
"2012 gebad ", |
"2012 Martin Runkel ", |
"2013 Oliver Gemesi " |
}; |
uint8_t menu_select(const char menuitem[][NUM_LANG][18],uint8_t size, uint8_t targetpos) |
{ |
ii = 0; |
offset = 0; |
dmode = 0; |
uint8_t target_pos = targetpos; |
target_pos = targetpos; |
val = 0; |
while(2) |
{ |
ii = 0; |
if(offset > 0) |
{ |
lcd_printp_at(1,1, PSTR("\x12"), 0); |
} |
for(ii = 0;ii < 6 ; ii++) |
{ |
if((ii+offset) < size) |
{ |
lcd_printp_at(3,ii+1,menuitem[ii+offset][Config.DisplayLanguage], 0); |
} |
if((ii == 5)&&(ii+offset < (size-1))) |
{ |
lcd_printp_at(1,6, PSTR("\x13"), 0); |
} |
} |
if(dmode == 0) |
{ |
if(offset == 0) |
{ |
if(size > 6) |
{ |
val = menu_choose2 (1, 5, target_pos,0,1); |
} |
else |
{ |
val = menu_choose2 (1, size, target_pos,0,0); |
} |
} |
else |
{ |
val = menu_choose2 (2, 5, target_pos,1,1); |
} |
} |
if(dmode == 1) |
{ |
if(offset+7 > size) |
{ |
val = menu_choose2 (2, 6, target_pos,1,0); |
} |
else |
{ |
val = menu_choose2 (2, 5, target_pos,1,1); |
} |
} |
if(val == 254) |
{ |
offset++; |
dmode = 1; |
target_pos = 5; |
} |
else if(val == 253) |
{ |
offset--; |
dmode = 0; |
target_pos = 2; |
} |
else if(val == 255) |
{ |
break; |
} |
else |
{ |
break; |
} |
} |
return val; |
} |
//-------------------------------------------------------------- |
// print cursor |
void menu_set_cursor (uint8_t before, uint8_t line, uint8_t pos) |
{ |
lcd_printp_at (pos, before, PSTR(" "), 0); |
lcd_printp_at (pos, line, PSTR("\x1d"), 0); |
} |
// F�r Seting-Auswahl ------------------------------------------ |
// |
uint8_t menu_choose (uint8_t min, uint8_t max, uint8_t pos, uint8_t start) |
{ |
uint8_t line = start; |
uint8_t before = start; |
uint8_t k; |
menu_set_cursor (line, line, pos); |
do |
{ |
if (get_key_press (1 << KEY_PLUS) | get_key_long_rpt_sp ((1 << KEY_PLUS), 1)) |
{ |
if (line < max) |
line ++; |
else |
line = max; |
// line = min; // Wenn wiederholen soll |
} |
if (get_key_press (1 << KEY_MINUS) | get_key_long_rpt_sp ((1 << KEY_MINUS), 1)) |
{ |
if (line > min) |
line --; |
else |
line = min; |
// line = max; // Wenn wiederholen soll |
} |
if (line != before) |
{ |
menu_set_cursor (before, line, pos); |
before = line; |
} |
} |
while (!(k = get_key_press ((1 << KEY_ENTER) | (1 << KEY_ESC)))); |
if (k & (1 << KEY_ESC)) |
line = 255; |
return line; |
} |
// F�r Setup und Parameter ------------------------------------------ |
// |
uint8_t menu_choose2 (uint8_t min, uint8_t max, uint8_t start, uint8_t return_at_start, uint8_t return_at_end) |
{ |
uint8_t pos = 1; |
uint8_t line = start; |
uint8_t before = start; |
uint8_t k; |
menu_set_cursor (line, line, pos); |
do |
{ |
if (get_key_press (1 << KEY_PLUS) | get_key_long_rpt_sp ((1 << KEY_PLUS), 1)) |
{ |
if (line < max) |
line ++; |
else |
{ |
if(return_at_end == 1) |
return 254; |
else |
line = max; |
// line = min; // Wenn wiederholen soll |
} |
} |
if (get_key_press (1 << KEY_MINUS) | get_key_long_rpt_sp ((1 << KEY_MINUS), 1)) |
{ |
if (line > min) |
line --; |
else |
{ |
if(return_at_start == 1) |
return 253; |
else |
line = min; |
// line = max; // Wenn wiederholen soll |
} |
} |
if (line != before) |
{ |
menu_set_cursor (before, line, pos); |
before = line; |
} |
} |
while (!(k = get_key_press ((1 << KEY_ENTER) | (1 << KEY_ESC)))); |
if (k & (1 << KEY_ESC)) |
line = 255; |
return line; |
} |
// F�r das Hauptmenue ------------------------------------------ |
// |
uint8_t menu_choose3 (uint8_t min, uint8_t max,uint8_t start, uint8_t return_at_start, uint8_t return_at_end) |
{ |
uint8_t pos = 1; |
uint8_t line = start; |
uint8_t before = start; |
menu_set_cursor (line, line, pos); |
do |
{ |
if (get_key_press (1 << KEY_PLUS) | get_key_long_rpt_sp ((1 << KEY_PLUS), 1)) |
{ |
if (line < max) |
line ++; |
else |
{ |
if(return_at_end == 1) |
return 254; |
else |
line = max; |
// line = min; // Wenn wiederholen soll |
} |
} |
if (get_key_press (1 << KEY_MINUS) | get_key_long_rpt_sp ((1 << KEY_MINUS), 1)) |
{ |
if (line > min) |
line --; |
else |
{ |
if(return_at_start == 1) |
return 253; |
else |
line = min; |
// line = max; // Wenn wiederholen soll |
} |
} |
if (get_key_long (1 << KEY_ESC)) |
{ |
get_key_press(KEY_ALL); |
return 250; |
} |
if(get_key_long (1 << KEY_ENTER)) |
{ |
get_key_press(KEY_ALL); |
return 251; |
} |
if (get_key_short (1 << KEY_ESC)) |
{ |
get_key_press(KEY_ALL); |
return 252; |
} |
if (line != before) |
{ |
menu_set_cursor (before, line, pos); |
before = line; |
} |
#ifdef HWVERSION3_9 |
show_Lipo(); |
#endif |
} |
while (!(get_key_short (1 << KEY_ENTER))); |
return line; |
} |
//-------------------------------------------------------------- |
// |
void main_menu (void) |
{ |
uint8_t ii = 0; |
uint8_t offset = 0; |
uint8_t size = 0; |
uint8_t Save_hardware = 0; |
uint8_t dmode = 0; |
uint8_t target_pos = 1; |
uint8_t val =0; |
Save_hardware = hardware; |
get_key_press(KEY_ALL); |
while(1) |
{ |
if (Config.Debug==1) |
hardware = NC; |
if (Config.Debug==0) |
hardware = Save_hardware; |
if(hardware == NO) |
size = ITEMS_NO ; |
if(hardware == NC) |
size = ITEMS_NC ; |
if(hardware == FC) |
size = ITEMS_FC ; |
lcd_cls (); |
lcd_printp_at (0, 0, PSTR("PKT-Tool FC "), 2); |
lcd_printp_at (12, 0, PSTR(FC_Version), 2); |
lcd_puts_at(0, 7, strGet(KEYLINE1), 0); |
lcd_puts_at(12, 7, strGet(OFF), 0); |
while(2) |
{ |
ii = 0; |
if(offset > 0) |
lcd_printp_at(1,1, PSTR("\x12"), 0); |
for(ii = 0;ii < 6 ; ii++) |
{ |
if((ii+offset) < size) |
{ |
if(hardware == NC) |
lcd_printp_at(3,ii+1,param_menuitems_nc[ii+offset][Config.DisplayLanguage], 0); |
else if(hardware == FC) |
lcd_printp_at(3,ii+1,param_menuitems_fc[ii+offset][Config.DisplayLanguage], 0); |
else |
lcd_printp_at(3,ii+1,param_menuitems_no[ii+offset][Config.DisplayLanguage], 0); |
} |
if((ii == 5)&&(ii+offset < (size-1))) |
lcd_printp_at(1,6, PSTR("\x13"), 0); |
show_Lipo(); |
} |
if(dmode == 0) |
{ |
if(offset == 0) |
{ |
if(size > 6) |
val = menu_choose3 (1, 5, target_pos,0,1); //menu_choose3 (min, max, start, return_at_start, return_at_end) |
else |
val = menu_choose3 (1, size, target_pos,0,0); |
} |
else |
val = menu_choose3 (2, 5, target_pos,1,1); |
} |
if(dmode == 1) |
{ |
if(offset+7 > size) |
val = menu_choose3 (2, 6, target_pos,1,0); |
else |
val = menu_choose3 (2, 5, target_pos,1,1); |
} |
if(val == 254) |
{ |
offset++; |
dmode = 1; |
target_pos = 5; |
} |
else if(val == 253) |
{ |
offset--; |
dmode = 0; |
target_pos = 2; |
} |
else if(val == 252) |
{ |
lcd_cls(); |
// lcd_printp_at (0, 2, PSTR(" PKT ausschalten?"),0); |
lcd_puts_at(0, 2, strGet(SHUTDOWN), 0); |
// lcd_printp_at (12, 7, PSTR("Nein Ja"),0); |
lcd_puts_at(12, 7, strGet(YESNO), 0); |
while(1) |
{ |
if (get_key_press (1 << KEY_ENTER)) |
{ |
WriteParameter(); // am Ende alle Parameter sichern |
clr_V_On(); // Spannung abschalten |
} |
if (get_key_short (1 << KEY_ESC)) |
{ |
get_key_press(KEY_ALL); |
lcd_cls(); |
lcd_printp_at (0, 0, PSTR("PKT-Tool FC "), 2); |
lcd_printp_at (12, 0,PSTR(FC_Version), 2); |
// show_Lipo(); |
// lcd_printp_at (0, 7, PSTR(KEY_LINE_1), 0); |
lcd_puts_at(0, 7, strGet(KEYLINE1), 0); |
// lcd_printp_at (12, 7, PSTR("Aus "), 0); |
lcd_puts_at(12, 7, strGet(OFF), 0); |
break; |
} |
} |
} |
else if(val == 251) |
{ |
PC_Fast_Connect(); |
return; |
} |
else if(val == 250) |
{ |
// Test_HB(); |
// Test_Language(); |
return; |
} |
else |
break; |
} |
target_pos = val; |
if(hardware == NC) |
{ |
if((val+offset) == 1 ) |
osd(OSD_Mode); |
if((val+offset) == 2 ) |
display_data(); |
if((val+offset) == 3 ) |
PKT_tracking(); |
if((val+offset) == 4 ) |
edit_parameter(); |
#ifdef HWVERSION3_9 |
if((val+offset) == 5 ) |
#ifdef analognames |
display_debug(); |
#else |
{ |
copy_line(7); |
lcd_printp_at (0, 7, PSTR(" not possible "),0); |
_delay_ms(1000); |
paste_line(7); |
} |
#endif |
if((val+offset) == 6 ) |
gps(); |
#endif |
if((val+offset) == 7 ) |
FollowMe(); |
if((val+offset) == 8 ) |
joystick(); |
if((val+offset) == 9 ) |
PKT_Tools(); |
} |
if(hardware == FC) |
{ |
if((val+offset) == 1 ) |
joystick(); |
if((val+offset) == 2 ) |
display_data(); |
if((val+offset) == 3 ) |
edit_parameter(); |
if((val+offset) == 4 ) |
#ifdef analognames |
display_debug(); |
#else |
{ |
copy_line(7); |
lcd_printp_at (0, 7, PSTR(" not possible "),0); |
_delay_ms(1000); |
paste_line(7); |
} |
#endif |
if((val+offset) == 4 ) |
PKT_Tools(); |
} |
if(hardware == NO) |
{ |
if((val+offset) == 1 ) |
if (searchMK()){ |
Save_hardware = hardware; |
continue; |
} |
if((val+offset) == 2 ) |
motor_test(FC_Mode); |
#ifdef HWVERSION3_9 |
if (Config.U02SV2 == 0) |
{ |
if((val+offset) == 3 ) |
Port_BT2Wi(); |
if((val+offset) == 4 ) |
Port_USB2Wi(); |
} |
else if (Config.U02SV2 == 1) |
{ |
if((val+offset) == 3 ) |
Port_BT2FC(); |
if((val+offset) == 4 ) |
Port_USB2FC(); |
} |
#else |
if((val+offset) == 3 ) |
Show_Error_HW(); |
if((val+offset) == 4 ) |
Show_Error_HW(); |
#endif |
if((val+offset) == 5 ) |
PKT_Setup(); |
if((val+offset) == 6 ) |
Show_Version(); |
} |
} |
} |
//-------------------------------------------------------------- |
// |
void Update_PKT (void) |
{ |
lcd_cls(); |
lcd_printp_at (0, 0, PSTR(" PKT Update "),2); |
lcd_puts_at(0, 1, strGet(UPDATE1), 0); |
lcd_puts_at(0, 2, strGet(UPDATE2), 0); |
lcd_printp_at (0, 3, PSTR("Start avrdude.exe "),0); |
lcd_printp_at (0, 4, PSTR("-pm1284p -cavr109 "),0); |
lcd_printp_at (0, 5, PSTR("-Pcom? -b115200 "),0); |
lcd_printp_at (0, 6, PSTR("-Uflash:w:FILE.hex:a "),0); |
lcd_puts_at(0, 7, strGet(ENDSTART), 0); |
do |
{ |
if (get_key_press (1 << KEY_ESC)) |
{ |
get_key_press(KEY_ALL); |
return; |
} |
} |
while (!(get_key_press (1 << KEY_ENTER))); |
{ |
// start bootloader with Reset, Hold KEY_ENTER*/ |
wdt_enable( WDTO_250MS ); |
while (1) |
{;} |
} |
} |
//-------------------------------------------------------------- |
// |
void Show_Error_HW (void) |
{ |
lcd_cls (); |
lcd_printp_at (0, 2, PSTR(" Mit dieser Hardware"), 0); |
lcd_printp_at (0, 3, PSTR(" nicht möglich!"), 0); |
lcd_printp_at (12, 7, PSTR("Ende"), 0); |
while (!get_key_press (1 << KEY_ESC)); |
get_key_press(KEY_ALL); |
return; |
} |
//-------------------------------------------------------------- |
// |
void Show_Version (void) |
{ |
uint8_t ii = 0; |
uint8_t size = ITEMS_CR; |
uint8_t page = 0; |
lcd_cls (); |
lcd_printp_at (0, 0, PSTR("PKT Tool V. "), 2); |
lcd_printp_at (13,0, PSTR(PKTSWVersion),2); |
lcd_printp_at (0, 1, PSTR(" "), 2); //um die ganze Zeile schwarz zu füllen. |
lcd_puts_at(0, 1, strGet(START_MSG2), 2); |
lcd_puts_at(0, 7, strGet(KEYLINE1), 0); |
while(1) |
{ |
for(ii = 0;ii < 3 ; ii++) |
if((ii + page) < size) |
lcd_printp_at(0,ii + 3,param_copyright[ii + page], 0); |
if (page == 0) |
{ |
lcd_printp_at (0, 2, PSTR(" "), 0); |
lcd_printp_at (0, 6, PSTR("\x13"), 0); |
} |
if (page > 0 && page < (size - 3)) |
{ |
lcd_printp_at (0, 2, PSTR("\x12"), 0); |
lcd_printp_at (0, 6, PSTR("\x13"), 0); |
} |
if (page >= (size - 3)) |
{ |
lcd_printp_at (0, 2, PSTR("\x12"), 0); |
lcd_printp_at (0, 6, PSTR(" "), 0); |
} |
if (get_key_press (1 << KEY_PLUS)) |
if (page < size - 3) |
page++; |
if (get_key_press (1 << KEY_MINUS)) |
if (page > 0) |
page--; |
if (get_key_press (1 << KEY_ESC) || get_key_press (1 << KEY_ENTER)) |
{ |
get_key_press(KEY_ALL); |
return; |
} |
} |
} |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/menu.h |
---|
0,0 → 1,66 |
/***************************************************************************** |
* Copyright (C) 2008 Thomas Kaiser, thomas@ft-fanpage.de * |
* Copyright (C) 2009 Peter "woggle" Mack, mac@denich.net * |
* Copyright (C) 2011 Christian "Cebra" Brandtner, brandtner@brandtner.net * |
* Copyright (C) 2011 Harald Bongartz * |
* * |
* This program is free software; you can redistribute it and/or modify * |
* it under the terms of the GNU General Public License as published by * |
* the Free Software Foundation; either version 2 of the License. * |
* * |
* This program is distributed in the hope that it will be useful, * |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
* GNU General Public License for more details. * |
* * |
* You should have received a copy of the GNU General Public License * |
* along with this program; if not, write to the * |
* Free Software Foundation, Inc., * |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
* * |
* * |
* Credits to: * |
* Holger Buss & Ingo Busker from mikrokopter.de for the MK project + SVN * |
* http://www.mikrokopter.de * |
* Gregor "killagreg" Stobrawa for his version of the MK code * |
* Thomas Kaiser "thkais" for the original project. See * |
* http://www.ft-fanpage.de/mikrokopter/ * |
* http://forum.mikrokopter.de/topic-4061-1.html * |
* Claas Anders "CaScAdE" Rathje for providing the font and his C-OSD code * |
* http://www.mylifesucks.de/oss/c-osd/ * |
* Harald Bongartz "HaraldB" for providing his Ideas and Code for usibility* |
*****************************************************************************/ |
#ifndef MENU_H |
#define MENU_H |
#include "messages.h" |
#define CURSOR_COL 1 // column where the menu cursor is displayed |
#define MENU_LINE 1 // starting line of menu |
#define MENU_COL 3 // column where the menu starts |
#define OSD_Mode 1 // OSD Anzeige als OSD |
#define THREE_D_Mode 3 // OSD Anzeige in 3D Position |
void main_menu (void); |
void Show_Version (void); |
void Show_Error_HW (void); |
void Update_PKT (void); |
void PC_Fast_Connect (void); |
//// Variablen für die Menüsteuerung |
extern uint8_t ii; |
extern uint8_t offset; |
extern uint8_t size; |
extern uint8_t dmode; |
extern uint8_t target_pos; |
extern uint8_t val; |
uint8_t menu_select(const char menuitem[][NUM_LANG][18],uint8_t size, uint8_t targetpos); |
uint8_t menu_choose (uint8_t min, uint8_t max, uint8_t pos, uint8_t start); |
uint8_t menu_choose2 (uint8_t min, uint8_t max, uint8_t start, uint8_t return_at_start, uint8_t return_at_end); |
uint8_t menu_choose3 (uint8_t min, uint8_t max, uint8_t start, uint8_t return_at_start, uint8_t return_at_end); |
#endif |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/messages.c |
---|
0,0 → 1,2204 |
/**************************************************************************************** |
* Copyright (C) 2011 Christian "Cebra" Brandtner, brandtner@brandtner.net * |
* * |
* This program is free software; you can redistribute it and/or modify * |
* it under the terms of the GNU General Public License as published by * |
* the Free Software Foundation; either version 2 of the License. * |
* * |
* This program is distributed in the hope that it will be useful, * |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
* GNU General Public License for more details. * |
* * |
* You should have received a copy of the GNU General Public License * |
* along with this program; if not, write to the * |
* Free Software Foundation, Inc., * |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
* * |
* * |
* Languagesupport: * |
* http://www.netrino.com/Embedded-Systems/How-To/Firmware-Internationalization * |
* Nigel Jones * |
****************************************************************************************/ |
#include "cpu.h" |
#include <avr/io.h> |
#include <inttypes.h> |
#include <stdlib.h> |
#include <avr/pgmspace.h> |
#include <avr/wdt.h> |
#include <util/delay.h> |
#include "main.h" |
#include "lcd/lcd.h" |
#include "timer/timer.h" |
#include "eeprom/eeprom.h" |
#include "messages.h" |
typedef enum |
{ |
GERMAN, |
ENGLISH, |
NETHERLAND, |
LAST_LANGUAGE, |
} LANGUAGE; |
typedef struct PROGMEM |
{ |
/* |
* Maximum length |
*/ |
int const len; |
/* |
* Array of pointers to language-specific string |
*/ |
char const * const text[LAST_LANGUAGE]; |
} STRING ; |
//-------------------------------------------------------------------------------------------------------------------- |
// Typdefinitionen für alle verwendeten Strings, LAST_STR muss am Ende stehen bleiben |
//typedef enum |
//TESTSTRING, KEYLINE1, KEYLINE2, KEYLINE3, KEYLINE4, KEYLINE5, BOOT1, BOOT2, BOOT_WI1, BOOT_WI2, BOOT_SV, START_MSG1, START_MSG2, GNU_GPL, ATMEGA644, |
//ATMEGA644P, ATMEGA1284P, HW12, HW12W, HW13, HW13W, HW39, START_LASTPOS, START_LASTPOS1, START_LASTPOS2, START_LASTPOS3, START_LASTPOSDEL, |
//START_SEARCHFC, ENDE, OK, FEHLER, AKTIV, START_FCNOTFOUND, START_FCFOUND, START_FCFOUND1, START_FCFOUND2, START_FCFOUND3, START_VERSIONCHECK, |
//START_VERSIONCHECK1, START_VERSIONCHECK2, START_VERSIONCHECK3, START_VERSIONCHECK4, START_VERSIONCHECK5, ON, OFF, ESC, SHUTDOWN, YESNO, |
//UPDATE1, UPDATE2, ENDSTART, TOOLS1, CONNECT1, CONNECT2, CONNECT4, CONNECT5, CONNECT6, CONNECT7, CONNECT8, CONNECT9, CONNECT10, CONNECT11, CONNECT12, |
//CONNECT13, CONNECT14, CONNECT15, CONNECT16, CONNECT17, CONNECT18, CONNECT19, CONNECT20, CONNECT21, CONNECT22, CONNECT23, CONNECT24, CONNECT25, |
//CONNECT26, CONNECT27, CONNECT28, CONNECT29, CONNECT30, CONNECT31, KABEL, SLAVE, NORMAL, REVERSE, ENDOK, EEPROM1, EEPROM2, DEUTSCH, ENGLISCH, FRANCE, |
//NETHERL, DISPLAY1, DISPLAY2, DISPLAY3, DISPLAY4, DISPLAY5, DISPLAY6, DISPLAY7, DISPLAY8, DISPLAY9, DEBUGPKT, WITXRX, WINETWG, WINETWM, WITIMEOUT, |
//WIUART, WI2321, WI2322, WI2323, YES, NOO, BT1, BT2, BT3, BT4, LIPO1, LIPO2, LIPO3, LIPO4, LIPO5, LIPO6, LOWBAT, OSD_3D_V, OSD_3D_H, OSD_3D_L, |
//OSD_3D_R, OSD_3D_NICK, OSD_3D_ROLL, OSD_3D_COMPASS, OSD_ERROR, OSD_POS1, OSD_POS2, PARA_SETTINGS, PARA_CHANGE, PARA_AKTIVI, PARA_AKTIV, |
//PARA_SAVESETT, PARA_SETTSAVED, PARA_COPY, PARA_FROMTO, PARA_ENDE, PARA_COPYQ, PARA_COPYACTIV, PARA_CHANGESETT, PARA_SELECT, PARA_SEITE, |
//PARA_SELSETT, GPS1, GPS2, GPS3, STATS_ITEM_0, STATS_ITEM_1, STATS_ITEM_2, STATS_ITEM_3, STATS_ITEM_4, STATS_ITEM_5, STATS_ITEM_6, STATS_ITEM_7, |
//STATS_ITEM_8, ONLY_NC, NO_SETTINGS, OSD_ALTI_0, OSD_ALTI_1, OSD_VARIO_0, OSD_VARIO_1, OSD_CARE_FREE_0, OSD_CARE_FREE_1, OSD_LED0, OSD_LED1, OSD_LED2, |
//OSD_NAVI_MODE_0, OSD_NAVI_MODE_1, OSD_NAVI_MODE_2, OSD_FLAGS_0, OSD_FLAGS_1, OSD_FLAGS_2, OSD_FLAGS_3, OSD_FLAGS_4, OSD_FLAGS_5, OSD_FLAGS_6, |
//OSD_Screen, OSD_Invert_Out, OSD_LED_Form, OSD_Send_OSD, LAST_STR, |
static const STRING strings[LAST_STR] PROGMEM = |
{ |
{ /*TESTSTRING*/ |
21, |
{ |
"Not format hardisk C?", /* German */ |
"Not format hardisk C?", /* English*/ |
"Not format hardisk C?", /* Dutch */ |
} |
}, |
{ /*KEYLINE1*/ |
21, |
{ |
" \x1a \x1b Ende OK", /* German */ |
" \x1a \x1b end OK", /* English*/ |
" \x1a \x1b Einde OK", /* Dutch */ |
} |
}, |
{ /*KEYLINE2*/ |
21, |
{ |
" \x18 \x19 Ende OK", /* German */ |
" \x18 \x19 end OK", /* English*/ |
" \x18 \x19 Einde OK", /* Dutch */ |
} |
}, |
{ /*KEYLINE3*/ |
21, |
{ |
" \x18 \x19 Ende ", /* German */ |
" \x18 \x19 end ", /* English*/ |
" \x18 \x19 Einde", /* Dutch */ |
} |
}, |
{ /*KEYLINE4*/ |
21, |
{ |
"Ende OK", /* German */ |
"end OK", /* English*/ |
"Einde OK", /* Dutch */ |
} |
}, |
{ /*KEYLINE5*/ |
21, |
{ |
"Ende Info", /* German */ |
"end info", /* English*/ |
"Eind Info", /* Dutch */ |
} |
}, |
{ /*BOOT1*/ |
21, |
{ |
"Taste 1 Sekunde", /* German */ |
"Keep the button", /* English*/ |
"Houd de knop ", /* Dutch */ |
} |
}, |
{ /* BOOT2*/ |
21, |
{ |
"lang festhalten.", /* German */ |
"pressed for 1 second", /* English*/ |
"1 seconde ingedrukt.", /* Dutch */ |
} |
}, |
{ /*BOOT_WI1*/ |
21, |
{ |
"Verbindung zum MK ist", /* German */ |
"Connection to MK is", /* English*/ |
"Verbinding met MK is", /* Dutch */ |
} |
}, |
{ /* BOOT_WI2*/ |
21, |
{ |
"auf Wi232 eingestellt", /* German */ |
"set to Wi232", /* English*/ |
"ingesteld op Wi232", /* Dutch */ |
} |
}, |
{ /*BOOTSV1*/ |
21, |
{ |
"auf Kabel eingestellt", /* German */ |
"set to kabel on SV2", /* English*/ |
"via kabelverbinding", /* Dutch */ |
} |
}, |
{ /*START_MSG1 */ |
21, |
{ |
"Portables Kopter Tool", /* German */ |
"Portable Kopter Tool ", /* English*/ |
"Portable Kopter Tool ", /* Dutch */ |
} |
}, |
{ /*START_MSG2 */ |
21, |
{ |
"für FC Ver "FC_Version, /* German */ |
"for FC Ver "FC_Version, /* English*/ |
"Voor FC Ver "FC_Version, /* Dutch */ |
} |
}, |
{ /* GNU/GPL */ |
21, |
{ |
"GNU GPL License", /* German */ |
"GNU GPL License", /* English*/ |
"GNU GPL License", /* Dutch */ |
} |
}, |
{ /**/ |
21, |
{ |
"ATmega 644", /* German */ |
"ATmega 644", /* English*/ |
"ATmega 644", /* Dutch */ |
} |
}, |
{ /**/ |
21, |
{ |
"ATmega 644P", /* German */ |
"ATmega 644P", /* English*/ |
"ATmega 644P", /* Dutch */ |
} |
}, |
{ /**/ |
21, |
{ |
"ATmega 1284P", /* German */ |
"ATmega 1284P", /* English*/ |
"ATmega 1284P", /* Dutch */ |
} |
}, |
{ /**/ |
21, |
{ |
"Hardware 1.2", /* German */ |
"Hardware 1.2", /* English*/ |
"Hardware 1.2", /* Dutch */ |
} |
}, |
{ /**/ |
21, |
{ |
"Hardware 1.2W", /* German */ |
"Hardware 1.2W", /* English*/ |
"Hardware 1.2W", /* Dutch */ |
} |
}, |
{ /**/ |
21, |
{ |
"Hardware 1.3", /* German */ |
"Hardware 1.3", /* English*/ |
"Hardware 1.3", /* Dutch */ |
} |
}, |
{ /**/ |
21, |
{ |
"Hardware 1.3W", /* German */ |
"Hardware 1.3W", /* English*/ |
"Hardware 1.3W", /* Dutch */ |
} |
}, |
{ /**/ |
21, |
{ |
"Hardware 3.9", /* German */ |
"Hardware 3.9", /* English*/ |
"Hardware 3.9", /* Dutch */ |
} |
}, |
{ /*START_LASTPOS*/ |
21, |
{ |
" Letzte Position ", /* German */ |
" last position ", /* English*/ |
" Laatste positie ", /* Dutch */ |
} |
}, |
{ /*START_LASTPOS1*/ |
21, |
{ |
" Breitengr Längengr ", /* German */ |
" latitude longitude ", /* English*/ |
"breedtegr. lengtegr. ", /* Dutch */ |
} |
}, |
{ /*START_LASTPOS2*/ |
21, |
{ |
"löschen weiter", /* German */ |
"delete exit ", /* English*/ |
"wissen verder", /* Dutch */ |
} |
}, |
{ /*START_LASTPOS3*/ |
21, |
{ |
" Google Eingabe ", /* German */ |
" Google Input ", /* English*/ |
" Google Input ", /* Dutch */ |
} |
}, |
{ /*START_LASTPOSDEL*/ |
21, |
{ |
" gelöscht ", /* German */ |
" deleted ", /* English*/ |
" gewist ", /* Dutch */ |
} |
}, |
{ /*START_SEARCHFC*/ |
21, |
{ |
"Suche FC... ", /* German */ |
"searching FC...", /* English*/ |
"zoek FC... ", /* Dutch */ |
} |
}, |
{ /*ENDE*/ |
21, |
{ |
"Ende ", /* German */ |
"end ", /* English*/ |
"Einde", /* Dutch */ |
} |
}, |
{ /*OK*/ |
21, |
{ |
"Ok ", /* German */ |
"ok ", /* English*/ |
"gued", /* Dutch */ |
} |
}, |
{ /*FEHLER*/ |
21, |
{ |
"Fehler ", /* German */ |
"error ", /* English*/ |
"fout ", /* Dutch */ |
} |
}, |
{ /*AKTIV*/ |
21, |
{ |
"aktiv ", /* German */ |
"activ ", /* English*/ |
"actief", /* Dutch */ |
} |
}, |
{ /*START_FCNOTFOUND*/ |
21, |
{ |
"FC nicht gefunden!", /* German */ |
"FC not found!", /* English*/ |
"FC niet gevonden!", /* Dutch */ |
} |
}, |
{ /*START_FCFOUND*/ |
21, |
{ |
"PKT-Tool GNU GPL", /* German */ |
"PKT-Tool GNU GPL", /* English*/ |
"PKT-Tool GNU GPL", /* Dutch */ |
} |
}, |
{ /*START_FCFOUND1*/ |
21, |
{ |
"gefunden: ", /* German */ |
"found: ", /* English*/ |
"gevonden: ", /* Dutch */ |
} |
}, |
{ /*START_FCFOUND2*/ |
21, |
{ |
"Flight-Ctrl", /* German */ |
"Flight-Ctrl", /* English*/ |
"Flight-Ctrl", /* Dutch */ |
} |
}, |
{ /*START_FCFOUND3*/ |
21, |
{ |
"Navi-Ctrl", /* German */ |
"Navi-Ctrl", /* English*/ |
"Navi-Ctrl", /* Dutch */ |
} |
}, |
{ /*START_VERSIONCHECK*/ |
21, |
{ |
"Version: ", /* German */ |
"Version: ", /* English*/ |
"Versie: ", /* Dutch */ |
} |
}, |
{ /*START_VERSIONCHECK1*/ |
21, |
{ |
"erwartet", /* German */ |
"expected", /* English*/ |
"verwacht", /* Dutch */ |
} |
}, |
{ /*START_VERSIONCHECK2*/ |
21, |
{ |
"gefunden", /* German */ |
"found ", /* English*/ |
"gevonden", /* Dutch */ |
} |
}, |
{ /*START_VERSIONCHECK3*/ |
21, |
{ |
"PKT-Tool nur mit", /* German */ |
"PKT-Tool only with", /* English*/ |
"PKT-Tool alleen met", /* Dutch */ |
} |
}, |
{ /*START_VERSIONCHECK4*/ |
21, |
{ |
"FC Software ", /* German */ |
"FC Software ", /* English*/ |
"FC Software ", /* Dutch */ |
} |
}, |
{ /*START_VERSIONCHECK5*/ |
21, |
{ |
"kompatibel", /* German */ |
"compatible", /* English*/ |
"compatibel", /* Dutch */ |
} |
}, |
{ /*ON*/ |
21, |
{ |
"Ein ", /* German */ |
"On ", /* English*/ |
"Aan ", /* Dutch */ |
} |
}, |
{ /*AUS*/ |
21, |
{ |
"Aus ", /* German */ |
"Off ", /* English*/ |
"Uit ", /* Dutch */ |
} |
}, |
{ /*ESC*/ |
21, |
{ |
"ESC", /* German */ |
"ESC", /* English*/ |
"ESC", /* Dutch */ |
} |
}, |
{ /*SHUTDOWN*/ |
21, |
{ |
" PKT ausschalten?", /* German */ |
" shutdown PKT ?", /* English*/ |
" PKT uitschakelen ?", /* Dutch */ |
} |
}, |
{ /*YES NO*/ |
21, |
{ |
"Nein Ja", /* German */ |
"no yes", /* English*/ |
"Nee Ja", /* Dutch */ |
} |
}, |
{ /*UPDATE1*/ |
21, |
{ |
"Verbinde PC mit PKT ", /* German */ |
"Connect PC to PKT-USB", /* English*/ |
"Verbind PC met PKT ", /* Dutch */ |
} |
}, |
{ /*UPDATE2*/ |
21, |
{ |
"Drücke 'Start' am PKT", /* German */ |
"Press 'Start' on PKT ", /* English*/ |
"Druk 'Start' op PKT ", /* Dutch */ |
} |
}, |
{ /*ENDSTART*/ |
21, |
{ |
" Ende Start", /* German */ |
" End Start", /* English*/ |
" Einde Start", /* Dutch */ |
} |
}, |
{ /*TOOLS1*/ |
21, |
{ |
" PC-Quick-Verbindung ", /* German */ |
" PC-Quick-Connection ", /* English*/ |
" Snelle PC-verbinding", /* Dutch */ |
} |
}, |
{ /*CONNECT1,*/ |
21, |
{ |
"Verbinde das PKT mit", /* German */ |
"Connect PKT with MK", /* English*/ |
"Verbind PKT ", /* Dutch */ |
} |
}, |
{ /*CONNECT2*/ |
21, |
{ |
"dem MK über:", /* German */ |
" over :", /* English*/ |
" met :", /* Dutch */ |
} |
}, |
{ /*CONNECT4,*/ |
21, |
{ |
"dem MK über: Kabel, ", /* German */ |
"over: Kabel", /* English*/ |
"MK via: kabel ", /* Dutch */ |
} |
}, |
{ /*CONNECT5*/ |
21, |
{ |
"es ist kein Wi.232", /* German */ |
"there is no Wi.232", /* English*/ |
"er is geen wi.232 ", /* Dutch */ |
} |
}, |
{ /*CONNECT6*/ |
21, |
{ |
"Modul eingebaut.", /* German */ |
"built in.", /* English*/ |
"module ingebouwd.", /* Dutch */ |
} |
}, |
{ /*CONNECT7,*/ |
21, |
{ |
"Wenn doch, dann bitte", /* German */ |
"if yes, then first", /* English*/ |
"zo ja, dan aub eerst", /* Dutch */ |
} |
}, |
{ /*CONNECT8*/ |
21, |
{ |
"das Modul zuerst im ", /* German */ |
"activate modul in", /* English*/ |
"de module aktiveren", /* Dutch */ |
} |
}, |
{ /*CONNECT9*/ |
21, |
{ |
"Setupmenü aktivieren.", /* German */ |
"Setupmenu", /* English*/ |
"in het Setupmenu.", /* Dutch */ |
} |
}, |
{ /*CONNECT10*/ |
21, |
{ |
"Sie müssen das PKT", /* German */ |
"You have to", /* English*/ |
"U moet de PKT", /* Dutch */ |
} |
}, |
{ /*CONNECT11*/ |
21, |
{ |
"jetzt neu starten!", /* German */ |
"restart PKT", /* English*/ |
"nu opnieuw starten!", /* Dutch */ |
} |
}, |
{ /*CONNECT12*/ |
21, |
{ |
"Es ist kein BTM-222", /* German */ |
"There is no BTM-222", /* English*/ |
"Er is geen BTM-222", /* Dutch */ |
} |
}, |
{ /*CONNECT13*/ |
21, |
{ |
"Modul eingebaut", /* German */ |
"Modul built in", /* English*/ |
"module ingebouwd.", /* Dutch */ |
} |
}, |
{ /*CONNECT14*/ |
21, |
{ |
" MK-USB Funktion ", /* German */ |
" MK-USB Function ", /* English*/ |
" MK-USB Functie ", /* Dutch */ |
} |
}, |
{ /*CONNECT15*/ |
21, |
{ |
" BT --> Kabel an FC ", /* German */ |
" BT --> Kabel to FC ", /* English*/ |
" BT --> kabel naar FC", /* Dutch */ |
} |
}, |
{ /*CONNECT16*/ |
21, |
{ |
"PC mit BT verb.", /* German */ |
"connect PC with BT", /* English*/ |
"PC via BT verbonden.", /* Dutch */ |
} |
}, |
{ /*CONNECT17*/ |
21, |
{ |
"PKT-Kabel an FC", /* German */ |
"PKT-Kabel to FC", /* English*/ |
"PKT-kabel naar FC", /* Dutch */ |
} |
}, |
{ /*CONNECT18*/ |
21, |
{ |
" BT --> Wi.232 ", /* German */ |
" BT --> Wi.232 ", /* English*/ |
" BT --> Wi.232 ", /* Dutch */ |
} |
}, |
{ /*CONNECT19*/ |
21, |
{ |
"Wi.232 an FC ", /* German */ |
"Wi.232 to FC ", /* English*/ |
"Wi.232 naar FC ", /* Dutch */ |
} |
}, |
{ /*CONNECT20*/ |
21, |
{ |
" USB --> Kabel an FC ", /* German */ |
" USB --> cable to FC ", /* English*/ |
"USB --> kabel naar FC", /* Dutch */ |
} |
}, |
{ /*CONNECT21*/ |
21, |
{ |
"PC mit USB verbinden ", /* German */ |
"connect PC with USB ", /* English*/ |
"Verbind PC met USB ", /* Dutch */ |
} |
}, |
{ /*CONNECT22*/ |
21, |
{ |
" USB --> Wi.232 ", /* German */ |
" USB --> Wi.232 ", /* English*/ |
" USB --> Wi.232 ", /* Dutch */ |
} |
}, |
{ /*CONNECT23*/ |
21, |
{ |
"MK-Tool starten", /* German */ |
"start MK-Tool", /* English*/ |
"start MK-Tool", /* Dutch */ |
} |
}, |
{ /*CONNECT24*/ |
21, |
{ |
" Wi.232 Konfigurieren", /* German */ |
" Wi.232 Configuration", /* English*/ |
" Wi.232 Configuratie ", /* Dutch */ |
} |
}, |
{ /*CONNECT25*/ |
21, |
{ |
"Programm starten. ", /* German */ |
"start program ", /* English*/ |
"start programma.", /* Dutch */ |
} |
}, |
{ /*CONNECT26*/ |
21, |
{ |
"BTM-222 Konfigurieren", /* German */ |
"BTM-222 configuration", /* English*/ |
"BTM-222 configuratie", /* Dutch */ |
} |
}, |
{ /*CONNECT27*/ |
21, |
{ |
"FC > MK-USB > BTM-222", /* German */ |
"FC > MK-USB > BTM-222", /* English*/ |
"FC > MK-USB > BTM-222", /* Dutch */ |
} |
}, |
{ /*CONNECT28*/ |
21, |
{ |
"MK-USB an PC anschl. ", /* German */ |
"connect PC to MK-USB ", /* English*/ |
"Verbind PC met MK-USB", /* Dutch */ |
} |
}, |
{ /*CONNECT29*/ |
21, |
{ |
"Zwischen MK-USB und ", /* German */ |
"connect crossed cable", /* English*/ |
"Tussen MK-USB en PKT ", /* Dutch */ |
} |
}, |
{ /*CONNECT30*/ |
21, |
{ |
"PKT ein gekreuztes ", /* German */ |
"between MK-USB and ", /* English*/ |
"een gekruiste kabel ", /* Dutch */ |
} |
}, |
{ /*CONNECT31*/ |
21, |
{ |
"Kabel anschliessen. ", /* German */ |
"PKT SV2", /* English*/ |
"aansluiten.", /* Dutch */ |
} |
}, |
{ /*Kabel*/ |
21, |
{ |
"Kabel", /* German */ |
"cable", /* English*/ |
"Kabel", /* Dutch */ |
} |
}, |
{ /*SLAVE*/ |
21, |
{ |
"Slave ", /* German */ |
"Slave ", /* English*/ |
"Slave ", /* Dutch */ |
} |
}, |
{ /*NORMAL*/ |
21, |
{ |
"Normal ", /* German */ |
"Normal ", /* English*/ |
"Norm. ", /* Dutch */ |
} |
}, |
{ /*Reverse*/ |
21, |
{ |
"Reverse", /* German */ |
"inverse", /* English*/ |
"geinver", /* Dutch */ |
} |
}, |
{ /*ENDOK*/ |
21, |
{ |
"Ende OK", /* German */ |
"End OK", /* English*/ |
"Eind OK", /* Dutch */ |
} |
}, |
{ /*EEPROM1*/ |
21, |
{ |
" EEProm wirklich", /* German */ |
" Realy delete", /* English*/ |
" Eeprom werkelijk", /* Dutch */ |
} |
}, |
{ /*EEPROM2*/ |
21, |
{ |
" löschen?", /* German */ |
" EEprom?", /* English*/ |
" wissen?", /* Dutch */ |
} |
}, |
{ /*DEUTSCH*/ |
21, |
{ |
"deutsch ", /* German */ |
"german ", /* English*/ |
"duits ", /* Dutch */ |
} |
}, |
{ /*ENGLISCH*/ |
21, |
{ |
"englisch ", /* German */ |
"english ", /* English*/ |
"engels ", /* Dutch */ |
} |
}, |
{ /*FRANCE*/ |
21, |
{ |
"französisch", /* German */ |
"french " , /* English*/ |
"frans ", /* Dutch */ |
} |
}, |
{ /*NETHERL*/ |
21, |
{ |
"holländisch", /* German */ |
"dutch ", /* English*/ |
"nederlands ", /* Dutch */ |
} |
}, |
{ /*DISPLAY1*/ |
21, |
{ |
"Anzeige Einstellungen", /* German */ |
" Display Setup ", /* English*/ |
"Display instellingen ", /* Dutch */ |
} |
}, |
{ /*DISPLAY2*/ |
21, |
{ |
"Infos bei Start:", /* German */ |
"Info at startup ", /* English*/ |
"Info bij opstart", /* Dutch */ |
} |
}, |
{ /*DISPLAY3*/ |
21, |
{ |
"Sprache : ", /* German */ |
"Language: ", /* English*/ |
"Taal: ", /* Dutch */ |
} |
}, |
{ /*DISPLAY4*/ |
21, |
{ |
"Licht aus nach:", /* German */ |
"Light off after:", /* English*/ |
"Licht uit na: ", /* Dutch */ |
} |
}, |
{ /*DISPLAY5*/ |
21, |
{ |
"LCD Helligk.:", /* German */ |
" Brightness :", /* English*/ |
" intensiteit:", /* Dutch */ |
} |
}, |
{ /*DISPLAY6*/ |
21, |
{ |
"LCD Kontrast:", /* German */ |
"LCD contrast:", /* English*/ |
"LCD contrast:", /* Dutch */ |
} |
}, |
{ /*DISPLAY7*/ |
21, |
{ |
"LCD Norm/Inv: ", /* German */ |
"LCD Norm/Inv: ", /* English*/ |
"LCD Norm/Inv: ", /* Dutch */ |
} |
}, |
{ /*DISPLAY8*/ |
21, |
{ |
"LCD Orient.: ", /* German */ |
"LCD Orient.: ", /* English*/ |
"LCD Orient.: ", /* Dutch */ |
} |
}, |
{ /*DISPLAY9*/ |
21, |
{ |
"RC Fehlerpiep :", /* German */ |
"RC Errorbeep :", /* English*/ |
"RC Errorbeep :", /* Dutch */ |
} |
}, |
{ /*DEBUGPKT*/ |
21, |
{ |
"Debug PKT", /* German */ |
"Debug PKT", /* English*/ |
"Debug PKT", /* Dutch */ |
} |
}, |
{ /*WITXRX*/ |
21, |
{ |
"Wi TX/RX Chan:", /* German */ |
"Wi TX/RX Chan:", /* English*/ |
"Wi TX/RX Chan:", /* Dutch */ |
} |
}, |
{ /*WINETG*/ |
21, |
{ |
"Wi NetW. Grp.:", /* German */ |
"Wi NetW. Grp.:", /* English*/ |
"Wi NetW. Grp.:", /* Dutch */ |
} |
}, |
{ /*WINETM*/ |
21, |
{ |
"Wi NetW. Mode:", /* German */ |
"Wi NetW. Mode:", /* English*/ |
"Wi NetW. Mode:", /* Dutch */ |
} |
}, |
{ /*WITIMEOUT*/ |
21, |
{ |
"Wi TX Timeout:", /* German */ |
"Wi TX Timeout:", /* English*/ |
"Wi TX Timeout:", /* Dutch */ |
} |
}, |
{ /*WIUART*/ |
21, |
{ |
"Wi UART MTU :", /* German */ |
"Wi UART MTU :", /* English*/ |
"Wi UART MTU :", /* Dutch */ |
} |
}, |
{ /*WI2321*/ |
21, |
{ |
"Wi.232 eingebaut:", /* German */ |
"Wi.232 built in :", /* English*/ |
"Wi.232 ingebouwd:", /* Dutch */ |
} |
}, |
{ /*WI2322*/ |
21, |
{ |
"Ist ein Wi.232-Modul ", /* German */ |
"Is Wi232 modul", /* English*/ |
"Is er een Wi.232", /* Dutch */ |
} |
}, |
{ /*WI2323*/ |
21, |
{ |
"eingebaut?", /* German */ |
"built in?", /* English*/ |
"module ingebouwd?", /* Dutch */ |
} |
}, |
{ /*YES*/ |
21, |
{ |
"Ja ", /* German */ |
"yes ", /* English*/ |
"Ja ", /* Dutch */ |
} |
}, |
{ /*NO*/ |
21, |
{ |
"Nein", /* German */ |
"no ", /* English*/ |
"Nee ", /* Dutch */ |
} |
}, |
{ /*BT1*/ |
21, |
{ |
" BTM222 Einstellungen", /* German */ |
" BTM-222 settings ", /* English*/ |
" BTM-222 settings ", /* Dutch */ |
} |
}, |
{ /*BT2*/ |
21, |
{ |
"Ist ein BTM-222-Modul", /* German */ |
"Is BTM-222 Modul", /* English*/ |
"Is er een BTM-222", /* Dutch */ |
} |
}, |
{ /*BT3*/ |
21, |
{ |
"eingebaut?", /* German */ |
"built in?", /* English*/ |
"module ingebouwd?", /* Dutch */ |
} |
}, |
{ /*BT4*/ |
21, |
{ |
"BTM222 eingebaut:", /* German */ |
"BTM222 built in :", /* English*/ |
"BTM222 ingebouwd:", /* Dutch */ |
} |
}, |
{ /*LIPO1*/ |
21, |
{ |
" PKT Akku Einstellung", /* German */ |
" PKT Accu Setup ", /* English*/ |
" PKT Accu Setup ", /* Dutch */ |
} |
}, |
{ /*LIPO2*/ |
21, |
{ |
"PKT Akkutyp: ", /* German */ |
"PKT Accutyp: ", /* English*/ |
"PKT Accutype: ", /* Dutch */ |
} |
}, |
{ /*LIPO3*/ |
21, |
{ |
"Akku U Offset: ", /* German */ |
"Accu U Offset: ", /* English*/ |
"Accu U Offset: ", /* Dutch */ |
} |
}, |
{ /*LIPO4*/ |
21, |
{ |
"PKT Akkutyp: ", /* German */ |
"PKT Accutyp: ", /* English*/ |
"PKT Accutype: ", /* Dutch */ |
} |
}, |
{ /*LIPO5*/ |
21, |
{ |
"Offset verstellen bis", /* German */ |
"adjust offset until", /* English*/ |
"Offset afregelen tot", /* Dutch */ |
} |
}, |
{ /*LIPO6*/ |
21, |
{ |
"die Spannung passt", /* German */ |
"voltage fits", /* English*/ |
"de spanning juist is.", /* Dutch */ |
} |
}, |
{ /*LOWBAT*/ |
21, |
{ |
"LowBat Warn V:", /* German */ |
"LowBat Warn V:", /* English*/ |
"LowBat alarm :", /* Dutch */ |
} |
}, |
{ /*OSD_3D_V, vorne*/ |
21, |
{ |
"V", /* German */ |
"F", /* English*/ |
"F", /* Dutch */ |
} |
}, |
{ /*OSD_3D_H, hinten*/ |
21, |
{ |
"H", /* German */ |
"B", /* English*/ |
"A", /* Dutch */ |
} |
}, |
{ /*OSD_3D_L, links*/ |
21, |
{ |
"L", /* German */ |
"L", /* English*/ |
"L", /* Dutch */ |
} |
}, |
{ /*OSD_3D_R, rechts*/ |
21, |
{ |
"R", /* German */ |
"R", /* English*/ |
"R", /* Dutch */ |
} |
}, |
{ /*OSD_3D_NICK, Ni*/ |
21, |
{ |
"Ni", /* German */ |
"Ni", /* English*/ |
"Ni", /* Dutch */ |
} |
}, |
{ /*OSD_3D_ROLL, Ro*/ |
21, |
{ |
"Ro", /* German */ |
"Ro", /* English*/ |
"Ro", /* Dutch */ |
} |
}, |
{ /*OSD_3D_COMPASS, Ko*/ |
21, |
{ |
"Ko", /* German */ |
"Co", /* English*/ |
"Co", /* Dutch */ |
} |
}, |
{ /*OSD_ERROR*/ |
21, |
{ |
"FEHLER: Datenverlust ", /* German */ |
"ERROR: Data lost", /* English*/ |
"verbinding verbroken ", /* Dutch */ |
} |
}, |
{ /*OSD_POS1*/ |
21, |
{ |
"Letzte bekannte", /* German */ |
"Last known ", /* English*/ |
"Laatst bekende", /* Dutch */ |
} |
}, |
{ /*OSD_POS2*/ |
21, |
{ |
"Position ", /* German */ |
"position ", /* English*/ |
"positie ", /* Dutch */ |
} |
}, |
{ /*PARA_SETTINGS*/ |
21, |
{ |
" Einstellungen ", /* German */ |
" Setting ", /* English*/ |
" Instellingen ", /* Dutch */ |
} |
}, |
{ /*PARA_CHANGE*/ |
21, |
{ |
"ändern", /* German */ |
"change", /* English*/ |
"verandering", /* Dutch */ |
} |
}, |
{ /*PARA_AKTIVI*/ |
21, |
{ |
"aktivieren", /* German */ |
"activate", /* English*/ |
"activeren", /* Dutch */ |
} |
}, |
{ /*PARA_AKTIV*/ |
21, |
{ |
"aktiviert", /* German */ |
"activated", /* English*/ |
"geactiveerd", /* Dutch */ |
} |
}, |
{ /*PARA_SAVESETT*/ |
21, |
{ |
" Setting x speichern?", /* German */ |
" store setting?", /* English*/ |
" instell.op te slaan?", /* Dutch */ |
} |
}, |
{ /*PARA_SETTSAVED*/ |
21, |
{ |
"Gespeichert und", /* German */ |
"stored and", /* English*/ |
"opgeslagen en", /* Dutch */ |
} |
}, |
{ /*PARA_COPY*/ |
21, |
{ |
"Kopiere Setting", /* German */ |
"copy settings", /* English*/ |
"kopieer instel.", /* Dutch */ |
} |
}, |
{ /*PARA_FROMTO*/ |
21, |
{ |
" von x nach y", /* German */ |
" from x to y", /* English*/ |
" van x na y", /* Dutch */ |
} |
}, |
{ /*PARA_ENDE*/ |
21, |
{ |
"von nach Ende OK", /* German */ |
"from to end OK", /* English*/ |
"van na einde OK", /* Dutch */ |
} |
}, |
{ /*PARA_COPYQ*/ |
21, |
{ |
"Wirklich kopieren?", /* German */ |
"really copy?", /* English*/ |
"echt kopie?", /* Dutch */ |
} |
}, |
{ /*PARA_COPYACTIV*/ |
21, |
{ |
"Kopiert und aktiviert", /* German */ |
"copied and activated ", /* English*/ |
"Kopieën en actief", /* Dutch */ |
} |
}, |
{ /*PARA_CHANGESETT*/ |
21, |
{ |
"Ändere Einstellungen ", /* German */ |
" change settings ", /* English*/ |
"instellingen wijzigen", /* Dutch */ |
} |
}, |
{ /*PARA_SELECT*/ |
21, |
{ |
" Wähle Parameter ", /* German */ |
" select parameters ", /* English*/ |
"Selecteer Parameters ", /* Dutch */ |
} |
}, |
{ /*PARA_SEITE*/ |
21, |
{ |
" Wähle Seite ", /* German */ |
" select page ", /* English*/ |
" Selecteer pagina ", /* Dutch */ |
} |
}, |
{ /*PARA_SELSETT*/ |
21, |
{ |
" Wähle Setting: ", /* German */ |
" select setting ", /* English*/ |
" Selecteer setting ", /* Dutch */ |
} |
}, |
{ /*GPS1*/ |
21, |
{ |
" GPS Einstellungen ", /* German */ |
" GPS settings ", /* English*/ |
" GPS settings ", /* Dutch */ |
} |
}, |
{ /*GPS2*/ |
21, |
{ |
"gewähltes GPS Gerät ", /* German */ |
"selected GPS device ", /* English*/ |
"selected GPS device ", /* Dutch */ |
} |
}, |
{ /*GPS3*/ |
21, |
{ |
"GPS Empf.einschalten?", /* German */ |
"receive GPS on? ", /* English*/ |
"receive GPS on? ", /* Dutch */ |
} |
}, |
{ /*STATS_ITEM_0*/ |
21, |
{ |
"max Höhe :", /* German */ |
"max Altitude:", /* English*/ |
"max Altitude:", /* Dutch */ |
} |
}, |
{ /*STATS_ITEM_1*/ |
21, |
{ |
"max Geschw. :", /* German */ |
"max Speed :", /* English*/ |
"max Speed :", /* Dutch */ |
} |
}, |
{ /*STATS_ITEM_2*/ |
21, |
{ |
"max Entfern.:", /* German */ |
"max Distance:", /* English*/ |
"max Distance:", /* Dutch */ |
} |
}, |
{ /*STATS_ITEM_3*/ |
21, |
{ |
"min Spannung:", /* German */ |
"min Voltage :", /* English*/ |
"min Voltage :", /* Dutch */ |
} |
}, |
{ /*STATS_ITEM_4*/ |
21, |
{ |
"max Zeit :", /* German */ |
"max Time :", /* English*/ |
"max Time :", /* Dutch */ |
} |
}, |
{ /*STATS_ITEM_5*/ |
21, |
{ |
"max Strom :", /* German */ |
"max Current :", /* English*/ |
"max Current :", /* Dutch */ |
} |
}, |
{ /*STATS_ITEM_6*/ |
21, |
{ |
"Ent.Kapazit.:", /* German */ |
"UsedCapacity:", /* English*/ |
"UsedCapacity:", /* Dutch */ |
} |
}, |
{ /*STATS_ITEM_7*/ |
21, |
{ |
"Long. :", /* German */ |
"Long. :", /* English*/ |
"Long. :", /* Dutch */ |
} |
}, |
{ /*STATS_ITEM_8*/ |
21, |
{ |
"Lat. :", /* German */ |
"Lat. :", /* English*/ |
"Lat. :", /* Dutch */ |
} |
}, |
{ /*ONLY_NC*/ |
21, |
{ |
"Nur mit NC ! ", /* German */ |
"Only with NC !", /* English*/ |
"Only with NC !", /* Dutch */ |
} |
}, |
{ /*NO_SETTINGS*/ |
21, |
{ |
"Keine Setings !! " , /* German */ |
"No settings read!!" , /* English*/ |
"No settings read!!" , /* Dutch */ |
} |
}, |
{ /*OSD_ALTI_0*/ |
21, |
{ |
"Höhe aus ", /* German */ |
"Alti. off ", /* English*/ |
"Alti. off ", /* Dutch */ |
} |
}, |
{ /*OSD_ALTI_1*/ |
21, |
{ |
"Höhe begr.", /* German */ |
"Alti.Limit", /* English*/ |
"Alti.Limit", /* Dutch */ |
} |
}, |
{ /*OSD_VARIO_0*/ |
21, |
{ |
"Vario aus ", /* German */ |
"Vario off ", /* English*/ |
"Vario off ", /* Dutch */ |
} |
}, |
{ /*OSD_VARIO_1*/ |
21, |
{ |
"Vario Höhe", /* German */ |
"Vario Alt.", /* English*/ |
"Vario Alt.", /* Dutch */ |
} |
}, |
{ /*OSD_CARE_FREE_0*/ |
21, |
{ |
" ", /* German */ |
" ", /* English*/ |
" ", /* Dutch */ |
} |
}, |
{ /*OSD_CARE_FREE_1*/ |
21, |
{ |
"Care Free", /* German */ |
"Care Free", /* English*/ |
"Care Free", /* Dutch */ |
} |
}, |
{ /*OSD_LED0*/ |
21, |
{ |
" ", /* German */ |
" ", /* English*/ |
" ", /* Dutch */ |
} |
}, |
{ /*OSD_LED1*/ |
21, |
{ |
"LED1", /* German */ |
"LED1", /* English*/ |
"LED1", /* Dutch */ |
} |
}, |
{ /*OSD_LED2*/ |
21, |
{ |
"LED2", /* German */ |
"LED2", /* English*/ |
"LED2", /* Dutch */ |
} |
}, |
{ /*OSD_NAVI_MODE_0*/ |
21, |
{ |
"Navi aus ", /* German */ |
"Navi off ", /* English*/ |
"Navi off ", /* Dutch */ |
} |
}, |
{ /*OSD_NAVI_MODE_1*/ |
21, |
{ |
"Pos. halten", /* German */ |
"Pos. Hold ", /* English*/ |
"Pos. Hold ", /* Dutch */ |
} |
}, |
{ /*OSD_NAVI_MODE_2*/ |
21, |
{ |
"Coming Home", /* German */ |
"Coming Home", /* English*/ |
"Coming Home", /* Dutch */ |
} |
}, |
{ /*OSD_FLAGS_0*/ |
21, |
{ |
" ", /* German */ |
" ", /* English*/ |
" ", /* Dutch */ |
} |
}, |
{ /*OSD_FLAGS_1*/ |
21, |
{ |
"Justieren", /* German */ |
"Calibrate", /* English*/ |
"Calibrate", /* Dutch */ |
} |
}, |
{ /*OSD_FLAGS_2*/ |
21, |
{ |
"Start ", /* German */ |
"Start ", /* English*/ |
"Start ", /* Dutch */ |
} |
}, |
{ /*OSD_FLAGS_3*/ |
21, |
{ |
"Betrieb ", /* German */ |
"Run ", /* English*/ |
"Run ", /* Dutch */ |
} |
}, |
{ /*OSD_FLAGS_4*/ |
21, |
{ |
"Fliegen ", /* German */ |
"Fly ", /* English*/ |
"Fly ", /* Dutch */ |
} |
}, |
{ /*OSD_FLAGS_5*/ |
21, |
{ |
"Landung ", /* German */ |
"Landing ", /* English*/ |
"Landing ", /* Dutch */ |
} |
}, |
{ /*OSD_FLAGS_6*/ |
21, |
{ |
"Akku leer", /* German */ |
"Low Bat. ", /* English*/ |
"Low Bat ", /* Dutch */ |
} |
}, |
{ /*OSD_Screen*/ |
21, |
{ |
" OSD Anzeige Setup ", /* German */ |
" OSD screen setup ", /* English*/ |
" OSD screen setup ", /* Dutch */ |
} |
}, |
{ /*OSD_Invert_Out*/ |
21, |
{ |
"Out1/2 negiert :", /* German */ |
"Out1/2 inverted:", /* English*/ |
"Out1/2 inverted:", /* Dutch */ |
} |
}, |
{ /*OSD_LED_Form*/ |
21, |
{ |
"Out1/2 Format:", /* German */ |
"Out1/2 format:", /* English*/ |
"Out1/2 format:", /* Dutch */ |
} |
}, |
{ /*OSD_Send_OSD*/ |
21, |
{ |
"Navidata an SV2:", /* German */ |
"Navidata to SV2:", /* English*/ |
"Navidata to SV2:", /* Dutch */ |
} |
}, |
{ /*OSD_Fallspeed*/ |
21, |
{ |
"m. Sinkrate m/s:", /* German */ |
"m.fallspeed m/s:", /* English*/ |
"m.fallspeed m/s:", /* Dutch */ |
} |
}, |
{ /*OSD_VARIOBEEP*/ |
21, |
{ |
"Variometer Beep:", /* German */ |
"variometer beep:", /* English*/ |
"variometer beep:", /* Dutch */ |
} |
}, |
{ /*OSD_HOMEMKVIEW*/ |
21, |
{ |
"Homesicht von MK:", /* German */ |
"homeview from MK:", /* English*/ |
"homeview from MK:", /* Dutch */ |
} |
}, |
{ /*OSD_MAHWARNING*/ |
21, |
{ |
"mAh Warnung > :", /* German */ |
"mAh warning > :", /* English*/ |
"mAh warning > :", /* Dutch */ |
} |
}, |
{ /*OSD_SCREENMODE*/ |
21, |
{ |
"OSD Anzeigevar:", /* German */ |
"OSD screenmode:", /* English*/ |
"OSD screenmode:", /* Dutch */ |
} |
}, |
{ /*OSD_LIPOBAR*/ |
21, |
{ |
"MK Volt Balken:", /* German */ |
"MK volt bargraph:", /* English*/ |
"MK volt bargraph:", /* Dutch */ |
} |
}, |
{ /*PKT_BAUDRATE*/ |
21, |
{ |
"Baud Wi232/BT:", /* German */ |
"Baud Wi232/BT:", /* English*/ |
"Baud Wi232/BT:", /* Dutch */ |
} |
}, |
{ /*FOLLOWME_0*/ |
21, |
{ |
" Follow Me Setup ", /* German */ |
" Follow Me Setup ", /* English*/ |
" Follow Me Setup ", /* Dutch */ |
} |
}, |
{ /*FOLLOWME_1*/ |
21, |
{ |
" Refresh :", /* German */ |
" Refresh :", /* English*/ |
" Refresh :", /* Dutch */ |
} |
}, |
{ /*FOLLOWME_2*/ |
21, |
{ |
"Geschwindigkeit:", /* German */ |
" Speed :", /* English*/ |
" Speed :", /* Dutch */ |
} |
}, |
{ /*FOLLOWME_3*/ |
21, |
{ |
"Toleranz Radius:", /* German */ |
"Toleranz Radius:", /* English*/ |
"Toleranz Radius:", /* Dutch */ |
} |
}, |
{ /*HWSOUND*/ |
21, |
{ |
"Tonausgabe Erw.:", /* German */ |
"sound extension:", /* English*/ |
"sound extension:", /* Dutch */ |
} |
}, |
{ /*HWBEEPER*/ |
21, |
{ |
"Hardware Pieper:", /* German */ |
"hardware beep :", /* English*/ |
"hardware beep :", /* Dutch */ |
} |
}, |
{ /*VOLUME*/ |
21, |
{ |
"Lautstärke :", /* German */ |
"volume :", /* English*/ |
"volume :", /* Dutch */ |
} |
}, |
{ /*SERCHAN_0*/ |
21, |
{ |
"serielle Kanäle Setup", /* German */ |
"serial channel setup", /* English*/ |
"serial channel setup", /* Dutch */ |
} |
}, |
{ /*SERCHAN_1*/ |
21, |
{ |
"serielle Kanäle Setup", /* German */ |
"serial channel setup", /* English*/ |
"serial channel setup", /* Dutch */ |
} |
}, |
{ /*SERCHAN_2*/ |
21, |
{ |
"Lipo Messung:", /* German */ |
"Lipo check :", /* English*/ |
"Lipo check :", /* Dutch */ |
} |
}, |
{ /*SERCHAN_3*/ |
21, |
{ |
"Kanal ", /* German */ |
"Channel ", /* English*/ |
"Channel ", /* Dutch */ |
} |
}, |
{ /*SERVOSTEPS*/ |
21, |
{ |
"Servoschritte: ", /* German */ |
"servosteps : ", /* English*/ |
"servosteps : ", /* Dutch */ |
} |
}, |
{ /*SERVO1_TEXT*/ |
21, |
{ |
" Servo 1 ", /* German */ |
" servo 1 ", /* English*/ |
" servo 1 ", /* Dutch */ |
} |
}, |
{ /*SERVO2_TEXT*/ |
21, |
{ |
" Servo 2 ", /* German */ |
" servo 2 ", /* English*/ |
" servo 2 ", /* Dutch */ |
} |
}, |
{ /*SERVO_REVERSE*/ |
21, |
{ |
"Reverse:", /* German */ |
"Reverse:", /* English*/ |
"Reverse:", /* Dutch */ |
} |
}, |
{ /*SERVO_LEFT*/ |
21, |
{ |
"Links:", /* German */ |
"lefth:", /* English*/ |
"lefth:", /* Dutch */ |
} |
}, |
{ /*SERVO_RIGHT*/ |
21, |
{ |
"Rechts:", /* German */ |
"right:", /* English*/ |
"right:", /* Dutch */ |
} |
}, |
{ /*SERVO_MIDDLE*/ |
21, |
{ |
"Mitte:", /* German */ |
"middle:", /* English*/ |
"middle:", /* Dutch */ |
} |
}, |
{ /*SERVO_TEST1*/ |
21, |
{ |
"Test Pulslänge ", /* German */ |
"test framewidth ", /* English*/ |
"test framewidth ", /* Dutch */ |
} |
}, |
{ /*SV_TEST2*/ |
21, |
{ |
" Servo zum Testen ", /* German */ |
" servo to test ", /* English*/ |
" servo to test ", /* Dutch */ |
} |
}, |
{ /*SV_TEST3*/ |
21, |
{ |
" Periode ", /* German */ |
" frame ", /* English*/ |
" frame ", /* Dutch */ |
} |
}, |
{ /*SV_TESTCONT*/ |
21, |
{ |
"Test fortlaufend ", /* German */ |
"test continues ", /* English*/ |
"test continues ", /* Dutch */ |
} |
}, |
{ /*SV_SINGLESTEP*/ |
21, |
{ |
"Einzelschritt ", /* German */ |
"single step ", /* English*/ |
"single step ", /* Dutch */ |
} |
}, |
{ /*SV_COUNTTEST*/ |
21, |
{ |
"Anzahl ", /* German */ |
"test count ", /* English*/ |
"test count ", /* Dutch */ |
} |
}, |
{ /*SV_PAUSEEND*/ |
21, |
{ |
"Pause Endposition ", /* German */ |
"pause endposition ", /* English*/ |
"pause endposition ", /* Dutch */ |
} |
}, |
{ /*SV_PAUSEINC*/ |
21, |
{ |
"Pause pro Inc. ", /* German */ |
"Pause pro Inc. ", /* English*/ |
"Pause pro Inc. ", /* Dutch */ |
} |
}, |
{ /*GPS_MOUSETYP*/ |
21, |
{ |
"GPS Maus :", /* German */ |
"GPS mouse:", /* English*/ |
"GPS mouse:", /* Dutch */ |
} |
}, |
{ /*GPS_MOUSE1*/ |
21, |
{ |
"GPS BT Mouse 1 ", /* German */ |
"GPS BT Mouse 1 ", /* English*/ |
"GPS BT Mouse 1 ", /* Dutch */ |
} |
}, |
{ /*GPS_MK*/ |
21, |
{ |
"GPS Pos. vom MK ", /* German */ |
"GPS pos. from MK ", /* English*/ |
"GPS pos. from MK ", /* Dutch */ |
} |
}, |
{ /*STICK_MIN*/ |
21, |
{ |
"Stick min. Wert: ", /* German */ |
"stick min. value: ", /* English*/ |
"stick min. value: ", /* Dutch */ |
} |
}, |
{ /*STICK_MAX*/ |
21, |
{ |
"Stick max. Wert: ", /* German */ |
"stick max. value: ", /* English*/ |
"stick max. value: ", /* Dutch */ |
} |
}, |
{ /*STICK_DIR*/ |
21, |
{ |
"Richtung: ", /* German */ |
"direction: ", /* English*/ |
"direction: ", /* Dutch */ |
} |
}, |
{ /*STICK_TYPE*/ |
21, |
{ |
"Sticktype: ", /* German */ |
"sticktype: ", /* English*/ |
"sticktype: ", /* Dutch */ |
} |
}, |
{ /*STICK_NEUTRAL*/ |
21, |
{ |
"Neutralisierend:", /* German */ |
"neutralizing:", /* English*/ |
"neutralizing:", /* Dutch */ |
} |
}, |
{ /*LIPO_MESSUNG*/ |
21, |
{ |
"Lipo Messung: ", /* German */ |
"Lipo measurement: ", /* English*/ |
"Lipo measurement: ", /* Dutch */ |
} |
}, |
{ /*POTI*/ |
21, |
{ |
"Poti ", /* German */ |
"poti ", /* English*/ |
"poti ", /* Dutch */ |
} |
}, |
{ /*TASTER*/ |
21, |
{ |
"Taster", /* German */ |
"switch", /* English*/ |
"switch", /* Dutch */ |
} |
} |
}; |
char const * strGet(int str_no) |
{ |
return (char*)pgm_read_word(&strings[str_no].text[Config.DisplayLanguage]); |
} |
//void Test_Language (void) // bleibt für Tests |
//{ |
// lcd_cls(); |
// lcd_puts_at(12, 7, strGet(YESNO),0); |
// |
// do |
// { |
// lcd_puts_at(0, 2, strGet(TESTSTRING), 0); |
// } |
// while(!get_key_press (1 << KEY_ESC)); |
// get_key_press(KEY_ALL); |
// return; |
//} |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/messages.h |
---|
0,0 → 1,58 |
/**************************************************************************************** |
* Copyright (C) 2011 Christian "Cebra" Brandtner, brandtner@brandtner.net * |
* * |
* This program is free software; you can redistribute it and/or modify * |
* it under the terms of the GNU General Public License as published by * |
* the Free Software Foundation; either version 2 of the License. * |
* * |
* This program is distributed in the hope that it will be useful, * |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
* GNU General Public License for more details. * |
* * |
* You should have received a copy of the GNU General Public License * |
* along with this program; if not, write to the * |
* Free Software Foundation, Inc., * |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
* * |
* * |
* Languagesupport: * |
* http://www.netrino.com/Embedded-Systems/How-To/Firmware-Internationalization * |
* Nigel Jones * |
****************************************************************************************/ |
#ifndef MESSAGES_H |
#define MESSAGES_H |
//--------------------------------------------------------------------------------------------------------------------- |
// Typdefinitionen für alle verwendeten Strings, LAST_STR muss am Ende stehen bleiben |
typedef enum |
{ |
TESTSTRING, KEYLINE1, KEYLINE2, KEYLINE3, KEYLINE4, KEYLINE5, BOOT1, BOOT2, BOOT_WI1, BOOT_WI2, BOOT_SV, START_MSG1, START_MSG2, GNU_GPL, ATMEGA644, |
ATMEGA644P, ATMEGA1284P, HW12, HW12W, HW13, HW13W, HW39, START_LASTPOS, START_LASTPOS1, START_LASTPOS2, START_LASTPOS3, START_LASTPOSDEL, |
START_SEARCHFC, ENDE, OK, FEHLER, AKTIV, START_FCNOTFOUND, START_FCFOUND, START_FCFOUND1, START_FCFOUND2, START_FCFOUND3, START_VERSIONCHECK, |
START_VERSIONCHECK1, START_VERSIONCHECK2, START_VERSIONCHECK3, START_VERSIONCHECK4, START_VERSIONCHECK5, ON, OFF, ESC, SHUTDOWN, YESNO, |
UPDATE1, UPDATE2, ENDSTART, TOOLS1, CONNECT1, CONNECT2, CONNECT4, CONNECT5, CONNECT6, CONNECT7, CONNECT8, CONNECT9, CONNECT10, CONNECT11, CONNECT12, |
CONNECT13, CONNECT14, CONNECT15, CONNECT16, CONNECT17, CONNECT18, CONNECT19, CONNECT20, CONNECT21, CONNECT22, CONNECT23, CONNECT24, CONNECT25, |
CONNECT26, CONNECT27, CONNECT28, CONNECT29, CONNECT30, CONNECT31, KABEL, SLAVE, NORMAL, REVERSE, ENDOK, EEPROM1, EEPROM2, DEUTSCH, ENGLISCH, FRANCE, |
NETHERL, DISPLAY1, DISPLAY2, DISPLAY3, DISPLAY4, DISPLAY5, DISPLAY6, DISPLAY7, DISPLAY8, DISPLAY9, DEBUGPKT, WITXRX, WINETWG, WINETWM, WITIMEOUT, |
WIUART, WI2321, WI2322, WI2323, YES, NOO, BT1, BT2, BT3, BT4, LIPO1, LIPO2, LIPO3, LIPO4, LIPO5, LIPO6, LOWBAT, OSD_3D_V, OSD_3D_H, OSD_3D_L, |
OSD_3D_R, OSD_3D_NICK, OSD_3D_ROLL, OSD_3D_COMPASS, OSD_ERROR, OSD_POS1, OSD_POS2, PARA_SETTINGS, PARA_CHANGE, PARA_AKTIVI, PARA_AKTIV, |
PARA_SAVESETT, PARA_SETTSAVED, PARA_COPY, PARA_FROMTO, PARA_ENDE, PARA_COPYQ, PARA_COPYACTIV, PARA_CHANGESETT, PARA_SELECT, PARA_SEITE, |
PARA_SELSETT, GPS1, GPS2, GPS3, STATS_ITEM_0, STATS_ITEM_1, STATS_ITEM_2, STATS_ITEM_3, STATS_ITEM_4, STATS_ITEM_5, STATS_ITEM_6, STATS_ITEM_7, |
STATS_ITEM_8, ONLY_NC, NO_SETTINGS, OSD_ALTI_0, OSD_ALTI_1, OSD_VARIO_0, OSD_VARIO_1, OSD_CARE_FREE_0, OSD_CARE_FREE_1, OSD_LED0, OSD_LED1, OSD_LED2, |
OSD_NAVI_MODE_0, OSD_NAVI_MODE_1, OSD_NAVI_MODE_2, OSD_FLAGS_0, OSD_FLAGS_1, OSD_FLAGS_2, OSD_FLAGS_3, OSD_FLAGS_4, OSD_FLAGS_5, OSD_FLAGS_6, |
OSD_Screen, OSD_Invert_Out, OSD_LED_Form, OSD_Send_OSD,FALLSPEED,OSD_VARIOBEEP,OSD_HOMEMKVIEW,OSD_MAHWARNING,OSD_SCREENMODE,OSD_LIPOBAR,PKT_BAUDRATE, |
FOLLOWME_0, FOLLOWME_1,FOLLOWME_2,FOLLOWME_3, HWSOUND, HWBEEPER, VOLUME, SERCHAN_0, SERCHAN_1, SERCHAN_2, SERCHAN_3, SERVOSTEPS,SERVO1_TEXT, SERVO2_TEXT, |
SERVO_REVERSE, SERVO_LEFT, SERVO_RIGTH, SERVO_MID, SERVO_TEST1, SV_TEST2, SV_TEST3, SV_TESTCONT, SV_SINGLESTEP, SV_COUNTTEST, SV_PAUSEEND, |
SV_PAUSEINC,GPS_MOUSETYP,GPS_MOUSE1,GPS_MK,STICK_MIN, STICK_MAX, STICK_DIR, STICK_TYPE, STICK_NEUTRAL, LIPO_MESSUNG,POTI,TASTER, LAST_STR, |
} STR; |
#define NUM_LANG 3 // German, English,Netherlands |
char const * strGet(int str_no); |
void Test_Language (void); // bleibt für Tests |
#endif /* _MESSAGES_H_ */ |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/mk-data-structs.h |
---|
0,0 → 1,491 |
/***************************************************************************** |
* Copyright (C) 2008 Thomas Kaiser, thomas@ft-fanpage.de * |
* Copyright (C) 2009 Peter "woggle" Mack, mac@denich.net * |
* Copyright (C) 2011 Christian "Cebra" Brandtner, brandtner@brandtner.net * |
* Copyright (C) 2011 Harald Bongartz * |
* * |
* This program is free software; you can redistribute it and/or modify * |
* it under the terms of the GNU General Public License as published by * |
* the Free Software Foundation; either version 2 of the License. * |
* * |
* This program is distributed in the hope that it will be useful, * |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
* GNU General Public License for more details. * |
* * |
* You should have received a copy of the GNU General Public License * |
* along with this program; if not, write to the * |
* Free Software Foundation, Inc., * |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
* * |
* * |
* Credits to: * |
* Holger Buss & Ingo Busker from mikrokopter.de for the MK project + SVN * |
* http://www.mikrokopter.de * |
* Gregor "killagreg" Stobrawa for his version of the MK code * |
* Thomas Kaiser "thkais" for the original project. See * |
* http://www.ft-fanpage.de/mikrokopter/ * |
* http://forum.mikrokopter.de/topic-4061-1.html * |
* Claas Anders "CaScAdE" Rathje for providing the font and his C-OSD code * |
* http://www.mylifesucks.de/oss/c-osd/ * |
* Harald Bongartz "HaraldB" for providing his Ideas and Code for usibility* |
*****************************************************************************/ |
#ifndef _MK_DATA_STRUCTS_H |
#define _MK_DATA_STRUCTS_H |
#include "main.h" |
//-------------------------------------------------------------------------------- |
#ifdef MKVERSION088n |
// FC Version 0.88m |
#define EEProm_Version 91 // FC EEProm Revision / Struktur FC 0.87 |
#define FC_Version "0.88n" //Softwareversion der FC |
#define VERSION_MAJOR 0 |
#define VERSION_MINOR 88 |
#define VERSION_PATCH 12 |
#define VERSION_SERIAL_MAJOR 11 // Serial Protocol |
#define VERSION_SERIAL_MINOR 0 // Serial Protocol |
#define NC_SPI_COMPATIBLE 51 // Navi-Kompatibilität |
#warning "FC-Version 0.88n" |
#endif |
//-------------------------------------------------------------------------------- |
#ifdef MKVERSION090b |
// FC Version 0.89b |
#define EEProm_Version 92 // FC EEProm Revision / Struktur FC 0.87 |
#define FC_Version "0.90b" //Softwareversion der FC |
#define VERSION_MAJOR 0 |
#define VERSION_MINOR 89 |
#define VERSION_PATCH 2 |
#define VERSION_SERIAL_MAJOR 11 // Serial Protocol |
#define VERSION_SERIAL_MINOR 0 // Serial Protocol |
#define NC_SPI_COMPATIBLE 52 // Navi-Kompatibilität |
#warning "FC-Version 0.90b" |
#endif |
//-------------------------------------------------------------------------------- |
#define u8 uint8_t |
#define s8 int8_t |
#define u16 uint16_t |
#define s16 int16_t |
#define u32 uint32_t |
#define s32 int32_t |
#define NUMBER_OF_DEBUG_DATAS 32 |
#define ANALOG_NAME_LENGTH 16 |
// Version of supported serial protocol |
#define MIN_VERSION 7 |
#define MAX_VERSION 10 |
// Setting index |
#define SETTING_1 1 |
#define SETTING_2 2 |
#define SETTING_3 3 |
#define SETTING_4 4 |
#define SETTING_5 5 |
#define SETTING_CURRENT 0xff |
// MikroKopter defines |
// taken from |
// FC Software eeprom.h |
// |
//GlobalConfig3 aus FC/eeprom.h |
#define CFG3_NO_SDCARD_NO_START 0x01 |
#define CFG3_DPH_MAX_RADIUS 0x02 |
#define CFG3_VARIO_FAILSAFE 0x04 |
#define CFG3_MOTOR_SWITCH_MODE 0x08 //FC0.88L 7.5.12 |
#define CFG3_NO_GPSFIX_NO_START 0x10 //FC0.88L 7.5.12 |
#ifdef MKVERSION090b |
#define CFG3_USE_NC_FOR_OUT1 0x20 |
#define CFG3_SPEAK_ALL 0x40 |
#endif |
//GlobalConfig |
#define CFG_HOEHENREGELUNG 0x01 |
#define CFG_HOEHEN_SCHALTER 0x02 |
#define CFG_HEADING_HOLD 0x04 |
#define CFG_KOMPASS_AKTIV 0x08 |
#define CFG_KOMPASS_FIX 0x10 |
#define CFG_GPS_AKTIV 0x20 |
#define CFG_ACHSENKOPPLUNG_AKTIV 0x40 |
#define CFG_DREHRATEN_BEGRENZER 0x80 |
//Bitconfig MAsk |
#define CFG_LOOP_OBEN 0x01 |
#define CFG_LOOP_UNTEN 0x02 |
#define CFG_LOOP_LINKS 0x04 |
#define CFG_LOOP_RECHTS 0x08 |
#define CFG_MOTOR_BLINK1 0x10 |
#define CFG_MOTOR_OFF_LED1 0x20 |
#define CFG_MOTOR_OFF_LED2 0x40 |
#define CFG_MOTOR_BLINK2 0x80 |
// ServoCompInvert, FC0.89 |
#define SVNick 0x01 |
#define SVRoll 0x02 |
#define SVRelMov 0x04 |
// ExtraConfig |
#define CFG2_HEIGHT_LIMIT 0x01 |
#define CFG2_VARIO_BEEP 0x02 |
#define CFG_SENSITIVE_RC 0x04 |
#define CFG_3_3V_REFERENCE 0x08 |
#define CFG_NO_RCOFF_BEEPING 0x10 |
#define CFG_GPS_AID 0x20 |
#define CFG_LEARNABLE_CAREFREE 0x40 |
#define CFG_IGNORE_MAG_ERR_AT_STARTUP 0x80 |
// bit mask for ParamSet.Config0 |
#define CFG0_AIRPRESS_SENSOR 0x01 |
#define CFG0_HEIGHT_SWITCH 0x02 |
#define CFG0_HEADING_HOLD 0x04 |
#define CFG0_COMPASS_ACTIVE 0x08 |
#define CFG0_COMPASS_FIX 0x10 |
#define CFG0_GPS_ACTIVE 0x20 |
#define CFG0_AXIS_COUPLING_ACTIVE 0x40 |
#define CFG0_ROTARY_RATE_LIMITER 0x80 |
// defines for the receiver selection |
#define RECEIVER_PPM 0 |
#define RECEIVER_SPEKTRUM 1 |
#define RECEIVER_SPEKTRUM_HI_RES 2 |
#define RECEIVER_SPEKTRUM_LOW_RES 3 |
#define RECEIVER_JETI 4 |
#define RECEIVER_ACT_DSL 5 |
#define RECEIVER_HOTT 6 |
#define RECEIVER_SBUS 7 |
#define RECEIVER_USER 8 |
#define RECEIVER_UNKNOWN 0xFF |
// MikroKopter Flags |
// taken from |
// http://svn.mikrokopter.de/mikrowebsvn/filedetails.php?repname=FlightCtrl&path=%2Ftags%2FV0.73d%2Ffc.h |
//alt 0.86 |
//#define FCFLAG_MOTOR_RUN 0x01 |
//#define FCFLAG_FLY 0x02 |
//#define FCFLAG_CALIBRATE 0x04 |
//#define FCFLAG_START 0x08 |
//#define FCFLAG_NOTLANDUNG 0x10 |
//#define FCFLAG_LOWBAT 0x20 |
//#define FCFLAG_SPI_RX_ERR 0x40 |
//#define FCFLAG_I2CERR 0x80 |
// FC_StatusFlags 0.88 |
#define FC_STATUS_MOTOR_RUN 0x01 |
#define FC_STATUS_FLY 0x02 |
#define FC_STATUS_CALIBRATE 0x04 |
#define FC_STATUS_START 0x08 |
#define FC_STATUS_EMERGENCY_LANDING 0x10 |
#define FC_STATUS_LOWBAT 0x20 |
#define FC_STATUS_VARIO_TRIM_UP 0x40 |
#define FC_STATUS_VARIO_TRIM_DOWN 0x80 |
// FC_StatusFlags2 |
#define FC_STATUS2_CAREFREE 0x01 |
#define FC_STATUS2_ALTITUDE_CONTROL 0x02 |
#define FC_STATUS2_RC_FAILSAVE_ACTIVE 0x04 |
#define FC_STATUS2_OUT1_ACTIVE 0x08 |
#define FC_STATUS2_OUT2_ACTIVE 0x10 |
// NaviCtrl Flags |
// taken from |
// http://mikrocontroller.cco-ev.de/mikrowebsvn/filedetails.php?repname=NaviCtrl&path=%2Ftags%2FV0.15c%2Fuart1.h |
// |
#define NC_FLAG_FREE 0x01 |
#define NC_FLAG_PH 0x02 |
#define NC_FLAG_CH 0x04 |
#define NC_FLAG_RANGE_LIMIT 0x08 |
#define NC_FLAG_NOSERIALLINK 0x10 |
#define NC_FLAG_TARGET_REACHED 0x20 |
#define NC_FLAG_MANUAL_CONTROL 0x40 |
#define NC_FLAG_GPS_OK 0x80 |
typedef struct |
{ |
unsigned char SWMajor; |
unsigned char SWMinor; |
unsigned char ProtoMajor; |
unsigned char ProtoMinor; |
unsigned char SWPatch; |
unsigned char HardwareError[5]; |
} __attribute__((packed)) Version_t; |
// FC Debug Struct |
// portions taken and adapted from |
// http://svn.mikrokopter.de/mikrowebsvn/filedetails.php?repname=FlightCtrl&path=%2Ftags%2FV0.72p%2Fuart.h |
// |
typedef struct // 0.86 |
{ |
uint8_t Digital[2]; |
// NC: unsigned; FC: signed !!!! |
int16_t Analog[32]; // Debugvalues |
} __attribute__((packed)) DebugData_t; |
//****************************************************************** |
// uart1.h NC 0.87, zur Zeit hier nicht verwendet 28.01.2012 CB |
#define AMPEL_FC 0x01 |
#define AMPEL_BL 0x02 |
#define AMPEL_NC 0x04 |
#define AMPEL_COMPASS 0x08 |
typedef struct //0.87 |
{ |
u8 StatusGreen; |
u8 StatusRed; |
u16 Analog[32]; // Debugwerte |
} __attribute__((packed)) DebugOut_t; |
//****************************************************************** |
// NaviCtrl OSD Structs |
// portions taken and adapted from |
// http://svn.mikrokopter.de/mikrowebsvn/filedetails.php?repname=NaviCtrl&path=%2Ftags%2FV0.15c%2Fuart1.h |
// |
typedef struct //NC uart1.h |
{ |
s16 AngleNick; // in 0.1 deg |
s16 AngleRoll; // in 0.1 deg |
s16 Heading; // in 0.1 deg |
u8 StickNick; |
u8 StickRoll; |
u8 StickYaw; |
u8 StickGas; |
u8 reserve[4]; |
} __attribute__((packed)) Data3D_t; |
typedef struct |
{ |
s32 Longitude; // in 1E-7 deg |
s32 Latitude; // in 1E-7 deg |
s32 Altitude; // in mm |
u8 Status; // validity of data |
} __attribute__((packed)) GPS_Pos_t; |
typedef struct |
{ |
u16 Distance; // distance to target in cm |
s16 Bearing; // course to target in deg |
} __attribute__((packed)) GPS_PosDev_t; |
// aus NC waypoint.h |
typedef struct |
{ |
GPS_Pos_t Position; // the gps position of the waypoint, see ubx.h for details |
s16 Heading; // orientation, 0 no action, 1...360 fix heading, neg. = Index to POI in WP List |
u8 ToleranceRadius; // in meters, if the MK is within that range around the target, then the next target is triggered |
u8 HoldTime; // in seconds, if the was once in the tolerance area around a WP, this time defines the delay before the next WP is triggered |
u8 Event_Flag; // future implementation |
u8 Index; // to indentify different waypoints, workaround for bad communications PC <-> NC |
u8 Type; // typeof Waypoint |
u8 WP_EventChannelValue; // |
u8 AltitudeRate; // rate to change the setpoint |
u8 Speed; // rate to change the Position |
u8 CamAngle; // Camera servo angle |
u8 reserve[6]; // reserve |
} __attribute__((packed)) Point_t; |
// NaviCtrl struct |
// taken from |
// http://mikrocontroller.cco-ev.de/mikrowebsvn/filedetails.php?repname=NaviCtrl&path=%2Ftags%2FV0.15c%2Fuart1.h |
// |
#define NAVIDATA_VERSION 5 |
typedef struct |
{ |
u8 Version; // version of the data structure |
GPS_Pos_t CurrentPosition; // see ubx.h for details |
GPS_Pos_t TargetPosition; |
GPS_PosDev_t TargetPositionDeviation; |
GPS_Pos_t HomePosition; |
GPS_PosDev_t HomePositionDeviation; |
u8 WaypointIndex; // index of current waypoints running from 0 to WaypointNumber-1 |
u8 WaypointNumber; // number of stored waypoints |
u8 SatsInUse; // number of satellites used for position solution |
s16 Altimeter; // hight according to air pressure |
s16 Variometer; // climb(+) and sink(-) rate |
u16 FlyingTime; // in seconds |
u8 UBat; // Battery Voltage in 0.1 Volts |
u16 GroundSpeed; // speed over ground in cm/s (2D) |
s16 Heading; // current flight direction in ° as angle to north |
s16 CompassHeading; // current compass value in |
s8 AngleNick; // current Nick angle in 1 |
s8 AngleRoll; // current Roll angle in 1 |
u8 RC_Quality; // RC_Quality |
u8 FCStatusFlags; // Flags from FC |
u8 NCFlags; // Flags from NC |
u8 Errorcode; // 0 --> okay |
u8 OperatingRadius; // current operation radius around the Home Position in m |
s16 TopSpeed; // velocity in vertical direction in cm/s |
u8 TargetHoldTime; // time in s to stay at the given target, counts down to 0 if target has been reached |
u8 FCStatusFlags2; // StatusFlags2 (since version 5 added) |
s16 SetpointAltitude; // setpoint for altitude |
u8 Gas; // for future use |
u16 Current; // actual current in 0.1A steps |
u16 UsedCapacity; // used capacity in mAh |
} __attribute__((packed)) NaviData_t; |
typedef struct |
{ |
uint8_t Version; // the version of the BL (0 = old) |
uint8_t SetPoint; // written by attitude controller |
uint8_t SetPointLowerBits; // for higher Resolution of new BLs |
uint8_t State; // 7 bit for I2C error counter, highest bit indicates if motor is present |
uint8_t ReadMode; // select data to read |
// the following bytes must be exactly in that order! |
uint8_t Current; // in 0.1 A steps, read back from BL |
uint8_t MaxPWM; // read back from BL -> is less than 255 if BL is in current limit, not running (250) or starting (40) |
int8_t Temperature; // old BL-Ctrl will return a 255 here, the new version the temp. in �C |
} __attribute__((packed)) MotorData_t; |
typedef struct |
{ |
uint8_t Revision; // must be BL_REVISION |
uint8_t SetMask; // settings mask |
uint8_t PwmScaling; // maximum value of control pwm, acts like a thrust limit |
uint8_t CurrentLimit; // current limit in A |
uint8_t TempLimit; // in �C |
uint8_t CurrentScaling; // scaling factor for current measurement |
uint8_t BitConfig; // see defines above |
uint8_t crc; // checksum |
} __attribute__((packed)) BLConfig_t; |
// Aus FC eeprom.h |
// |
typedef struct |
{ |
unsigned char Revision; |
unsigned char Kanalbelegung[12]; // GAS[0], GIER[1],NICK[2], ROLL[3], POTI1, POTI2, POTI3 |
unsigned char GlobalConfig; // 0x01=Höhenregler aktiv,0x02=Kompass aktiv, 0x04=GPS aktiv, 0x08=Heading Hold aktiv |
unsigned char Hoehe_MinGas; // Wert : 0-100 |
unsigned char Luftdruck_D; // Wert : 0-250 |
unsigned char MaxHoehe; // Wert : 0-32 |
unsigned char Hoehe_P; // Wert : 0-32 |
unsigned char Hoehe_Verstaerkung; // Wert : 0-50 |
unsigned char Hoehe_ACC_Wirkung; // Wert : 0-250 |
unsigned char Hoehe_HoverBand; // Wert : 0-250 |
unsigned char Hoehe_GPS_Z; // Wert : 0-250 |
unsigned char Hoehe_StickNeutralPoint;// Wert : 0-250 |
unsigned char Stick_P; // Wert : 1-6 |
unsigned char Stick_D; // Wert : 0-64 |
unsigned char StickGier_P; // Wert : 1-20 |
unsigned char Gas_Min; // Wert : 0-32 |
unsigned char Gas_Max; // Wert : 33-250 |
unsigned char GyroAccFaktor; // Wert : 1-64 |
unsigned char KompassWirkung; // Wert : 0-32 |
unsigned char Gyro_P; // Wert : 10-250 |
unsigned char Gyro_I; // Wert : 0-250 |
unsigned char Gyro_D; // Wert : 0-250 |
unsigned char Gyro_Gier_P; // Wert : 10-250 |
unsigned char Gyro_Gier_I; // Wert : 0-250 |
unsigned char Gyro_Stability; // Wert : 0-16 |
unsigned char UnterspannungsWarnung; // Wert : 0-250 |
unsigned char NotGas; // Wert : 0-250 //Gaswert bei EmpÀngsverlust |
unsigned char NotGasZeit; // Wert : 0-250 // Zeitbis auf NotGas geschaltet wird, wg. Rx-Problemen |
unsigned char Receiver; // 0= Summensignal, 1= Spektrum, 2 =Jeti, 3=ACT DSL, 4=ACT S3D |
unsigned char I_Faktor; // Wert : 0-250 |
unsigned char UserParam1; // Wert : 0-250 |
unsigned char UserParam2; // Wert : 0-250 |
unsigned char UserParam3; // Wert : 0-250 |
unsigned char UserParam4; // Wert : 0-250 |
unsigned char ServoNickControl; // Wert : 0-250 // Stellung des Servos |
unsigned char ServoNickComp; // Wert : 0-250 // Einfluss Gyro/Servo |
unsigned char ServoNickMin; // Wert : 0-250 // Anschlag |
unsigned char ServoNickMax; // Wert : 0-250 // Anschlag |
//--- Seit V0.75 |
unsigned char ServoRollControl; // Wert : 0-250 // Stellung des Servos |
unsigned char ServoRollComp; // Wert : 0-250 |
unsigned char ServoRollMin; // Wert : 0-250 |
unsigned char ServoRollMax; // Wert : 0-250 |
//--- |
unsigned char ServoNickRefresh; // Speed of the Servo |
unsigned char ServoManualControlSpeed;// |
unsigned char CamOrientation; // |
unsigned char Servo3; // Value or mapping of the Servo Output |
unsigned char Servo4; // Value or mapping of the Servo Output |
unsigned char Servo5; // Value or mapping of the Servo Output |
unsigned char LoopGasLimit; // Wert: 0-250 max. Gas wÀhrend Looping |
unsigned char LoopThreshold; // Wert: 0-250 Schwelle fÃŒr Stickausschlag |
unsigned char LoopHysterese; // Wert: 0-250 Hysterese fÃŒr Stickausschlag |
unsigned char AchsKopplung1; // Wert: 0-250 Faktor, mit dem Gier die Achsen Roll und Nick koppelt (NickRollMitkopplung) |
unsigned char AchsKopplung2; // Wert: 0-250 Faktor, mit dem Nick und Roll verkoppelt werden |
unsigned char CouplingYawCorrection; // Wert: 0-250 Faktor, mit dem Nick und Roll verkoppelt werden |
unsigned char WinkelUmschlagNick; // Wert: 0-250 180°-Punkt |
unsigned char WinkelUmschlagRoll; // Wert: 0-250 180°-Punkt |
unsigned char GyroAccAbgleich; // 1/k (Koppel_ACC_Wirkung) |
unsigned char Driftkomp; |
unsigned char DynamicStability; |
unsigned char UserParam5; // Wert : 0-250 |
unsigned char UserParam6; // Wert : 0-250 |
unsigned char UserParam7; // Wert : 0-250 |
unsigned char UserParam8; // Wert : 0-250 |
//---Output --------------------------------------------- |
unsigned char J16Bitmask; // for the J16 Output |
unsigned char J16Timing; // for the J16 Output |
unsigned char J17Bitmask; // for the J17 Output |
unsigned char J17Timing; // for the J17 Output |
// seit version V0.75c |
unsigned char WARN_J16_Bitmask; // for the J16 Output |
unsigned char WARN_J17_Bitmask; // for the J17 Output |
//---NaviCtrl--------------------------------------------- |
#ifdef MKVERSION090b |
unsigned char NaviOut1Parameter; // for the J16 Output |
#endif |
unsigned char NaviGpsModeControl; // Parameters for the Naviboard |
unsigned char NaviGpsGain; |
unsigned char NaviGpsP; |
unsigned char NaviGpsI; |
unsigned char NaviGpsD; |
unsigned char NaviGpsPLimit; |
unsigned char NaviGpsILimit; |
unsigned char NaviGpsDLimit; |
unsigned char NaviGpsACC; |
unsigned char NaviGpsMinSat; |
unsigned char NaviStickThreshold; |
unsigned char NaviWindCorrection; |
unsigned char NaviAccCompensation; // New since 0.86 -> was: SpeedCompensation |
unsigned char NaviOperatingRadius; |
unsigned char NaviAngleLimitation; |
unsigned char NaviPH_LoginTime; |
//---Ext.Ctrl--------------------------------------------- |
unsigned char ExternalControl; // for serial Control |
//---CareFree--------------------------------------------- |
unsigned char OrientationAngle; // Where is the front-direction? |
unsigned char CareFreeModeControl; // switch for CareFree |
unsigned char MotorSafetySwitch; |
unsigned char MotorSmooth; |
unsigned char ComingHomeAltitude; |
unsigned char FailSafeTime; |
unsigned char MaxAltitude; |
unsigned char FailsafeChannel; // if the value of this channel is > 100, the MK reports "RC-Lost" |
unsigned char ServoFilterNick; |
unsigned char ServoFilterRoll; |
//------------------------------------------------ |
unsigned char BitConfig; // (war Loop-Cfg) Bitcodiert: 0x01=oben, 0x02=unten, 0x04=links, 0x08=rechts / wird getrennt behandelt |
unsigned char ServoCompInvert; // // 0x01 = Nick, 0x02 = Roll 0x04 = relative moving // WICHTIG!!! am Ende lassen |
unsigned char ExtraConfig; // bitcodiert |
unsigned char GlobalConfig3; // bitcodiert |
char Name[12]; |
unsigned char crc; // must be the last byte! // MUST BE THE LAST BYTE! |
} __attribute__((packed)) mk_param_struct_t; |
#endif |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/motortest/motortest.c |
---|
0,0 → 1,419 |
/***************************************************************************** |
* Copyright (C) 2008 Thomas Kaiser, thomas@ft-fanpage.de * |
* Copyright (C) 2009 Peter "woggle" Mack, mac@denich.net * |
* Copyright (C) 2011 Christian "Cebra" Brandtner, brandtner@brandtner.net * |
* Copyright (C) 2011 Harald Bongartz * |
* * |
* This program is free software; you can redistribute it and/or modify * |
* it under the terms of the GNU General Public License as published by * |
* the Free Software Foundation; either version 2 of the License. * |
* * |
* This program is distributed in the hope that it will be useful, * |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
* GNU General Public License for more details. * |
* * |
* You should have received a copy of the GNU General Public License * |
* along with this program; if not, write to the * |
* Free Software Foundation, Inc., * |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
* * |
* * |
* Credits to: * |
* Holger Buss & Ingo Busker from mikrokopter.de for the MK project + SVN * |
* http://www.mikrokopter.de * |
* Gregor "killagreg" Stobrawa for his version of the MK code * |
* Thomas Kaiser "thkais" for the original project. See * |
* http://www.ft-fanpage.de/mikrokopter/ * |
* http://forum.mikrokopter.de/topic-4061-1.html * |
* Claas Anders "CaScAdE" Rathje for providing the font and his C-OSD code * |
* http://www.mylifesucks.de/oss/c-osd/ * |
* Harald Bongartz "HaraldB" for providing his Ideas and Code for usibility* |
*****************************************************************************/ |
#include "../cpu.h" |
#include <avr/io.h> |
#include <avr/interrupt.h> |
#include <avr/pgmspace.h> |
#include <string.h> |
#include <stdlib.h> |
#include "../main.h" |
#include "motortest.h" |
#include "../lcd/lcd.h" |
#include "../timer/timer.h" |
#include "../motortest/twimaster.h" |
//#include "menu.h" |
#include "../uart/uart1.h" |
#include "../uart/usart.h" |
#include "../messages.h" |
uint8_t m; |
uint8_t mmode; // 0=Value 1=Motor |
uint8_t v; |
volatile uint8_t i2c_state; |
volatile uint8_t motor_addr = 0; |
//-------------------------------------------------------------- |
// Senden der Motorwerte per I2C-Bus |
// |
void SendMotorData(uint8_t m,uint8_t v) |
{ |
if (m==0) |
for(m=0;m<MAX_MOTORS;m++) // alle Motoren |
{ |
// Motor[m].SetPoint = MotorTest[m]; |
Motor[m].SetPoint = v; |
Motor[m].SetPointLowerBits = 0; |
// Motor[i].SetPoint = MotorTest[i] / 4; // testing the high resolution |
// Motor[i].SetPointLowerBits = MotorTest[i] % 4; |
} |
else |
{ |
Motor[m-1].SetPoint = v; |
Motor[m-1].SetPointLowerBits = 0; |
} |
if(I2C_TransferActive) |
I2C_TransferActive = 0; // enable for the next time |
else |
{ |
motor_write = 0; |
I2C_Start(TWI_STATE_MOTOR_TX); //Start I2C Interrupt Mode |
} |
} |
//-------------------------------------------------------------- |
// |
void Search_BL (void) |
{ |
uint8_t i = 0; |
unsigned int timer; |
lcd_cls (); |
MotorenEin =0; |
MotorTest[i] = 0; |
lcd_printp (PSTR("Suche BL-Ctrl"), 0); |
// Check connected BL-Ctrls |
BLFlags |= BLFLAG_READ_VERSION; |
motor_read = 0; // read the first I2C-Data |
SendMotorData(0,0); |
timer = SetDelay(1); |
while(!(BLFlags & BLFLAG_TX_COMPLETE) && !CheckDelay(timer)); //wait for complete transfer |
timer = SetDelay(1); |
for(i=0; i < MAX_MOTORS; i++) |
{ |
SendMotorData(i,0); |
while(!(BLFlags & BLFLAG_TX_COMPLETE) && !CheckDelay(timer)); //wait for complete transfer |
if(Motor[i].State & MOTOR_STATE_PRESENT_MASK) |
{ |
lcd_printp_at (0, 1, PSTR("Found BL-Ctrl:"), 0); |
lcd_print_hex_at (18,1,i,0); |
lcd_printp_at (0, 2, PSTR("Version:"), 0); |
lcd_print_hex_at (8,2,Motor[i].Version,0); |
lcd_printp_at (11, 2, PSTR("SetPoi:"), 0); |
lcd_print_hex_at (18,2,Motor[i].SetPoint,0); |
lcd_printp_at (0, 3, PSTR("SetPoiL:"), 0); |
lcd_print_hex_at (8,3,Motor[i].SetPointLowerBits,0); |
lcd_printp_at (11, 3, PSTR("State :"), 0); |
lcd_print_hex_at (18,3,Motor[i].State,0); |
lcd_printp_at (0, 4, PSTR("ReadMod:"), 0); |
lcd_print_hex_at (8,4,Motor[i].ReadMode,0); |
lcd_printp_at (11, 4, PSTR("Currnt:"), 0); |
lcd_print_hex_at (18,4,Motor[i].Current,0); |
lcd_printp_at (0, 5, PSTR("MaxPWM :"), 0); |
lcd_print_hex_at (8,5,Motor[i].MaxPWM,0); |
lcd_printp_at (11, 5, PSTR("Temp :"), 0); |
write_ndigit_number_u (18,5,Motor[i].Temperature,3,1,0); |
} |
} //End For I |
} |
//-------------------------------------------------------------- |
// |
void motor (uint8_t m,uint8_t v) |
{ |
memset (buffer, 0, 16); |
if(m == 0) |
{ |
memset (buffer, v, 16); |
} |
else |
{ |
buffer[m-1] = v; |
} |
SendOutData('t', ADDRESS_FC, 1, buffer, 16); |
} |
//-------------------------------------------------------------- |
// |
void motor_test (uint8_t MotorMode) |
{ |
lcd_cls (); |
mmode = 1; // 1=Motor |
m = 1; |
v = 0; |
char buffer[7]; |
unsigned int SerLoop; |
SerLoop = 10; |
if (MotorMode == I2C_Mode) |
{ |
Search_BL(); |
do |
{ |
lcd_printp_at (11, 7, PSTR("Ende Check"), 0); |
if (get_key_press (1 << KEY_ESC)) |
{ |
get_key_press(KEY_ALL); |
return; |
} |
} |
while (!get_key_press (1 << KEY_ENTER)); |
} |
lcd_cls(); |
lcd_printp (PSTR(" BL-Ctrl Test "), 2); |
lcd_printp_at (2, 2, PSTR("Motor: 1"), 0); |
lcd_printp_at (2, 3, PSTR("Value: 0"), 0); |
lcd_frect ((8*1), (8*5), (0 * (14*8)) / 255, 6, 1); |
// lcd_printp_at (0, 7, PSTR(KEY_LINE_3), 0); |
lcd_puts_at(0, 7, strGet(KEYLINE3), 0); |
lcd_printp_at (18, 7, PSTR("\x1a \x1b"), 0); |
lcd_printp_at (0, 2, PSTR("\x1d"), 0); |
#if defined HWVERSION1_3W || defined HWVERSION1_3 || defined HWVERSION3_9 |
if (MotorMode == I2C_Mode) |
uart1_puts("Motor;Version;Setpoint high;Setpoint low;State;ReadMode;Current;MaxPWM;Temperature\r"); |
#endif |
#if defined HWVERSION1_2W || defined HWVERSION1_2 |
if (MotorMode == I2C_Mode) |
USART_puts("Motor;Version;Setpoint high;Setpoint low;State;ReadMode;Current;MaxPWM;Temperature\r"); |
#endif |
if (MotorMode == FC_Mode) |
{ |
if (hardware == NC && current_hardware == NC) |
{ |
SwitchToFC(); |
} |
} |
do |
{ |
// mmode 0=Value 1=Motor |
if ((mmode == 0) && (get_key_press (1 << KEY_PLUS) || get_key_long_rpt_sp ((1 << KEY_PLUS), 3)) && (v < 254)) |
{ |
v++; |
write_ndigit_number_u (9, 3, v, 3, 0,0); |
if (MotorMode == FC_Mode) |
lcd_frect ((8*1), (8*5), (v * (14*8)) / 255, 6, 1); |
} |
if ((mmode == 0) && (get_key_press (1 << KEY_MINUS) || get_key_long_rpt_sp ((1 << KEY_MINUS), 3)) && (v > 0)) |
{ |
if (MotorMode == FC_Mode) |
lcd_frect (((v * (14*8) / 255) + 8), (8*5), ((14*8) / 255), 6, 0); |
v--; |
write_ndigit_number_u (9, 3, v, 3, 0,0); |
if (MotorMode == FC_Mode) |
lcd_frect ((8*1), (8*5), (v * (14*8)) / 255, 6, 1); |
} |
if ((mmode == 1) && (get_key_press (1 << KEY_PLUS) || get_key_long_rpt_sp ((1 << KEY_PLUS), 1)) && (m < 16)) |
{ |
m++; |
write_ndigit_number_u (9, 2, m, 3, 0,0); |
} |
if ((mmode == 1) && (get_key_press (1 << KEY_MINUS) || get_key_long_rpt_sp ((1 << KEY_MINUS), 1)) && (m > 0)) |
{ |
m--; |
if(m > 0) |
write_ndigit_number_u (9, 2, m, 3, 0,0); |
if(m == 0) |
lcd_printp_at (9, 2, PSTR("All"), 0); |
} |
if (get_key_press (1 << KEY_ENTER)) |
{ |
if (MotorMode == I2C_Mode) |
{ |
if (v > 0) |
{ |
m = 0; |
v=0; |
lcd_frect ((8*1), (8*5), (0 * (14*8)) / 255, 6, 1); |
lcd_cls_line (0, 5, 21); |
if(m > 0) write_ndigit_number_u (9, 2, m, 3, 0,0); |
if(m == 0) lcd_printp_at (9, 2, PSTR("All"), 0); |
write_ndigit_number_u (9, 3, v, 3, 0,0); |
SendMotorData(m,v); |
timer = SetDelay(1); |
while(!(BLFlags & BLFLAG_TX_COMPLETE) && !CheckDelay(timer)); //wait for complete transfer |
} |
} |
if(mmode == 0) // 0=Value |
{ |
lcd_printp_at (0, 2, PSTR("\x1d"), 0); |
lcd_printp_at (0, 3, PSTR(" "), 0); |
mmode = 1; // 1=Motor |
} |
else |
{ |
lcd_printp_at (0, 2, PSTR(" "), 0); |
lcd_printp_at (0, 3, PSTR("\x1d"), 0); |
mmode = 0; // 0=Value |
} |
} |
//if (get_key_press (1 << KEY_ENTER))// |
if (MotorMode == I2C_Mode) |
{ |
SendMotorData(m,v); |
timer = SetDelay(1); |
lcd_printp_at (0, 3, PSTR("SetPoint :"), 0); |
write_ndigit_number_u (13,3,Motor[m-1].SetPoint,3,0,0); |
lcd_printp_at (0, 4, PSTR("Current :"), 0); |
lcd_print_hex_at (13,4,Motor[m-1].Current,0); |
write_ndigit_number_u (13,4,Motor[m-1].Current,3,0,0); |
lcd_printp_at (0, 5, PSTR("Temperature:"), 0); |
write_ndigit_number_u (13,5,Motor[m-1].Temperature,3,0,0); |
lcd_printp_at (0, 6, PSTR("Version:"), 0); |
lcd_print_hex_at (8,6,Motor[m-1].Version,0); |
lcd_printp_at (11, 6, PSTR("State :"), 0); |
lcd_print_hex_at (18,6,Motor[m-1].State,0); |
#if defined HWVERSION1_3W || defined HWVERSION1_3 || defined HWVERSION3_9 |
if (Motor[m-1].SetPoint > 0) |
{ |
if (SerLoop == 0) |
{ |
itoa( m-1, buffer, 10); // convert interger into string (decimal format) |
uart1_puts(buffer); // and transmit string to UART |
uart1_puts(";"); |
itoa( Motor[m-1].Version, buffer, 10); // |
uart1_puts(buffer); |
uart1_puts(";"); |
itoa( Motor[m-1].SetPoint, buffer, 10); // |
uart1_puts(buffer); |
uart1_puts(";"); |
itoa( Motor[m-1].SetPointLowerBits, buffer, 10); // |
uart1_puts(buffer); |
uart1_puts(";"); |
itoa( Motor[m-1].State, buffer, 10); // |
uart1_puts(buffer); |
uart1_puts(";"); |
itoa( Motor[m-1].ReadMode, buffer, 10); // |
uart1_puts(buffer); |
uart1_puts(";"); |
itoa( Motor[m-1].Current, buffer, 10); // |
uart1_puts(buffer); |
uart1_puts(";"); |
itoa( Motor[m-1].MaxPWM, buffer, 10); // |
uart1_puts(buffer); |
uart1_puts(";"); |
itoa( Motor[m-1].Temperature, buffer, 10); // |
uart1_puts(buffer); |
uart1_puts("\r"); |
uart1_puts("\n"); |
SerLoop =200; |
} |
else |
SerLoop--; |
} |
#endif |
#if defined HWVERSION1_2W || defined HWVERSION1_2 |
if (Motor[m-1].SetPoint > 0) |
{ |
if (SerLoop == 0) |
{ |
itoa( m-1, buffer, 10); // convert interger into string (decimal format) |
USART_puts(buffer); // and transmit string to UART |
USART_puts(";"); |
itoa( Motor[m-1].Version, buffer, 10); // |
USART_puts(buffer); |
USART_puts(";"); |
itoa( Motor[m-1].SetPoint, buffer, 10); // |
USART_puts(buffer); |
USART_puts(";"); |
itoa( Motor[m-1].SetPointLowerBits, buffer, 10); // |
USART_puts(buffer); |
USART_puts(";"); |
itoa( Motor[m-1].State, buffer, 10); // |
USART_puts(buffer); |
USART_puts(";"); |
itoa( Motor[m-1].ReadMode, buffer, 10); // |
USART_puts(buffer); |
USART_puts(";"); |
itoa( Motor[m-1].Current, buffer, 10); // |
USART_puts(buffer); |
USART_puts(";"); |
itoa( Motor[m-1].MaxPWM, buffer, 10); // |
USART_puts(buffer); |
USART_puts(";"); |
itoa( Motor[m-1].Temperature, buffer, 10); // |
USART_puts(buffer); |
USART_puts("\r"); |
USART_puts("\n"); |
SerLoop =200; |
} |
else |
SerLoop--; |
} |
#endif |
while(!(BLFlags & BLFLAG_TX_COMPLETE) && !CheckDelay(timer)); //wait for complete transfer |
} |
else |
motor (m,v); //if (MotorMode == I2C_Mode)// |
} |
while (!get_key_press (1 << KEY_ESC)); |
get_key_press(KEY_ALL); |
if (MotorMode == FC_Mode) |
{ |
motor(0,0); // switch all engines off at exit |
} |
} |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/motortest/motortest.h |
---|
0,0 → 1,46 |
/***************************************************************************** |
* Copyright (C) 2008 Thomas Kaiser, thomas@ft-fanpage.de * |
* Copyright (C) 2009 Peter "woggle" Mack, mac@denich.net * |
* Copyright (C) 2011 Christian "Cebra" Brandtner, brandtner@brandtner.net * |
* Copyright (C) 2011 Harald Bongartz * |
* * |
* This program is free software; you can redistribute it and/or modify * |
* it under the terms of the GNU General Public License as published by * |
* the Free Software Foundation; either version 2 of the License. * |
* * |
* This program is distributed in the hope that it will be useful, * |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
* GNU General Public License for more details. * |
* * |
* You should have received a copy of the GNU General Public License * |
* along with this program; if not, write to the * |
* Free Software Foundation, Inc., * |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
* * |
* * |
* Credits to: * |
* Holger Buss & Ingo Busker from mikrokopter.de for the MK project + SVN * |
* http://www.mikrokopter.de * |
* Gregor "killagreg" Stobrawa for his version of the MK code * |
* Thomas Kaiser "thkais" for the original project. See * |
* http://www.ft-fanpage.de/mikrokopter/ * |
* http://forum.mikrokopter.de/topic-4061-1.html * |
* Claas Anders "CaScAdE" Rathje for providing the font and his C-OSD code * |
* http://www.mylifesucks.de/oss/c-osd/ * |
* Harald Bongartz "HaraldB" for providing his Ideas and Code for usibility* |
*****************************************************************************/ |
#ifndef _MOTORTEST_H |
#define _MOTORTEST_H |
#define I2C_Mode 1 // Motortest Lokal |
#define FC_Mode 2 // Motortest ueber FC |
void motor_test (uint8_t MotorMode); |
void SendMotorData(uint8_t m,uint8_t v); |
#endif |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/motortest/twimaster.c |
---|
0,0 → 1,511 |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Copyright (c) Holger Buss, Ingo Busker |
// + Nur f?r den privaten Gebrauch |
// + www.MikroKopter.com |
// + porting the sources to other systems or using the software on other systems (except hardware from www.mikrokopter.de) is not allowed |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Es gilt f?r das gesamte Projekt (Hardware, Software, Bin?rfiles, Sourcecode und Dokumentation), |
// + dass eine Nutzung (auch auszugsweise) nur f?r den privaten (nicht-kommerziellen) Gebrauch zul?ssig ist. |
// + Sollten direkte oder indirekte kommerzielle Absichten verfolgt werden, ist mit uns (info@mikrokopter.de) Kontakt |
// + bzgl. der Nutzungsbedingungen aufzunehmen. |
// + Eine kommerzielle Nutzung ist z.B.Verkauf von MikroKoptern, Best?ckung und Verkauf von Platinen oder Baus?tzen, |
// + Verkauf von Luftbildaufnahmen, usw. |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Werden Teile des Quellcodes (mit oder ohne Modifikation) weiterverwendet oder ver?ffentlicht, |
// + unterliegen sie auch diesen Nutzungsbedingungen und diese Nutzungsbedingungen incl. Copyright m?ssen dann beiliegen |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Sollte die Software (auch auszugesweise) oder sonstige Informationen des MikroKopter-Projekts |
// + auf anderen Webseiten oder sonstigen Medien ver?ffentlicht werden, muss unsere Webseite "http://www.mikrokopter.de" |
// + eindeutig als Ursprung verlinkt werden |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Keine Gew?hr auf Fehlerfreiheit, Vollst?ndigkeit oder Funktion |
// + Benutzung auf eigene Gefahr |
// + Wir ?bernehmen keinerlei Haftung f?r direkte oder indirekte Personen- oder Sachsch?den |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Portierung der Software (oder Teile davon) auf andere Systeme (ausser der Hardware von www.mikrokopter.de) ist nur |
// + mit unserer Zustimmung zul?ssig |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Funktion printf_P() unterliegt ihrer eigenen Lizenz und ist hiervon nicht betroffen |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Redistributions of source code (with or without modifications) must retain the above copyright notice, |
// + this list of conditions and the following disclaimer. |
// + * Neither the name of the copyright holders nor the names of contributors may be used to endorse or promote products derived |
// + from this software without specific prior written permission. |
// + * The use of this project (hardware, software, binary files, sources and documentation) is only permittet |
// + for non-commercial use (directly or indirectly) |
// + Commercial use (for excample: selling of MikroKopters, selling of PCBs, assembly, ...) is only permitted |
// + with our written permission |
// + * If sources or documentations are redistributet on other webpages, out webpage (http://www.MikroKopter.de) must be |
// + clearly linked as origin |
// + * porting to systems other than hardware from www.mikrokopter.de is not allowed |
// + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
// + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
// + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
// + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
// + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
// + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
// + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
// + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN// + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
// + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
// + POSSIBILITY OF SUCH DAMAGE. |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
#include "../cpu.h" |
#include <avr/io.h> |
#include <avr/interrupt.h> |
#include <util/twi.h> |
#include <util/delay.h> |
#include "../eeprom/eeprom.h" |
#include "../motortest/twimaster.h" |
#include "../timer/timer.h" |
volatile uint8_t twi_state = TWI_STATE_MOTOR_TX; |
volatile uint8_t dac_channel = 0; |
volatile uint8_t motor_write = 0; |
volatile uint8_t motor_read = 0; |
volatile uint8_t I2C_TransferActive = 0; |
volatile uint16_t I2CTimeout = 100; |
uint8_t MissingMotor = 0; |
uint8_t RequiredMotors = 1; |
char MotorenEin = 0; |
volatile uint8_t BLFlags = 0; |
MotorData_t Motor[MAX_MOTORS]; |
// bit mask for witch BL the configuration should be sent |
volatile uint16_t BLConfig_WriteMask = 0; |
// bit mask for witch BL the configuration should be read |
volatile uint16_t BLConfig_ReadMask = 0; |
// buffer for BL Configuration |
BLConfig_t BLConfig; |
#define I2C_WriteByte(byte) {TWDR = byte; TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWIE);} |
#define I2C_ReceiveByte() {TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWIE) | (1<<TWEA);} |
#define I2C_ReceiveLastByte() {TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWIE);} |
#define SCL_CLOCK 200000L |
#define I2C_TIMEOUT 30000 |
#define TWI_BASE_ADDRESS 0x52 |
uint8_t RAM_Checksum(uint8_t* pBuffer, uint16_t len) |
{ |
uint8_t crc = 0xAA; |
uint16_t i; |
for(i=0; i<len; i++) |
{ |
crc += pBuffer[i]; |
} |
return crc; |
} |
//-------------------------------------------------------------- |
// Initialize I2C (TWI) |
// |
void I2C_Init(char clear) |
{ |
uint8_t i; |
uint8_t sreg = SREG; |
cli(); |
// SDA is INPUT |
DDRC &= ~(1<<DDC1); |
// SCL is output |
DDRC |= (1<<DDC0); |
// pull up SDA |
//PORTC |= (1<<PORTC0)|(1<<PORTC1); |
// TWI Status Register |
// prescaler 1 (TWPS1 = 0, TWPS0 = 0) |
TWSR &= ~((1<<TWPS1)|(1<<TWPS0)); |
// set TWI Bit Rate Register |
TWBR = ((F_CPU/SCL_CLOCK)-16)/2; |
twi_state = TWI_STATE_MOTOR_TX; |
motor_write = 0; |
motor_read = 0; |
if(clear) for(i=0; i < MAX_MOTORS; i++) |
{ |
Motor[i].Version = 0; |
Motor[i].SetPoint = 0; |
Motor[i].SetPointLowerBits = 0; |
Motor[i].State = 0; |
Motor[i].ReadMode = BL_READMODE_STATUS; |
Motor[i].Current = 0; |
Motor[i].MaxPWM = 0; |
Motor[i].Temperature = 0; |
} |
sei(); |
SREG = sreg; |
} |
//-------------------------------------------------------------- |
void I2C_Reset(void) |
{ |
// stop i2c bus |
I2C_Stop(TWI_STATE_MOTOR_TX); |
TWCR = (1<<TWINT); // reset to original state incl. interrupt flag reset |
TWAMR = 0; |
TWAR = 0; |
TWDR = 0; |
TWSR = 0; |
TWBR = 0; |
I2C_TransferActive = 0; |
I2C_Init(0); |
I2C_WriteByte(0); |
BLFlags |= BLFLAG_READ_VERSION; |
} |
//-------------------------------------------------------------- |
// I2C ISR |
// |
ISR (TWI_vect) |
{ |
static uint8_t missing_motor = 0, motor_read_temperature = 0; |
static uint8_t *pBuff = 0; |
static uint8_t BuffLen = 0; |
switch (twi_state++) |
{ |
// Master Transmit |
case 0: // TWI_STATE_MOTOR_TX |
I2C_TransferActive = 1; |
// skip motor if not used in mixer |
// while((Mixer.Motor[motor_write][MIX_GAS] <= 0) && (motor_write < MAX_MOTORS)) motor_write++; |
if(motor_write >= MAX_MOTORS) // writing finished, read now |
{ |
BLConfig_WriteMask = 0; // reset configuration bitmask |
motor_write = 0; // reset motor write counter for next cycle |
twi_state = TWI_STATE_MOTOR_RX; |
I2C_WriteByte(TWI_BASE_ADDRESS + TW_READ + (motor_read<<1) ); // select slave address in rx mode |
} |
else I2C_WriteByte(TWI_BASE_ADDRESS + TW_WRITE + (motor_write<<1) ); // select slave address in tx mode |
break; |
case 1: // Send Data to Slave |
I2C_WriteByte(Motor[motor_write].SetPoint); // transmit setpoint |
// if old version has been detected |
if(!(Motor[motor_write].Version & MOTOR_STATE_NEW_PROTOCOL_MASK)) |
{ |
twi_state = 4; //jump over sending more data |
} |
// the new version has been detected |
else if(!( (Motor[motor_write].SetPointLowerBits && (RequiredMotors < 7)) || BLConfig_WriteMask || BLConfig_ReadMask ) ) |
{ // or LowerBits are zero and no BlConfig should be sent (saves round trip time) |
twi_state = 4; //jump over sending more data |
} |
break; |
case 2: // lower bits of setpoint (higher resolution) |
if ((0x0001<<motor_write) & BLConfig_ReadMask) |
{ |
Motor[motor_write].ReadMode = BL_READMODE_CONFIG; // configuration request |
} |
else |
{ |
Motor[motor_write].ReadMode = BL_READMODE_STATUS; // normal status request |
} |
// send read mode and the lower bits of setpoint |
I2C_WriteByte((Motor[motor_write].ReadMode<<3)|(Motor[motor_write].SetPointLowerBits & 0x07)); |
// configuration tranmission request? |
if((0x0001<<motor_write) & BLConfig_WriteMask) |
{ // redirect tx pointer to configuration data |
pBuff = (uint8_t*)&BLConfig; // select config for motor |
BuffLen = sizeof(BLConfig_t); |
} |
else |
{ // jump to end of transmission for that motor |
twi_state = 4; |
} |
break; |
case 3: // send configuration |
I2C_WriteByte(*pBuff); |
pBuff++; |
if(--BuffLen > 0) |
twi_state = 3; // if there are some bytes left |
break; |
case 4: // repeat case 0-4 for all motors |
if(TWSR == TW_MT_DATA_NACK) // Data transmitted, NACK received |
{ |
if(!missing_motor) |
missing_motor = motor_write + 1; |
if((Motor[motor_write].State & MOTOR_STATE_ERROR_MASK) < MOTOR_STATE_ERROR_MASK) |
Motor[motor_write].State++; // increment error counter and handle overflow |
} |
I2C_Stop(TWI_STATE_MOTOR_TX); |
I2CTimeout = 10; |
motor_write++; // next motor |
I2C_Start(TWI_STATE_MOTOR_TX); // Repeated start -> switch slave or switch Master Transmit -> Master Receive |
break; |
// Master Receive Data |
case 5: // TWI_STATE_MOTOR_RX |
if(TWSR != TW_MR_SLA_ACK) // SLA+R transmitted but no ACK received |
{ // no response from the addressed slave received |
Motor[motor_read].State &= ~MOTOR_STATE_PRESENT_MASK; // clear present bit |
if(++motor_read >= MAX_MOTORS) |
{ // all motors read |
motor_read = 0; // restart from beginning |
BLConfig_ReadMask = 0; // reset read configuration bitmask |
if(++motor_read_temperature >= MAX_MOTORS) |
{ |
motor_read_temperature = 0; |
BLFlags &= ~BLFLAG_READ_VERSION; |
} |
} |
BLFlags |= BLFLAG_TX_COMPLETE; |
I2C_Stop(TWI_STATE_MOTOR_TX); |
I2C_TransferActive = 0; |
} |
else |
{ // motor successfully addressed |
Motor[motor_read].State |= MOTOR_STATE_PRESENT_MASK; // set present bit |
if(Motor[motor_read].Version & MOTOR_STATE_NEW_PROTOCOL_MASK) |
{ |
// new BL found |
switch(Motor[motor_read].ReadMode) |
{ |
case BL_READMODE_CONFIG: |
pBuff = (uint8_t*)&BLConfig; |
BuffLen = sizeof(BLConfig_t); |
break; |
case BL_READMODE_STATUS: |
pBuff = (uint8_t*)&(Motor[motor_read].Current); |
if(motor_read == motor_read_temperature) BuffLen = 3; // read Current, MaxPwm & Temp |
else BuffLen = 1;// read Current only |
break; |
} |
} |
else // old BL version |
{ |
pBuff = (uint8_t*)&(Motor[motor_read].Current); |
if((BLFlags & BLFLAG_READ_VERSION) || (motor_read == motor_read_temperature)) BuffLen = 2; // Current & MaxPwm |
else BuffLen = 1; // read Current only |
} |
if(BuffLen == 1) |
{ |
I2C_ReceiveLastByte(); // read last byte |
} |
else |
{ |
I2C_ReceiveByte(); // read next byte |
} |
} |
MissingMotor = missing_motor; |
missing_motor = 0; |
break; |
case 6: // receive bytes |
*pBuff = TWDR; |
pBuff++; |
BuffLen--; |
if(BuffLen>1) |
{ |
I2C_ReceiveByte(); // read next byte |
} |
else if (BuffLen == 1) |
{ |
I2C_ReceiveLastByte(); // read last byte |
} |
else // nothing left |
{ |
if(BLFlags & BLFLAG_READ_VERSION) |
{ |
// if(!(FC_StatusFlags & FC_STATUS_MOTOR_RUN) && (Motor[motor_read].MaxPWM == 250) ) Motor[motor_read].Version |= MOTOR_STATE_NEW_PROTOCOL_MASK; |
if((Motor[motor_read].MaxPWM == 250) ) Motor[motor_read].Version |= MOTOR_STATE_NEW_PROTOCOL_MASK; |
else Motor[motor_read].Version = 0; |
} |
if(++motor_read >= MAX_MOTORS) |
{ |
motor_read = 0; // restart from beginning |
BLConfig_ReadMask = 0; // reset read configuration bitmask |
if(++motor_read_temperature >= MAX_MOTORS) |
{ |
motor_read_temperature = 0; |
BLFlags &= ~BLFLAG_READ_VERSION; |
} |
} |
I2C_Stop(TWI_STATE_MOTOR_TX); |
BLFlags |= BLFLAG_TX_COMPLETE; |
I2C_TransferActive = 0; |
return; |
} |
twi_state = 6; // if there are some bytes left |
break; |
case 21: |
I2C_WriteByte(0x80); // 2nd byte for all channels is 0x80 |
break; |
case 22: |
I2C_Stop(TWI_STATE_MOTOR_TX); |
I2C_TransferActive = 0; |
I2CTimeout = 10; |
// repeat case 18...22 until all DAC Channels are updated |
if(dac_channel < 2) |
{ |
dac_channel ++; // jump to next channel |
I2C_Start(TWI_STATE_GYRO_OFFSET_TX); // start transmission for next channel |
} |
else |
{ |
dac_channel = 0; // reset dac channel counter |
BLFlags |= BLFLAG_TX_COMPLETE; |
} |
break; |
default: |
I2C_Stop(TWI_STATE_MOTOR_TX); |
BLFlags |= BLFLAG_TX_COMPLETE; |
I2CTimeout = 10; |
motor_write = 0; |
motor_read = 0; |
I2C_TransferActive = 0; |
break; |
} |
} |
//-------------------------------------------------------------- |
uint8_t I2C_WriteBLConfig(uint8_t motor) |
{ |
uint8_t i; |
uint16_t timer; |
// if(MotorenEin || PC_MotortestActive) |
// return(BLCONFIG_ERR_MOTOR_RUNNING); // not when motors are running! |
if(MotorenEin) |
return(BLCONFIG_ERR_MOTOR_RUNNING); // not when motors are running! |
if(motor > MAX_MOTORS) |
return (BLCONFIG_ERR_MOTOR_NOT_EXIST); // motor does not exist! |
if(motor) |
{ |
if(!(Motor[motor-1].State & MOTOR_STATE_PRESENT_MASK)) |
return(BLCONFIG_ERR_MOTOR_NOT_EXIST); // motor does not exist! |
if(!(Motor[motor-1].Version & MOTOR_STATE_NEW_PROTOCOL_MASK)) |
return(BLCONFIG_ERR_HW_NOT_COMPATIBLE); // not a new BL! |
} |
// check BL configuration to send |
if(BLConfig.Revision != BLCONFIG_REVISION) |
return (BLCONFIG_ERR_SW_NOT_COMPATIBLE); // bad revison |
i = RAM_Checksum((uint8_t*)&BLConfig, sizeof(BLConfig_t) - 1); |
if(i != BLConfig.crc) |
return(BLCONFIG_ERR_CHECKSUM); // bad checksum |
timer = SetDelay(2000); |
while(!(BLFlags & BLFLAG_TX_COMPLETE) && !CheckDelay(timer)); //wait for complete transfer |
// prepare the bitmask |
if(!motor) // 0 means all |
{ |
BLConfig_WriteMask = 0xFF; // all motors at once with the same configuration |
} |
else //only one specific motor |
{ |
BLConfig_WriteMask = 0x0001<<(motor-1); |
} |
for(i = 0; i < MAX_MOTORS; i++) |
{ |
if((0x0001<<i) & BLConfig_WriteMask) |
{ |
Motor[i].SetPoint = 0; |
Motor[i].SetPointLowerBits = 0; |
} |
} |
motor_write = 0; |
// needs at least MAX_MOTORS loops of 2 ms (12*2ms = 24ms) |
do |
{ |
I2C_Start(TWI_STATE_MOTOR_TX); // start an i2c transmission |
while(!(BLFlags & BLFLAG_TX_COMPLETE) && !CheckDelay(timer)); //wait for complete transfer |
} |
while(BLConfig_WriteMask && !CheckDelay(timer)); // repeat until the BL config has been sent |
if(BLConfig_WriteMask) return(BLCONFIG_ERR_MOTOR_NOT_EXIST); |
return(BLCONFIG_SUCCESS); |
} |
//-------------------------------------------------------------- |
uint8_t I2C_ReadBLConfig(uint8_t motor) |
{ |
uint8_t i; |
uint16_t timer; |
// if(MotorenEin || PC_MotortestActive) |
return(BLCONFIG_ERR_MOTOR_RUNNING); // not when motors are running! |
if(MotorenEin) |
return(BLCONFIG_ERR_MOTOR_RUNNING); // not when motors are running! |
if(motor > MAX_MOTORS) |
return (BLCONFIG_ERR_MOTOR_NOT_EXIST); // motor does not exist! |
if(motor == 0) |
return (BLCONFIG_ERR_READ_NOT_POSSIBLE); |
if(!(Motor[motor-1].State & MOTOR_STATE_PRESENT_MASK)) |
return(BLCONFIG_ERR_MOTOR_NOT_EXIST); // motor does not exist! |
if(!(Motor[motor-1].Version & MOTOR_STATE_NEW_PROTOCOL_MASK)) |
return(BLCONFIG_ERR_HW_NOT_COMPATIBLE); // not a new BL! |
timer = SetDelay(2000); |
while(!(BLFlags & BLFLAG_TX_COMPLETE) && !CheckDelay(timer)); //wait for complete transfer |
// prepare the bitmask |
BLConfig_ReadMask = 0x0001<<(motor-1); |
for(i = 0; i < MAX_MOTORS; i++) |
{ |
if((0x0001<<i) & BLConfig_ReadMask) |
{ |
Motor[i].SetPoint = 0; |
Motor[i].SetPointLowerBits = 0; |
} |
} |
motor_read = 0; |
BLConfig.Revision = 0; // bad revision |
BLConfig.crc = 0; // bad checksum |
// needs at least MAX_MOTORS loops of 2 ms (12*2ms = 24ms) |
do |
{ |
I2C_Start(TWI_STATE_MOTOR_TX); // start an i2c transmission |
while(!(BLFlags & BLFLAG_TX_COMPLETE) && !CheckDelay(timer)); //wait for complete transfer |
}while(BLConfig_ReadMask && !CheckDelay(timer)); // repeat until the BL config has been received from all motors |
// validate result |
if(BLConfig.Revision != BLCONFIG_REVISION) return (BLCONFIG_ERR_SW_NOT_COMPATIBLE); // bad revison |
i = RAM_Checksum((uint8_t*)&BLConfig, sizeof(BLConfig_t) - 1); |
if(i != BLConfig.crc) return(BLCONFIG_ERR_CHECKSUM); // bad checksum |
return(BLCONFIG_SUCCESS); |
} |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/motortest/twimaster.h |
---|
0,0 → 1,80 |
#ifndef _I2C_MASTER_H |
#define _I2C_MASTER_H |
+ |
+#include <inttypes.h> |
+#include "../mk-data-structs.h" |
+ |
+#define TWI_STATE_MOTOR_TX 0 |
+#define TWI_STATE_MOTOR_RX 5 |
+#define TWI_STATE_GYRO_OFFSET_TX 18 |
+ |
+extern volatile uint8_t twi_state; |
+extern volatile uint8_t motor_write; |
+extern volatile uint8_t motor_read; |
+extern volatile uint8_t I2C_TransferActive; |
+ |
+extern uint8_t MissingMotor; |
+ |
+#define MAX_MOTORS 12 |
+#define MOTOR_STATE_PRESENT_MASK 0x80 |
+#define MOTOR_STATE_ERROR_MASK 0x7F |
+#define MOTOR_STATE_NEW_PROTOCOL_MASK 0x01 |
+#define BLFLAG_TX_COMPLETE 0x01 |
+#define BLFLAG_READ_VERSION 0x02 |
+ |
+extern volatile uint8_t BLFlags; |
+extern char MotorenEin; |
+unsigned char MotorTest[16]; |
+#define BL_READMODE_STATUS 0 |
+#define BL_READMODE_CONFIG 16 |
+ |
+ |
+ |
+extern MotorData_t Motor[MAX_MOTORS]; |
+ |
+#define BLCONFIG_REVISION 2 |
+ |
+#define MASK_SET_PWM_SCALING 0x01 |
+#define MASK_SET_CURRENT_LIMIT 0x02 |
+#define MASK_SET_TEMP_LIMIT 0x04 |
+#define MASK_SET_CURRENT_SCALING 0x08 |
+#define MASK_SET_BITCONFIG 0x10 |
+#define MASK_RESET_CAPCOUNTER 0x20 |
+#define MASK_SET_DEFAULT_PARAMS 0x40 |
+#define MASK_SET_SAVE_EEPROM 0x80 |
+ |
+#define BITCONF_REVERSE_ROTATION 0x01 |
+#define BITCONF_RES1 0x02 |
+#define BITCONF_RES2 0x04 |
+#define BITCONF_RES3 0x08 |
+#define BITCONF_RES4 0x10 |
+#define BITCONF_RES5 0x20 |
+#define BITCONF_RES6 0x40 |
+#define BITCONF_RES7 0x80 |
+ |
+ |
+ |
+extern BLConfig_t BLConfig; |
+ |
+extern volatile uint16_t I2CTimeout; |
+ |
+void I2C_Init(char); // Initialize I2C |
+#define I2C_Start(start_state) {twi_state = start_state; BLFlags &= ~BLFLAG_TX_COMPLETE; TWCR = (1<<TWSTA) | (1<<TWEN) | (1<<TWINT) | (1<<TWIE);} |
+#define I2C_Stop(start_state) {twi_state = start_state; TWCR = (1<<TWEN) | (1<<TWSTO) | (1<<TWINT);} |
+void I2C_Reset(void); // Reset I2C |
+ |
+#define BLCONFIG_SUCCESS 0 |
+#define BLCONFIG_ERR_MOTOR_RUNNING 1 |
+#define BLCONFIG_ERR_MOTOR_NOT_EXIST 2 |
+#define BLCONFIG_ERR_HW_NOT_COMPATIBLE 3 |
+#define BLCONFIG_ERR_SW_NOT_COMPATIBLE 4 |
+#define BLCONFIG_ERR_CHECKSUM 5 |
+#define BLCONFIG_ERR_READ_NOT_POSSIBLE 6 |
+ |
+uint8_t I2C_WriteBLConfig(uint8_t motor); |
+uint8_t I2C_ReadBLConfig(uint8_t motor); |
+ |
+#endif |
+ |
+ |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/osd/.directory |
---|
0,0 → 1,3 |
[Dolphin] |
Timestamp=2013,3,11,20,48,32 |
ViewMode=1 |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/osd/osd.c |
---|
0,0 → 1,2725 |
/***************************************************************************** |
* Copyright (C) 2008 Thomas Kaiser, thomas@ft-fanpage.de * |
* Copyright (C) 2009 Peter "woggle" Mack, mac@denich.net * |
* Copyright (C) 2011 Christian "Cebra" Brandtner, brandtner@brandtner.net * |
* Copyright (C) 2011 Harald Bongartz * |
* * |
* This program is free software; you can redistribute it and/or modify * |
* it under the terms of the GNU General Public License as published by * |
* the Free Software Foundation; either version 2 of the License. * |
* * |
* This program is distributed in the hope that it will be useful, * |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
* GNU General Public License for more details. * |
* * |
* You should have received a copy of the GNU General Public License * |
* along with this program; if not, write to the * |
* Free Software Foundation, Inc., * |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
* * |
* * |
* Credits to: * |
* Holger Buss & Ingo Busker from mikrokopter.de for the MK project + SVN * |
* http://www.mikrokopter.de * |
* Gregor "killagreg" Stobrawa for his version of the MK code * |
* Thomas Kaiser "thkais" for the original project. See * |
* http://www.ft-fanpage.de/mikrokopter/ * |
* http://forum.mikrokopter.de/topic-4061-1.html * |
* Claas Anders "CaScAdE" Rathje for providing the font and his C-OSD code * |
* http://www.mylifesucks.de/oss/c-osd/ * |
* Harald Bongartz "HaraldB" for providing his Ideas and Code for usibility* |
*****************************************************************************/ |
//############################################################################ |
//# HISTORY osd.c |
//# |
//# 10.03.2013 OG |
//# - fix: doppelte Degree-Anzeige in OSD_Element_CompassDegree() |
//# - add: neuer Screen "MK-Status" |
//# - add: 7 neue OSD-Flags |
//# - chg: Screen-Refresh Zeit via timer2 (einstellbar durch define OSD_REFRESH_TIME) |
//# - chg: mit define OSD_DEBUG_SCREEN kann ein zusaetzlicher Screen verwendet werden zum testen/entwickeln |
//# - del: entfernt CFG2_HEIGHT_LIMIT in OSD_Element_AltitudeControl() (bis bessere Loesung gefunden ist) |
//# |
//# 08.03.2013 OG |
//# - del: OSD_Screen_Element() und cleanup in osd.h |
//# - add: OSD_Element_UpDown() (steigend/sinken via Pfeilen) |
//# - chg: OSD_Element_UpDown() in Screen "General" und "Navigation" hinzugefuegt (rechts neben der Hoehenanzeige) |
//# - chg: Screen "General" die Sat-Warnung wurde auf OSD_Element_Flag(OSD_FLAG_S0) geaendert |
//# - chg: Anzeige von Flag 'nicht genug GPS-Sateliten' (OSD_FLAG_S0) auf "S!" geändert |
//# |
//# 07.03.2013 OG |
//# - Hinweis bzgl. LowBatt-Anzeige in den Screens "General" und "Navigation": |
//# Es gibt zwei unabhängige LowBatt-Warnungen. |
//# 1. die PKT LowBatt-Warnung: sie arbeitet mit der im PKT hinterlegten |
//# LowBatt Spannung und stellt den Spannungswert inkl. der Einheit "V" |
//# invers dar wenn der Warnwert erreicht wurde (inkl. lautem PKT-Peepen) |
//# 2. die MK-LowBatt Warnung: hierbeit wird das Flag "BA" angezeigt wenn |
//# der MK eine LowBatt Warnung sendet |
//# Dadurch hat man nun zwei verschiedene LowBatt Warnungen die man auf Wunsch |
//# verschieden einstellen kann. Bei mir ist die PKT-LowBatt etwas niedriger |
//# eingestellt als die MK-Warnung und bedeutet "es ist aller hoechste Zeit zu landen". |
//# Die Spannung der MK-LowBat ist ein wenig hoeher eingestellt und |
//# zeigt mir "es ist bald Zeit zu landen". |
//# - del: Kommunikation zu FC - siehe Kommentare in osd() |
//# - chg: Kommunikation zu NC - siehe Kommentare in osd() |
//# - add: neuer Screen "Navigation" |
//# - chg: Layout Screen "Statistics" - Einheiten um zwei Pixel nach rechts verschoben |
//# - chg: Layout von Screen "General" modifiziert (u.a. xoffs,yoffs Pixelverschiebungen) |
//# - add: OSD_FLAG_BA in Screen "General" |
//# - add: die OSD_Element_xyz() Funktionen in osd.h aufgenommen |
//# - chg: an verschiedenen Stellen die Char-Drawmode defines MNORMAL, MINVERS, usw. eingebaut |
//# - del: Kompatibilitaetscode fuer "3D-Lage" ueber Hauptmenue entfernt |
//# - chg: die Funktionen OSD_Element_Switch() und OSD_Element_SwitchLabel() heissen |
//# nun OSD_Element_Flag() und OSD_Element_Flag_Label() |
//# - chg: die defines OSD_SWITCH_xy heissen jetzt OSD_FLAG_xy |
//# - fix: letzte GPS-Koordinaten werden jetzt permanent Config.LastLatitude, Config.LastLongitude gespeichert |
//# |
//# 03.03.2013 OG |
//# - add: delay in Mainloop von osd() um springende Werte abzudaempfen (TEST) |
//# - add: Startverzoegerung der Screens bis NaviData sich etwas stabilisiert hat (TEST) |
//# - add: OSD Startup Message "connecting MK..." |
//# - add: 'Emergency Landing' (EL) Anzeige in Screen "General" |
//# - del: OUT1/OUT2 Anzeige in Screen "General" |
//# - add: RC-Quality in Screen "General" |
//# - add: func: draw_symbol_rc() (alternative RC-Quality Symbol) |
//# - fix: Hoehenanzeige fuer Screens "OSD0" und "OSD1" |
//# - fix: OSD_Element_SwitchLabel() angepasst fuer x=0 und y=0 |
//# - add: OSD_Element_Switch/Label() erweitert um OSD_SWITCH_FS |
//# - fix: Screen-Redraw nach OSD_Timeout() und anderen Fehlermeldungen |
//# - chg: messages.c: STATS_ITEM_0 bis STATS_ITEM_6 angepasst (1 char kuerzer) |
//# - chg: Layout von OSD_Info() - mehr background-clear und etwas kleiner |
//# |
//# 02.03.2013 OG |
//# - chg: keine internal func in Screen's wegen warnings bei anderen |
//# - del: Screen "OSD3" |
//# - fix: Hoehenanzeige in Screen "General" (Minuszeichen) |
//# - add: MK LowBat Warning in Screen "General" |
//# - add: neues Degree Symbol (als func) in Screen General (kleiner als das Char 0x1E) |
//# - add: weitere Flags in OSD_Element_Flag() |
//# |
//# 01.03.2013 OG |
//# - Reskrukturierung Code (+ neuer OSD-Screens und einiges mehr) |
//############################################################################ |
//############################################################################ |
//# HINWEISE: |
//# |
//# 1. define: OSD_DEMO |
//# mit define OSD_DEMO wird ein Demo-Modus bei den neuen Screens einge- |
//# schaltet - damit werden u.a. alle Flag's angezeigt fuer Scree-Fotos |
//# |
//# 2. define: OSD_DEBUG_SCREEN |
//# mit diesem define wird ein zusaetzlicher Screen "Debug" einkompiliert |
//# fuer Test / Experimente / Debug von OSD-Elementen |
//# |
//# 3. Informationen zum Display |
//# DOG: 128 x 64 Pixel with 6x8 Font => 21 x 8 |
//############################################################################ |
#include "../cpu.h" |
#include <avr/io.h> |
#include <inttypes.h> |
#include <stdlib.h> |
#include <avr/pgmspace.h> |
#include <util/delay.h> |
#include "../main.h" |
#include "../osd/osd.h" |
#include "../lcd/lcd.h" |
#include "../timer/timer.h" |
#include "../uart/usart.h" |
#include "../eeprom/eeprom.h" |
#include "../messages.h" |
#include "../parameter.h" |
#include "../sound/pwmsine8bit.h" |
#include "../mk-data-structs.h" |
//#define OSD_DEMO // zeigt Demo-Daten in den OSD-Screens (sofern vom Screen unterstuetzt) |
//#define OSD_DEBUG_SCREEN // zusaetzlichen Debug-Screen aktivieren |
#define OSD_REFRESH_TIME 45 // Screen Refresh; ein Wert von 100 entspricht ca. 1 Sekunde (Steuerung via timer2) |
#define COSD_WASFLYING 4 |
#define TIMEOUT 200 // 2 sec |
// Hier Höhenanzeigefehler Korrigieren |
#define AltimeterAdjust 1.5 |
// global definitions and global vars |
NaviData_t *naviData; |
mk_param_struct_t *mk_param_struct; |
uint8_t Flags_ExtraConfig; |
uint8_t Flags_GlobalConfig; |
uint8_t Flags_GlobalConfig3; |
unsigned char Element; |
uint16_t heading_home; |
uint8_t drawmode; |
// flags from last round to check for changes |
uint8_t old_FCFlags = 0; |
uint8_t old_AngleNick = 0; |
uint8_t old_AngleRoll = 0; |
uint16_t old_hh = 0; |
// stats for after flight |
int16_t max_Altimeter = 0; |
uint16_t max_GroundSpeed = 0; |
int16_t max_Distance = 0; |
uint8_t min_UBat = 255; |
uint16_t max_FlyingTime = 0; |
uint16_t max_Current = 0; |
uint16_t max_Capacity = 0; |
// cache old vars for blinking attribute, checkup is faster than full |
// attribute write each time |
volatile uint8_t last_UBat = 255; |
volatile uint8_t last_RC_Quality = 255; |
volatile uint16_t ftimer = 0; |
volatile uint8_t OSD_active; |
uint8_t Vario_Beep_Up = 0; |
uint8_t Vario_Beep_Down = 0; |
uint8_t Vario_Beep_Up_Interval = 9; |
uint8_t Vario_Beep_Down_Interval = 6; |
uint8_t Vario_Threshold = 0; |
uint8_t Vario_Threshold_Value = 7; |
uint8_t OldWP = 0; |
uint8_t NextWP = 0; |
//char* rose = "-+-N-+-O-+-S-+-W-+-N-+-O-+-S-+-W-+-N-+-O-+-S-+-W"; |
const char rose[48] PROGMEM = { |
0x0e, 0x0f, 0x0e, 'N', 0x0e, 0x0f, 0x0e, 'O', 0x0e, 0x0f, 0x0e, 'S', |
0x0e, 0x0f, 0x0e, 'W', 0x0e, 0x0f, 0x0e, 'N', 0x0e, 0x0f, 0x0e, 'O', |
0x0e, 0x0f, 0x0e, 'S', 0x0e, 0x0f, 0x0e, 'W', 0x0e, 0x0f, 0x0e, 'N', |
0x0e, 0x0f, 0x0e, 'O', 0x0e, 0x0f, 0x0e, 'S', 0x0e, 0x0f, 0x0e, 'W', |
}; |
// the center is char 19 (north), we add the current heading in 8th |
// which would be 22.5 degrees, but float would bloat up the code |
// and *10 / 225 would take ages... so we take the uncorrect way |
const char str_NE[] PROGMEM = "NE"; |
const char str_E[] PROGMEM = "E "; |
const char str_SE[] PROGMEM = "SE"; |
const char str_S[] PROGMEM = "S "; |
const char str_SW[] PROGMEM = "SW"; |
const char str_W[] PROGMEM = "W "; |
const char str_NW[] PROGMEM = "NW"; |
const char str_N[] PROGMEM = "N "; |
const char *directions_p[8] PROGMEM = { |
str_NE, |
str_E, |
str_SE, |
str_S, |
str_SW, |
str_W, |
str_NW, |
str_N |
}; |
#define MAX_CELL_VOLTAGE 43 // max cell voltage for LiPO |
#define MIN_CELL_VOLTAGE 32 // min cell voltage for LiPO |
// Flags |
GPS_Pos_t last5pos[7]; |
uint8_t COSD_FLAGS2 = 0; |
volatile uint8_t error = 0; |
uint8_t cells = 0; |
uint8_t BattLowVoltageWarning = 0; |
uint8_t CellIsChecked = 0; |
uint8_t AkkuWarnThreshold = 0; |
uint16_t duration = 0; |
//########################################################### |
//########################################################### |
//-------------------------------------------------------------- |
//-------------------------------------------------------------- |
void variobeep(int16_t vario) |
{ |
{ //start Beep |
if (vario >0 ) // MK steigt |
{ |
Vario_Beep_Down = 0; // Down Beep freischalten |
Vario_Threshold++; |
if ((Vario_Beep_Up == 0) && (Vario_Threshold >= Vario_Threshold_Value)) |
{ |
// set_beep ( 100, 0xffff, BeepNormal); |
duration = 52 -vario; |
// if (duration =0); duration = 1; |
// write_ndigit_number_u (0,6,duration,5,0); |
playTone(300+vario*2,duration,Config.Volume); |
// playTone(300,duration,volume); |
Vario_Threshold = Vario_Threshold_Value; // auf Maximalwert begrenzen |
} |
Vario_Beep_Up++; // Interval hochzählen in dem nicht gepiept wird |
if (Vario_Beep_Up == Vario_Beep_Up_Interval) Vario_Beep_Up = 0; |
} |
if (vario <0) // MK fällt |
{ |
Vario_Beep_Up = 0; // Up Beep freischalten |
Vario_Threshold++; |
if ((Vario_Beep_Down == 0) && (Vario_Threshold >= Vario_Threshold_Value)) |
{ |
duration = 50 -vario; |
// write_ndigit_number_u (0,7,duration,5,0); |
// if (duration < vario) ; duration = 0; |
// playTone(300,50,volume); |
playTone(300+vario*2,duration,Config.Volume); |
Vario_Threshold = Vario_Threshold_Value; // auf Maximalwert begrenzen |
} |
Vario_Beep_Down++; // Interval hochzählen in dem nicht gepiept wird |
if (Vario_Beep_Down == Vario_Beep_Down_Interval) Vario_Beep_Down = 0; |
} |
if (vario == 0) Vario_Threshold = 0; //Startverzögerung löschen |
} // end Beep |
} |
//-------------------------------------------------------------- |
// Diese Funktion Beept unabhaengig von der Einstellung Config.OSD_VarioBeep |
// Aufruf ggf. mit: if( Config.OSD_VarioBeep ) Beep_Vario(); |
// |
// Ansonten: |
// -> hier noch aufräumen in Zusammenhang mit func variobeep() |
//-------------------------------------------------------------- |
void Beep_Vario(void) |
{ |
if ( (naviData->FCStatusFlags & FC_STATUS_MOTOR_RUN) && (naviData->FCStatusFlags2 & FC_STATUS2_ALTITUDE_CONTROL)) |
{ //start Beep |
if (naviData->Variometer <0) // MK fällt |
{ |
Vario_Beep_Up = 0; // Up Beep freischalten |
Vario_Threshold++; |
if ((Vario_Beep_Down == 0) && (Vario_Threshold >= Vario_Threshold_Value)) |
{ |
if (!Config.HWSound) set_beep ( 300, 0xffff, BeepNormal); |
else variobeep(naviData->Variometer); |
Vario_Threshold = Vario_Threshold_Value; // auf Maximalwert begrenzen |
} |
Vario_Beep_Down++; // Interval hochzählen in dem nicht gepiept wird |
if (Vario_Beep_Down == Vario_Beep_Down_Interval) Vario_Beep_Down = 0; |
} |
if (naviData->Variometer == 0) Vario_Threshold = 0; //Startverzögerung löschen |
if (naviData->Variometer >0 ) // MK steigt |
{ |
Vario_Beep_Down = 0; // Down Beep freischalten |
Vario_Threshold++; |
if ((Vario_Beep_Up == 0) && (Vario_Threshold >= Vario_Threshold_Value)) |
{ |
if (!Config.HWSound) set_beep ( 100, 0xffff, BeepNormal); |
else variobeep(naviData->Variometer); |
Vario_Threshold = Vario_Threshold_Value; // auf Maximalwert begrenzen |
} |
Vario_Beep_Up++; // Interval hochzählen in dem nicht gepiept wird |
if (Vario_Beep_Up == Vario_Beep_Up_Interval) Vario_Beep_Up = 0; |
} |
} // end Beep |
} |
//-------------------------------------------------------------- |
// Quelle Mikrokopter FC-Software Holger + Ingo |
//-------------------------------------------------------------- |
void CheckMKLipo(void) |
{ |
if(Config.MK_LowBat < 50) // automatische Zellenerkennung |
{ |
if (CellIsChecked <= 2) //Nur beim Start 1x prüfen |
{ |
// up to 6s LiPo, less than 2s is technical impossible |
for(cells = 2; cells < 7; cells++) |
{ |
if(naviData->UBat < cells * MAX_CELL_VOLTAGE) break; |
} |
BattLowVoltageWarning = cells * Config.MK_LowBat; |
CellIsChecked++; |
} |
} |
else BattLowVoltageWarning = Config.MK_LowBat; |
if (naviData->UBat < BattLowVoltageWarning) |
{ |
if (AkkuWarnThreshold <= 4) AkkuWarnThreshold++; |
else |
{ //Beeper ein |
set_beep ( 1000, 0x0020, BeepSevere); |
// BeepTime = 3000; |
// BeepMuster = 0x0020; |
} |
} |
} |
//-------------------------------------------------------------- |
// convert the <heading> gotton from NC into an index |
uint8_t heading_conv (uint16_t heading) |
{ |
if (heading > 23 && heading < 68) |
return 0; //direction = "NE"; |
else if (heading > 67 && heading < 113) |
return 1; //direction = "E "; |
else if (heading > 112 && heading < 158) |
return 2; //direction = "SE"; |
else if (heading > 157 && heading < 203) |
return 3; //direction = "S "; |
else if (heading > 202 && heading < 248) |
return 4; //direction = "SW"; |
else if (heading > 247 && heading < 293) |
return 5; //direction = "W "; |
else if (heading > 292 && heading < 338) |
return 6; //direction = "NW"; |
return 7; //direction = "N "; |
} |
//-------------------------------------------------------------- |
// draw a compass rose at <x>/<y> for <heading> |
void draw_compass (uint8_t x, uint8_t y, uint16_t heading) |
{ |
uint8_t front = 19 + (heading / 22); |
for (uint8_t i = 0; i < 9; i++) |
lcd_putc (x++, y, pgm_read_byte(&rose[front - 4 + i]), 0); |
} |
//-------------------------------------------------------------- |
// variometer |
// x, y in Pixel! |
//-------------------------------------------------------------- |
void draw_variometer (uint8_t x, uint8_t y, uint8_t width, uint8_t hight, int16_t variometer) |
{ |
lcd_rect (x, y - ((hight) / 2), width, hight, 1); |
lcd_frect (x + 1, y - ((hight) / 2) + 1, width - 2, hight - 2, 0); |
lcd_line (x, y, x + width, y, 1); |
if (variometer > 0) // steigend |
{ |
switch (variometer / 5) |
{ |
case 0: |
lcd_line (x + 4, y - 1, x + 6, y - 1, 1); // 1 > 4 |
break; |
case 1: |
lcd_line (x + 4, y - 1, x + 6, y - 1, 1); // 1 > 4 |
lcd_frect (x + 3, y - 3, 4, 1, 1); // 5 > 9 |
break; |
case 2: |
lcd_line (x + 4, y - 1, x + 6, y - 1, 1); // 1 > 4 |
lcd_frect (x + 3, y - 3, 4, 1, 1); // 5 > 9 |
lcd_frect (x + 2, y - 5, 6, 1, 1); // 10 > 14 |
break; |
default: |
lcd_line (x + 4, y - 1, x + 6, y - 1, 1); // 1 > 4 |
lcd_frect (x + 3, y - 3, 4, 1, 1); // 5 > 9 |
lcd_frect (x + 2, y - 5, 6, 1, 1); // 10 > 14 |
lcd_frect (x + 1, y - 6, 8, 1, 1); // 15 > |
break; |
} |
} |
else if (variometer < 0) // fallend |
{ |
switch ((variometer) / -5) |
{ |
case 0: |
lcd_line (x + 4, y + 1, x + 6, y + 1, 1); // - 1 > - 4 |
break; |
case 1: |
lcd_line (x + 4, y + 1, x + 6, y + 1, 1); // - 1 > - 4 |
lcd_frect (x + 3, y + 2, 4, 1, 1); // - 5 > - 9 |
break; |
case 2: |
lcd_line (x + 4, y + 1, x + 6, y + 1, 1); // - 1 > - 4 |
lcd_frect (x + 3, y + 2, 4, 1, 1); // - 5 > - 9 |
lcd_frect (x + 2, y + 4, 6, 1, 1); // -10 > -14 |
break; |
default: |
lcd_line (x + 4, y + 1, x + 6, y + 1, 1); // - 1 > - 4 |
lcd_frect (x + 3, y + 2, 4, 1, 1); // - 5 > - 9 |
lcd_frect (x + 2, y + 4, 6, 1, 1); // -10 > -14 |
lcd_frect (x + 1, y + 5, 8, 1, 1); // -15 > |
break; |
} |
} |
} |
//-------------------------------------------------------------- |
// variometer 2 |
// |
// x, y in Pixel |
// x, y top, left |
//-------------------------------------------------------------- |
/* |
void draw_variometer2( uint8_t x, uint8_t y, uint8_t width, uint8_t hight, int16_t variometer) |
{ |
uint8_t max = 5; // max: 5 m/sec == 100% |
lcd_rect (x, y, width, hight, 1); |
lcd_frect(x + 1, y + 1, width - 2, hight - 2, 0); |
lcd_line (x, y + ((hight) / 2), x + width, y + ((hight) / 2), 1); |
} |
*/ |
//-------------------------------------------------------------- |
// Home symbol |
// draw Homesymbol at <x>/<y> |
//-------------------------------------------------------------- |
void draw_homesymbol (uint8_t x, uint8_t y) |
{ |
x *= 6; |
y *= 8; |
y += 7; |
lcd_plot (x,y-4,1); |
lcd_line (x+1,y-1,x+1,y-5,1); |
lcd_plot (x+2,y-6,1); |
lcd_plot (x+3,y-7,1); |
lcd_plot (x+4,y-6,1); |
lcd_line (x+5,y-1,x+5,y-5,1); |
lcd_plot (x+6,y-4,1); |
lcd_plot (x+3,y-1,1); |
lcd_plot (x+3,y-2,1); |
lcd_line (x+1,y,x+5,y,1); |
} |
//-------------------------------------------------------------- |
// Target symbol |
// draw Targetsymbol at <x>/<y> |
//-------------------------------------------------------------- |
void draw_targetsymbol (uint8_t x, uint8_t y) |
{ |
x *= 6; |
y *= 8; |
y += 7; |
lcd_circle (x+3, y-3, 4, 1); |
lcd_line (x,y-3,x+6,y-3,1); |
lcd_line (x+3,y,x+3,y-6,1); |
lcd_circle (x+3, y-3, 2, 1); |
} |
//-------------------------------------------------------------- |
// Degree symbol |
// draw Degreesymbol at <x>/<y> |
// |
// Ein etwas kleineres Degeree als Char 0x1E |
//-------------------------------------------------------------- |
void draw_symbol_degree (uint8_t x, uint8_t y, int8_t xoffs, int8_t yoffs) |
{ |
x *= 6; |
y *= 8; |
lcd_rect (x+1+xoffs, y+yoffs, 2, 2, 1); |
} |
//-------------------------------------------------------------- |
// RC symbol |
// alternatives Symbol fuer RC-Quality |
//-------------------------------------------------------------- |
void draw_symbol_rc (uint8_t x, uint8_t y) |
{ |
x *= 6; |
y *= 8; |
y += 1; |
x += 1; |
lcd_plot ( x+3, y+4, 1); |
lcd_line ( x+2, y+2, x+4, y+2, 1); |
lcd_line ( x+1, y+0, x+5, y+0, 1); |
} |
//-------------------------------------------------------------- |
void print_position (void) |
{ |
lcd_cls (); |
lcd_puts_at(0, 0, strGet(START_LASTPOS1), 2); // Breitengr Längengr |
lcd_puts_at(12, 7, strGet(ENDE), 0); |
uint8_t ij =0; |
for(ij=0;ij<6;ij++) |
{ |
uint32_t lon = last5pos[ij].Latitude; |
write_ndigit_number_u (1, ij+1, (uint16_t)(lon/10000000), 2, 0,0); |
lcd_printp_at (3, ij+1, PSTR("."), 0); |
write_ndigit_number_u (4, ij+1, (uint16_t)((lon/1000) % 10000), 4, 1,0); |
write_ndigit_number_u (8, ij+1, (uint16_t)((lon/10) % 100), 2, 1,0); |
uint32_t lat = last5pos[ij].Longitude; |
write_ndigit_number_u (12, ij+1, (uint16_t)(lat/10000000), 2, 0,0); |
lcd_printp_at (14, ij+1, PSTR("."), 0); |
write_ndigit_number_u (15, ij+1, (uint16_t)((lat/1000) % 10000), 4, 1,0); |
write_ndigit_number_u (19, ij+1, (uint16_t)((lat/10) % 100), 2, 1,0); |
} |
while (!get_key_press (1 << KEY_ESC)) |
timer = TIMEOUT; |
get_key_press(KEY_ALL); |
lcd_cls(); |
} |
//-------------------------------------------------------------- |
void Show_LastPosition(void) |
{ |
lcd_puts_at(0, 2, strGet(OSD_POS1), 0); |
lcd_puts_at(0, 3, strGet(OSD_POS2), 0); |
lcd_puts_at(0, 5, strGet(START_LASTPOS1), 0); |
uint32_t lon = last5pos[0].Latitude; |
write_ndigit_number_u (1, 6, (uint16_t)(lon/10000000), 2, 0,0); |
lcd_printp_at (3, 6, PSTR("."), 0); |
write_ndigit_number_u (4, 6, (uint16_t)((lon/1000) % 10000), 4, 1,0); |
write_ndigit_number_u (8, 6, (uint16_t)((lon/10) % 100), 2, 1,0); |
uint32_t lat = last5pos[0].Longitude; |
write_ndigit_number_u (12, 6, (uint16_t)(lat/10000000), 2, 0,0); |
lcd_printp_at (14, 6, PSTR("."), 0); |
write_ndigit_number_u (15, 6, (uint16_t)((lat/1000) % 10000), 4, 1,0); |
write_ndigit_number_u (19, 6, (uint16_t)((lat/10) % 100), 2, 1,0); |
} |
//-------------------------------------------------------------- |
void OSD_Timeout(uint8_t flag) |
{ |
// uint8_t flag; |
uint8_t tmp_dat; |
// flag = 0; |
timer = TIMEOUT; |
// disable OSD Data from NC |
// RS232_request_mk_data (1, 'o', 0); |
// tmp_dat = 0; |
// SendOutData ('o', ADDRESS_NC, 1, &tmp_dat, 1); |
mode = 0; |
rxd_buffer_locked = FALSE; |
// Bei Verbindungsverlusst werden hier die letzten bekannten Koordinaten ausgegeben!!! |
if( flag ) |
{ |
// Falls Spannungswarnung an war Beeper aus// |
set_beep ( 0, 0, BeepOff); |
lcd_cls (); |
WriteLastPosition(last5pos[0].Longitude,last5pos[0].Latitude); // im EEprom speichern |
lcd_puts_at(0, 0, strGet(OSD_ERROR), 2); // ERROR: Datenverlust |
lcd_puts_at(0, 2, strGet(OSD_POS1), 0); // Letzte bekannte |
lcd_puts_at(0, 3, strGet(OSD_POS2), 0); // Position gespeichert. |
lcd_puts_at(0, 5, strGet(START_LASTPOS1), 0); // Breitengr Längengr |
// lcd_puts_at(12, 7, strGet(ENDE), 0); |
// lcd_puts_at(19, 7, strGet(OK), 0); |
// if (OSD_RCErrorbeep==true) |
// { |
set_beep ( 250, 0x0040, BeepNormal); |
// } |
uint32_t lon = last5pos[0].Latitude; |
write_ndigit_number_u (1, 6, (uint16_t)(lon/10000000), 2, 0,0); |
lcd_printp_at (3, 6, PSTR("."), 0); |
write_ndigit_number_u (4, 6, (uint16_t)((lon/1000) % 10000), 4, 1,0); |
write_ndigit_number_u (8, 6, (uint16_t)((lon/10) % 100), 2, 1,0); |
uint32_t lat = last5pos[0].Longitude; |
write_ndigit_number_u (12, 6, (uint16_t)(lat/10000000), 2, 0,0); |
lcd_printp_at (14, 6, PSTR("."), 0); |
write_ndigit_number_u (15, 6, (uint16_t)((lat/1000) % 10000), 4, 1,0); |
write_ndigit_number_u (19, 6, (uint16_t)((lat/10) % 100), 2, 1,0); |
// while (!get_key_press (1 << KEY_ENTER)); |
// _delay_ms(1000); |
timer = TIMEOUT; |
// lcd_cls(); |
// return; |
} |
else |
{ |
lcd_puts_at(0, 0, strGet(OSD_ERROR), 2); |
Show_LastPosition(); |
if (Config.OSD_RCErrorbeep==true) set_beep ( 200, 0x0080, BeepNormal); |
// _delay_ms(2000); |
} |
rxd_buffer_locked = FALSE; // 07.03.2013 OG: fix |
// es gab Probleme mit dem Empfang gueltiger NC-Daten, die zu unschoenen Starteffekten bei den |
// OSD-Screens gefuehrt haben. Mit rxd_buffer_locked = FALSE vor SwitchToNC() ist das PKT wieder im 'Takt' |
SwitchToNC(); |
mode = 'O'; |
// disable debug... |
// RS232_request_mk_data (0, 'd', 0); |
tmp_dat = 0; |
SendOutData ('d', ADDRESS_ANY, 1, &tmp_dat, 1); |
// request OSD Data from NC every 100ms |
// RS232_request_mk_data (1, 'o', 100); |
tmp_dat = 10; |
SendOutData ('o', ADDRESS_NC, 1, &tmp_dat, 1); |
//_delay_ms(100); |
//rxd_buffer_locked = FALSE; |
} |
//----------------------------------------------------------- |
// |
void lcd_o_circle (uint16_t x, uint16_t y, int16_t breite, uint8_t mode, int8_t xoffs, int8_t yoffs) |
{ |
breite *= 6; |
int16_t radius = breite / 2; |
x += 2; |
x *= 6; |
x += 2; |
y += 1; |
y *= 8; |
y += 3; |
// 04.03.2012 OG: chg: x-radius von -3 auf -2 (runder auf dem display) |
//lcd_ellipse (x, y, radius - 3, radius - 5, mode); |
lcd_ellipse( x+xoffs, y+yoffs, radius - 2, radius - 5, mode); |
} |
//----------------------------------------------------------- |
// lcd_o_circ_line( x, y, breite, deg, rOffset, mode) |
// |
// x, y : in Chars |
// breite : in Chars |
// deg : in Pixel |
// rOffset: Beeinflusst den Schluss der Linie zum Huellkreis |
// 0 = Standard |
// >0 naeher zum Huellkreis |
// <0 entfernter vom Huellkreis |
// mode : siehe: lcd_ellipse_line() |
//----------------------------------------------------------- |
void lcd_o_circ_line( uint16_t x, uint16_t y, uint8_t breite, uint16_t deg, int8_t rOffset, uint8_t mode, int8_t xoffs, int8_t yoffs) |
{ |
breite *= 6; |
int16_t radius = breite / 3; |
x += 2; |
x *= 6; |
x += 2; |
y += 1; |
y *= 8; |
y += 3; |
// 04.03.2013 OG: der Radius kann mit rOffset >0 vergroessert werden um zum Kreis aufzuschliessen |
lcd_ellipse_line( x+xoffs, y+yoffs, radius+rOffset, radius+rOffset, deg, mode); |
} |
//-------------------------------------------------------------- |
void draw_icon_home(uint8_t x, uint8_t y) |
{ |
//lcd_plot( x+0, y+0, 1); // Referenz 0,0 |
lcd_rect( x+0, y+5, 10, 8, 1); // Mitte |
lcd_line( x+5, y+0, x+0, y+5, 1); // Dach Links |
lcd_line( x+5, y+0, x+10, y+5, 1); // Dach Rechts |
lcd_rect( x+4, y+10, 2, 3, 1); // Tuere |
} |
//-------------------------------------------------------------- |
void draw_icon_sat(uint8_t x, uint8_t y) |
{ |
//lcd_plot( x+0, y+0, 1); // Referenz 0,0 |
lcd_rect( x+0, y+2, 4, 2, 1); // linker Fluegel |
lcd_rect( x+8, y+2, 4, 2, 1); // rechter Fluegel |
lcd_rect( x+4, y+0, 4, 6, 1); // Mitte, oben |
lcd_line( x+6, y+7, x+2, y+11, 1); // Strahl Links |
lcd_line( x+6, y+7, x+10, y+11, 1); // Strahl Rechts |
lcd_line( x+1, y+12, x+11, y+12, 1); // Strahl Unten |
} |
//-------------------------------------------------------------- |
void draw_icon_battery(uint8_t x, uint8_t y) |
{ |
//lcd_plot( x+0, y+0, 1); // Referenz 0,0 |
lcd_rect( x+2, y+0, 2, 2, 1); // der kleine Knubbel oben |
lcd_rect( x+0, y+2, 6, 15, 1); // body |
} |
//############################################################## |
//# OSD-ELEMENTS |
//############################################################## |
//-------------------------------------------------------------- |
// OSD_Element_Flag_Label( xC, yC, item, lOn, xoffs, yoffs) |
// |
// xC, yC : x,y in Characters |
// item : OSD_FLAG_AH, OSD_FLAG_PH, usw. |
// lOn : true / false |
// xoffs,yoffs : x,y Pixelverschiebung |
//-------------------------------------------------------------- |
void OSD_Element_Flag_Label( uint8_t xC, uint8_t yC, uint8_t item, uint8_t lOn, int8_t xoffs, int8_t yoffs) |
{ |
int8_t x = (xC*6)-2; |
int8_t y = (yC*8)-1; |
uint8_t w = 14; |
uint8_t h = 8; |
const char *labels[OSD_FLAG_COUNT] = |
{ |
PSTR("AH"), // OSD_FLAG_AH Altitue Hold |
PSTR("PH"), // OSD_FLAG_PH Position Hold |
PSTR("CF"), // OSD_FLAG_CF Care Free |
PSTR("CH"), // OSD_FLAG_CH Coming Home |
PSTR("o1"), // OSD_FLAG_O1 Out1 |
PSTR("o2"), // OSD_FLAG_O2 Out2 |
PSTR("BA"), // OSD_FLAG_BA LowBat warning (MK) |
PSTR("CA"), // OSD_FLAG_CA Calibrate |
PSTR("ST"), // OSD_FLAG_ST Start |
PSTR("MR"), // OSD_FLAG_MR Motor Run |
PSTR("FY"), // OSD_FLAG_FY Fly |
PSTR("EL"), // OSD_FLAG_EL Emergency Landing |
PSTR("FS"), // OSD_FLAG_FS RX Failsave Active |
PSTR("GP"), // OSD_FLAG_GP GPS Ok |
PSTR("S!"), // OSD_FLAG_S0 GPS-Sat not ok (GPS NOT ok) |
PSTR("TU"), // OSD_FLAG_TU Vario Trim Up |
PSTR("TD"), // OSD_FLAG_TD Vario Trim Down |
PSTR("FR"), // OSD_FLAG_FR Free |
PSTR("RL"), // OSD_FLAG_RL Range Limit |
PSTR("SL"), // OSD_FLAG_SL No Serial Link |
PSTR("TR"), // OSD_FLAG_TR Target Reached |
PSTR("MC") // OSD_FLAG_MC Manual Control |
}; |
//lcd_plot( x-2, y-2, 1); // Referenz |
if( yC==0 ) { y = 0; h = 7; } |
if( xC==0 ) { x = 0; w = 12; } |
if( lOn ) |
{ |
lcd_frect( x+xoffs, y+yoffs, w, h, 1); // Filler |
lcdx_printp_at( xC, yC, labels[item], MINVERS, xoffs,yoffs); // Label |
} |
else |
{ |
lcd_frect( x+xoffs, y+yoffs, w, h, 0); // clear |
} |
} |
//-------------------------------------------------------------- |
//-------------------------------------------------------------- |
void OSD_Element_Flag( uint8_t xC, uint8_t yC, uint8_t item, int8_t xoffs, int8_t yoffs) |
{ |
uint8_t lOn = 0; |
// FC_StatusFlags 0.88 |
switch( item ) |
{ |
// Altitue Hold |
case OSD_FLAG_AH : lOn = (naviData->FCStatusFlags2 & FC_STATUS2_ALTITUDE_CONTROL); |
break; |
// Position Hold |
case OSD_FLAG_PH : lOn = (naviData->NCFlags & NC_FLAG_PH); |
break; |
// Coming Home |
case OSD_FLAG_CH : lOn = (naviData->NCFlags & NC_FLAG_CH); |
break; |
// Care Free |
case OSD_FLAG_CF : lOn = (naviData->FCStatusFlags2 & FC_STATUS2_CAREFREE); |
break; |
// Out1 |
case OSD_FLAG_O1 : lOn = (naviData->FCStatusFlags2 & FC_STATUS2_OUT1_ACTIVE); |
break; |
// Out2 |
case OSD_FLAG_O2 : lOn = (naviData->FCStatusFlags2 & FC_STATUS2_OUT2_ACTIVE); |
break; |
// LowBat warning (MK) |
case OSD_FLAG_BA : lOn = (naviData->FCStatusFlags & FC_STATUS_LOWBAT); |
break; |
// Calibrate |
case OSD_FLAG_CA : lOn = (naviData->FCStatusFlags & FC_STATUS_CALIBRATE); |
break; |
// Start |
case OSD_FLAG_ST : lOn = (naviData->FCStatusFlags & FC_STATUS_START); |
break; |
// Motor Run |
case OSD_FLAG_MR : lOn = (naviData->FCStatusFlags & FC_STATUS_MOTOR_RUN); |
break; |
// Fly |
case OSD_FLAG_FY : lOn = (naviData->FCStatusFlags & FC_STATUS_FLY); |
break; |
// Emergency Landing |
case OSD_FLAG_EL : lOn = (naviData->FCStatusFlags & FC_STATUS_EMERGENCY_LANDING); |
break; |
// RC Failsave Active |
case OSD_FLAG_FS : lOn = (naviData->FCStatusFlags2 & FC_STATUS2_RC_FAILSAVE_ACTIVE); |
break; |
// GPS ok |
case OSD_FLAG_GP : lOn = (naviData->NCFlags & NC_FLAG_GPS_OK); |
break; |
// GPS-Sat not ok (GPS NOT ok) |
case OSD_FLAG_S0 : lOn = !(naviData->NCFlags & NC_FLAG_GPS_OK); |
break; |
// Vario Trim Up |
case OSD_FLAG_TU : lOn = (naviData->FCStatusFlags & FC_STATUS_VARIO_TRIM_UP); |
break; |
// Vario Trim Down |
case OSD_FLAG_TD : lOn = (naviData->FCStatusFlags & FC_STATUS_VARIO_TRIM_DOWN); |
break; |
// Free |
case OSD_FLAG_FR : lOn = (naviData->NCFlags & NC_FLAG_FREE); |
break; |
// Range Limit |
case OSD_FLAG_RL : lOn = (naviData->NCFlags & NC_FLAG_RANGE_LIMIT); |
break; |
// No Serial Link |
case OSD_FLAG_SL : lOn = (naviData->NCFlags & NC_FLAG_NOSERIALLINK); |
break; |
// Target Reached |
case OSD_FLAG_TR : lOn = (naviData->NCFlags & NC_FLAG_TARGET_REACHED); |
break; |
// Manual Control |
case OSD_FLAG_MC : lOn = (naviData->NCFlags & NC_FLAG_MANUAL_CONTROL); |
break; |
} |
OSD_Element_Flag_Label( xC, yC, item, lOn, xoffs,yoffs); |
} |
//-------------------------------------------------------------- |
// OSD_Element_AltitudeControl( x, y) |
//-------------------------------------------------------------- |
void OSD_Element_AltitudeControl( uint8_t x, uint8_t y ) |
{ |
//--------------------------------------------------------- |
// 10.03.2013 OG: |
// CFG2_HEIGHT_LIMIT im Augenblick nicht unterstuetzt |
// Siehe Anmerkungen in osd() |
//--------------------------------------------------------- |
/* |
if (Flags_ExtraConfig & CFG2_HEIGHT_LIMIT) |
{ |
if (naviData->FCStatusFlags2 & FC_STATUS2_ALTITUDE_CONTROL) |
lcd_puts_at (x, y, strGet(OSD_ALTI_1), 0); // Höhe begr. |
else |
lcd_puts_at (x, y, strGet(OSD_ALTI_0), 0); // Höhe aus |
} |
else |
{ |
if (naviData->FCStatusFlags2 & FC_STATUS2_ALTITUDE_CONTROL) |
lcd_puts_at (x, y, strGet(OSD_VARIO_1), 0); // Vario Höhe |
else |
lcd_puts_at (x, y, strGet(OSD_VARIO_0), 0); // Vario aus |
} |
*/ |
if (naviData->FCStatusFlags2 & FC_STATUS2_ALTITUDE_CONTROL) |
lcd_puts_at (x, y, strGet(OSD_VARIO_1), 0); // Vario Höhe |
else |
lcd_puts_at (x, y, strGet(OSD_VARIO_0), 0); // Vario aus |
} |
//-------------------------------------------------------------- |
// Anzeige von Steigen / Sinken |
//-------------------------------------------------------------- |
void OSD_Element_UpDown( uint8_t x, uint8_t y, int8_t xoffs, int8_t yoffs) |
{ |
x = (x*6) + xoffs; |
y = (y*8) + yoffs; |
lcd_frect( x, y, 6, 7, 0); // clear |
if( naviData->Variometer > 2 ) // steigen mehr als 0.2 m/sec (ein guter Wert muss noch in der Praxis ermittelt werden) |
{ |
lcd_line( x+2, y+0, x+0, y+2, 1); |
lcd_line( x+2, y+0, x+4, y+2, 1); |
} |
else if( naviData->Variometer < -2 ) // sinken mehr als 0.2 m/sec |
{ |
lcd_line( x+2, y+6, x+0, y+4, 1); |
lcd_line( x+2, y+6, x+4, y+4, 1); |
} |
} |
//-------------------------------------------------------------- |
// OSD_Element_Altitude( x, y, nStyle) |
// nStyle entspricht dem ehemaligen 'Mode' |
//-------------------------------------------------------------- |
void OSD_Element_Altitude( uint8_t x, uint8_t y, uint8_t nStyle ) |
{ |
switch( nStyle ) |
{ |
case 0 : |
case 1 : //note:lephisto:according to several sources it's /30 |
if (naviData->Altimeter > (300 / AltimeterAdjust) || naviData->Altimeter < (-300 / AltimeterAdjust)) // above 10m only write full meters |
write_ndigit_number_s (x, y, naviData->Altimeter / (30 / AltimeterAdjust), 4, 0,MNORMAL); |
else // up to 10m write meters.dm |
write_ndigit_number_s_10th (x, y, naviData->Altimeter / (3 / AltimeterAdjust), 3, 0,MNORMAL); |
lcd_printp_at (x+4, y, PSTR("m"), MNORMAL); |
lcd_putc (x+5, y, 0x09, 0); // Hoehensymbol |
break; |
case 2 : //note:lephisto:according to several sources it's /30 |
if (naviData->Altimeter > (300 / AltimeterAdjust) || naviData->Altimeter < (-300 / AltimeterAdjust)) // above 10m only write full meters |
write_ndigit_number_s (x+4, y, naviData->Altimeter / (30 / AltimeterAdjust), 4, 0,MBIG); |
else // up to 10m write meters.dm |
write_ndigit_number_s_10th (x+4, y, naviData->Altimeter / (3 / AltimeterAdjust), 3, 0,MBIG); |
lcd_putc( x+8, y, 'm', MBIG); |
lcd_printp_at (x, y, PSTR("Höhe"), MNORMAL); |
break; |
} |
} |
//-------------------------------------------------------------- |
// fuer: Config.OSD_LipoBar==1 |
//-------------------------------------------------------------- |
void OSD_Element_BatteryLevel_Bar( uint8_t x, uint8_t y ) |
{ |
uint16_t Balken = 0; |
drawmode = (naviData->UBat < BattLowVoltageWarning ? 2 : 0); |
if( cells > 0 ) // LipobargraphAnzeige nur wenn Anzahl der Lipozellen bekannt sind |
{ |
write_ndigit_number_u (x+6, y, cells, 1, 0, drawmode); |
lcd_printp_at (x+7, y, PSTR("S"), drawmode); |
if( cells==3 ) |
{ |
lcd_rect(x*6, y*8, 28, 7, 1); // Rahmen |
Balken = ((naviData->UBat-(cells*MIN_CELL_VOLTAGE))*10)/12; |
if((Balken > 0) && (Balken <28)) lcd_frect((x*6)+1, (y*8)+1, Balken, 5, 1); // Fuellung |
if(Balken <= 26) lcd_frect(Balken+(x*6)+1, (y*8)+1, 26-Balken, 5, 0); // loeschen |
} |
if( cells==4 ||cells==5 ) |
{ |
lcd_rect(x*6, y*8, 30, 7, 1); // Rahmen |
if (cells == 4) Balken = ((naviData->UBat-(cells*MIN_CELL_VOLTAGE))*10)/15; |
if (cells == 5) Balken = ((naviData->UBat-(cells*MIN_CELL_VOLTAGE))*10)/19; |
if ((Balken > 0) && (Balken <=29)) lcd_frect((x*6)+1, (y*8)+1, Balken, 5, 1); // Fuellung |
if (Balken <= 27) lcd_frect(Balken+(x*6)+1, (y*8)+1, 28-Balken, 5, 0); // loeschen |
} |
} // end if: cells > 0 (TODO: Anzeige fuer cells==0 implementieren) |
} |
//-------------------------------------------------------------- |
// fuer die neuen OSD-Screens |
//-------------------------------------------------------------- |
void OSD_Element_BattLevel2( uint8_t x, uint8_t y, int8_t xoffs, int8_t yoffs ) |
{ |
drawmode = (naviData->UBat < BattLowVoltageWarning ? MINVERS : MNORMAL); |
writex_ndigit_number_u_10th( x, y, naviData->UBat, 3, 0, drawmode, xoffs,yoffs); |
lcdx_printp_at( x+4, y, PSTR("V"), drawmode, xoffs+1,yoffs); // Einheit |
lcd_line( (x+4)*6, y*8, (x+4)*6, y*8+7, (drawmode==MINVERS ? 1 : 0) ); // filler zwischen Spannung und "V" |
} |
//-------------------------------------------------------------- |
// fuer: Config.OSD_LipoBar==0 |
// nStyle entspricht dem ehemaligen 'Mode' |
//-------------------------------------------------------------- |
void OSD_Element_BatteryLevel_Text( uint8_t x, uint8_t y, uint8_t nStyle ) |
{ |
if( nStyle <= 1) |
drawmode = (naviData->UBat < BattLowVoltageWarning ? 2 : 0); // Normal-Schrift |
else |
drawmode = (naviData->UBat < BattLowVoltageWarning ? 4 : 3); // Fett-Schrift |
if( nStyle <= 1) |
{ |
write_ndigit_number_u_10th (x, y, naviData->UBat, 3, 0, drawmode); |
lcd_printp_at (x+4, y, PSTR("V"), drawmode); |
} |
else |
{ |
write_ndigit_number_u_10th (x-2, y, naviData->UBat, 3, 0, drawmode); |
lcd_printp_at (x+2, y, PSTR("V"), drawmode); |
} |
} |
//-------------------------------------------------------------- |
// nStyle entspricht dem ehemaligen 'Mode' |
//-------------------------------------------------------------- |
void OSD_Element_BatteryLevel( uint8_t x, uint8_t y, uint8_t nStyle ) |
{ |
if( Config.OSD_LipoBar ) |
OSD_Element_BatteryLevel_Bar( x, y); |
else |
OSD_Element_BatteryLevel_Text( x, y, nStyle); |
} |
//-------------------------------------------------------------- |
//-------------------------------------------------------------- |
void OSD_Element_Capacity( uint8_t x, uint8_t y ) |
{ |
drawmode = (naviData->UsedCapacity > Config.OSD_mAh_Warning ? 2 : 0); |
write_ndigit_number_u (x, y, naviData->UsedCapacity, 5, 0, drawmode); |
lcd_printp_at (x+5, y, PSTR("mAh"), drawmode); |
// BeepTime = 3000; |
// BeepMuster = 0x0020; |
} |
//-------------------------------------------------------------- |
// OSD_Element_CareFree( x, y) |
//-------------------------------------------------------------- |
void OSD_Element_CareFree( uint8_t x, uint8_t y ) |
{ |
lcd_puts_at (x, y, strGet( naviData->FCStatusFlags2 & FC_STATUS2_CAREFREE ? OSD_CARE_FREE_1 : OSD_CARE_FREE_0 ), 0); |
} |
//-------------------------------------------------------------- |
// OSD_Element_CompassDegree( x, y, nStyle) |
// nStyle entspricht dem ehemaligen 'Mode' |
//-------------------------------------------------------------- |
void OSD_Element_CompassDegree( uint8_t x, uint8_t y, uint8_t nStyle ) |
{ |
switch( nStyle ) |
{ |
case 0 : |
case 1 : write_ndigit_number_u (x, y, naviData->CompassHeading, 3, 0,MNORMAL); |
x += 3; |
break; |
case 2 : write_ndigit_number_u (x, y, naviData->CompassHeading, 3, 0,MBIG); |
x += 8; |
break; |
} |
lcd_putc( x, y, 0x1E, MNORMAL); // degree symbol |
} |
//-------------------------------------------------------------- |
//-------------------------------------------------------------- |
void OSD_Element_CompassDirection( uint8_t x, uint8_t y ) |
{ |
lcd_printp_at (x, y, (const char *) (pgm_read_word ( &(directions_p[heading_conv(naviData->CompassHeading)]))), 0); |
} |
//-------------------------------------------------------------- |
//-------------------------------------------------------------- |
void OSD_Element_CompassRose( uint8_t x, uint8_t y ) |
{ |
draw_compass (x, y, naviData->CompassHeading); |
} |
//-------------------------------------------------------------- |
//-------------------------------------------------------------- |
void OSD_Element_Current( uint8_t x, uint8_t y ) |
{ |
write_ndigit_number_u_10th (x, y, naviData->Current, 3, 0,0); |
lcd_printp_at (x+4, y, PSTR("A"), 0); |
} |
//-------------------------------------------------------------- |
//-------------------------------------------------------------- |
void OSD_Element_FlyingTime( uint8_t x, uint8_t y ) |
{ |
write_time (x, y, naviData->FlyingTime); |
lcd_printp_at (x+5, y, PSTR("m"), 0); |
} |
//-------------------------------------------------------------- |
//-------------------------------------------------------------- |
void OSD_Element_GroundSpeed( uint8_t x, uint8_t y ) |
{ |
write_ndigit_number_u (x, y, (uint16_t) (((uint32_t) naviData->GroundSpeed * (uint32_t) 9) / (uint32_t) 250), 3, 0,0); |
lcd_printp_at (x+3, y, PSTR("Kmh"), 0); |
} |
//-------------------------------------------------------------- |
//-------------------------------------------------------------- |
void OSD_Element_HomeCircle( uint8_t x, uint8_t y, uint8_t breite, int8_t rOffset, int8_t xoffs, int8_t yoffs ) |
{ |
lcd_o_circle( x, y, breite, 1, xoffs,yoffs); |
if (Config.OSD_HomeMKView==1) |
heading_home = (naviData->HomePositionDeviation.Bearing + 360 - naviData->CompassHeading) % 360; |
else |
heading_home = (naviData->CompassHeading- naviData->HomePositionDeviation.Bearing + 360 ) % 360; |
lcd_o_circ_line( x, y, breite, old_hh , rOffset, 0, xoffs,yoffs); |
lcd_o_circ_line( x, y, breite, heading_home, rOffset, 1, xoffs,yoffs); |
old_hh = heading_home; |
} |
//-------------------------------------------------------------- |
//-------------------------------------------------------------- |
void OSD_Element_HomeDegree( uint8_t x, uint8_t y ) |
{ |
write_ndigit_number_u (x, y, heading_home, 3, 0,0); |
lcd_putc (x+3, y, 0x1e, 0); // degree symbol |
} |
//-------------------------------------------------------------- |
// OSD_Element_HomeDistance( x, y, nStyle) |
//-------------------------------------------------------------- |
void OSD_Element_HomeDistance( uint8_t x, uint8_t y, uint8_t nStyle ) |
{ |
switch( nStyle ) |
{ |
case 0 : |
case 1 : write_ndigit_number_u (x, y, naviData->HomePositionDeviation.Distance / 10, 3, 0,0); |
lcd_putc (x+3, y, 'm', 0); |
draw_homesymbol(x+4, y); |
break; |
case 2 : lcd_printp_at (x, y, PSTR("Home"), 0); |
write_ndigit_number_u (x+5, y, naviData->HomePositionDeviation.Distance / 10, 3, 0,0); |
lcd_printp_at (x+8, y, PSTR("m -"), 0); |
break; |
} |
} |
//-------------------------------------------------------------- |
// OSD_Element_LEDOutput( x, y, bitmask) |
// |
// bitmask: LED1 = FC_STATUS2_OUT1_ACTIVE |
// LED2 = FC_STATUS2_OUT2_ACTIVE |
//-------------------------------------------------------------- |
void OSD_Element_LEDOutput( uint8_t x, uint8_t y, uint8_t bitmask ) |
{ |
uint8_t lOn; |
lOn = (naviData->FCStatusFlags2 & bitmask ? 1 : 0); // Bit gesetzt? |
lOn = (Config.OSD_InvertOut ? !lOn : lOn); // Invertieren? |
lOn = (lOn ? 1 : 0); // auf 0 oder 1 setzen (hmm, geht auch besser...). |
lcd_fcircle (x * 6 + 5, y * 8 + 3, Config.OSD_LEDform, lOn); |
lcd_circle (x * 6 + 5, y * 8 + 3, 3, 1); |
/* |
if (!Config.OSD_InvertOut) |
{ |
if (naviData->FCStatusFlags2 & FC_STATUS2_OUT1_ACTIVE) |
{ |
lcd_fcircle (x * 6 + 5, y * 8 + 3, Config.OSD_LEDform, 0); |
lcd_circle (x * 6 + 5, y * 8 + 3, 3, 1); |
} |
else |
{ |
lcd_fcircle (x * 6 + 5, y * 8 + 3, Config.OSD_LEDform, 1); |
lcd_circle (x * 6 + 5, y * 8 + 3, 3, 1); |
} |
} |
else |
{ |
if (naviData->FCStatusFlags2 & FC_STATUS2_OUT1_ACTIVE) |
{ |
lcd_fcircle (x * 6 + 5, y * 8 + 3,Config.OSD_LEDform, 1); |
lcd_circle (x * 6 + 5, y * 8 + 3, 3, 1); |
} |
else |
{ |
lcd_fcircle (x * 6 + 5, y * 8 + 3, Config.OSD_LEDform, 0); |
lcd_circle (x * 6 + 5, y * 8 + 3, 3, 1); |
} |
} |
break; |
*/ |
} |
//-------------------------------------------------------------- |
// OSD_Element_LED1Output( x, y) |
//-------------------------------------------------------------- |
void OSD_Element_LED1Output( uint8_t x, uint8_t y ) |
{ |
OSD_Element_LEDOutput( x, y, FC_STATUS2_OUT1_ACTIVE ); |
} |
//-------------------------------------------------------------- |
// OSD_Element_LED2Output( x, y) |
//-------------------------------------------------------------- |
void OSD_Element_LED2Output( uint8_t x, uint8_t y ) |
{ |
OSD_Element_LEDOutput( x, y, FC_STATUS2_OUT2_ACTIVE ); |
} |
//-------------------------------------------------------------- |
// OSD_Element_Manuell( x, y) |
//-------------------------------------------------------------- |
void OSD_Element_Manuell( uint8_t x, uint8_t y ) |
{ |
if (naviData->NCFlags & NC_FLAG_MANUAL_CONTROL) |
lcd_putc (x, y, 'M', 0); // rc transmitter |
else |
lcd_putc (x, y, 'X', 0); // clear |
} |
//-------------------------------------------------------------- |
// OSD_Element_NaviMode( x, y) |
//-------------------------------------------------------------- |
void OSD_Element_NaviMode( uint8_t x, uint8_t y ) |
{ |
if (naviData->NCFlags & NC_FLAG_FREE) |
lcd_puts_at (x, y, strGet(OSD_NAVI_MODE_0), 0); // Navi aus |
else if (naviData->NCFlags & NC_FLAG_PH) |
lcd_puts_at (x, y, strGet(OSD_NAVI_MODE_1), 0); // Pos. Hold |
else if (naviData->NCFlags & NC_FLAG_CH) |
lcd_puts_at (x, y, strGet(OSD_NAVI_MODE_2), 0); // Coming Home |
} |
//-------------------------------------------------------------- |
// OSD_Element_RCIntensity( x, y) |
//-------------------------------------------------------------- |
void OSD_Element_RCIntensity( uint8_t x, uint8_t y ) |
{ |
write_ndigit_number_u (x, y, naviData->RC_Quality, 3, 0,0); |
lcd_printp_at (x+3, y, PSTR("\x1F"), 0); // RC-transmitter |
if (naviData->NCFlags & NC_FLAG_NOSERIALLINK) |
{ |
lcd_printpns_at(x+3, y, PSTR(" "), 0); // Clear |
} |
else |
{ |
lcd_printpns_at(x+3, y, PSTR("PC"), 0); |
} |
} |
//-------------------------------------------------------------- |
// OSD_Element_SatsInUse( x, y, nStyle) |
// |
// nStyle == 0: "00s" |
// nStyle == 1: wie 0 |
// nStyle == 2: "00 Sat" |
// |
// nStyle entspricht dem ehemaligen 'Mode' |
//-------------------------------------------------------------- |
void OSD_Element_SatsInUse( uint8_t x, uint8_t y, uint8_t nStyle ) |
{ |
drawmode = (naviData->NCFlags & NC_FLAG_GPS_OK ? 0 : 2); |
switch( nStyle ) |
{ |
case 0 : |
case 1 : write_ndigit_number_u (x, y, naviData->SatsInUse, 2, 0, drawmode); |
lcd_putc (x+2, y, 0x08, drawmode); |
break; |
case 2 : write_ndigit_number_u (x, y, naviData->SatsInUse, 2, 0, drawmode); |
lcd_printp_at (x+2, y, PSTR(" Sat"), drawmode); |
break; |
} |
} |
//-------------------------------------------------------------- |
// OSD_Element_StatusFlags( x, y) |
//-------------------------------------------------------------- |
void OSD_Element_StatusFlags( uint8_t x, uint8_t y ) |
{ |
// FC_StatusFlags 0.88 |
// #define FC_STATUS_MOTOR_RUN 0x01 |
// #define FC_STATUS_FLY 0x02 |
// #define FC_STATUS_CALIBRATE 0x04 |
// #define FC_STATUS_START 0x08 |
// #define FC_STATUS_EMERGENCY_LANDING 0x10 |
// #define FC_STATUS_LOWBAT 0x20 |
// #define FC_STATUS_VARIO_TRIM_UP 0x40 |
// #define FC_STATUS_VARIO_TRIM_DOWN 0x80 |
if (naviData->FCStatusFlags & FC_STATUS_CALIBRATE) |
lcd_puts_at (x, y, strGet(OSD_FLAGS_1), 0); // Calibrate |
else if (naviData->FCStatusFlags & FC_STATUS_START) |
lcd_puts_at (x, y, strGet(OSD_FLAGS_2), 0); // Start |
else if (naviData->FCStatusFlags & FC_STATUS_MOTOR_RUN) |
lcd_puts_at (x, y, strGet(OSD_FLAGS_3), 0); // Run |
else if (naviData->FCStatusFlags & FC_STATUS_FLY) |
lcd_puts_at (x, y, strGet(OSD_FLAGS_4), 0); // Fly |
else if (naviData->FCStatusFlags & FC_STATUS_EMERGENCY_LANDING) |
lcd_puts_at (x, y, strGet(OSD_FLAGS_5), 0); // Landing |
else if (naviData->FCStatusFlags & FC_STATUS_LOWBAT) |
lcd_puts_at (x, y, strGet(OSD_FLAGS_6), 0); // LowBat |
else |
// lcd_printp_at (x, y, PSTR(" "), 0); // Clear |
lcd_puts_at (x, y, strGet(OSD_FLAGS_0), 0); // Clear |
} |
//-------------------------------------------------------------- |
// OSD_Element_Variometer( x, y) |
//-------------------------------------------------------------- |
void OSD_Element_Variometer( uint8_t x, uint8_t y ) |
{ |
x *= 6; |
y *= 8; |
y += 7; |
draw_variometer (x, y, 10, 14, naviData->Variometer); |
} |
//-------------------------------------------------------------- |
// OSD_Element_Target( x, y, nStyle) |
// |
// nStyle entspricht dem ehemaligen 'Mode' |
// nStyle = 0,1: "000m" |
// nStyle = 2,3: "Ziel 000m -" |
//-------------------------------------------------------------- |
void OSD_Element_Target( uint8_t x, uint8_t y, uint8_t nStyle ) |
{ |
if( nStyle <= 1 ) |
{ |
write_ndigit_number_u (x, y, naviData->TargetPositionDeviation.Distance / 10, 3, 0,0); |
lcd_putc (x+3, y, 'm', 0); |
draw_targetsymbol(x+4,y); |
} |
else |
{ |
lcd_printp_at (x, y, PSTR("Ziel"), 0); |
write_ndigit_number_u (x+5, y, naviData->TargetPositionDeviation.Distance / 10, 3, 0,0); |
lcd_printp_at (x+8, y, PSTR("m -"), 0); |
} |
} |
//-------------------------------------------------------------- |
// TODO: |
// - pruefen ob beep hier an richtiger Stelle ist |
//-------------------------------------------------------------- |
void OSD_Element_VarioWert( uint8_t x, uint8_t y ) |
{ |
uint8_t FC_Fallspeed; |
FC_Fallspeed = (unsigned int)naviData->Variometer; |
FC_Fallspeed = 255-FC_Fallspeed; |
drawmode = ( (naviData->Variometer < 0) && (FC_Fallspeed > Config.OSD_Fallspeed) ? 2 : 0); |
if( Config.OSD_VarioBeep ) |
Beep_Vario(); // Beep ??? |
if( drawmode == 2 ) |
{ |
if( !Config.HWSound ) |
set_beep ( 1000, 0x0060, BeepNormal); // muss ein Beep hier hin???? |
else |
variobeep(naviData->Variometer); // muss ein Beep hier hin???? |
} |
write_ndigit_number_s_10th (x, y, naviData->Variometer, 3,0, drawmode); |
lcd_printpns_at(x+4, y, PSTR("ms"), drawmode); |
} |
//-------------------------------------------------------------- |
//-------------------------------------------------------------- |
void OSD_Element_WayPoint( uint8_t x, uint8_t y ) |
{ |
if (!OldWP == naviData->WaypointIndex) |
{ |
// BeepTime = 500; |
// BeepMuster = 0x0080; |
OldWP = naviData->WaypointIndex; |
NextWP = true; |
} |
if ((NextWP==true)&& naviData->NCFlags & NC_FLAG_TARGET_REACHED) |
{ |
set_beep ( 500, 0x0080, BeepNormal); |
NextWP = false; |
} |
write_ndigit_number_u (x+2, y, naviData->WaypointIndex , 2, 0,0); |
lcd_printp_at (x, y, PSTR("WP"), 0); |
} |
//-------------------------------------------------------------- |
//-------------------------------------------------------------- |
void OSD_Element_TargetDegree( uint8_t x, uint8_t y ) |
{ |
write_ndigit_number_u (x, y, naviData->TargetPositionDeviation.Bearing/ 10, 3, 0,0); |
lcd_putc (x+3, y, 0x1e, 0); // degree symbol |
} |
//############################################################## |
//# OSD-SCREENS |
//############################################################## |
//-------------------------------------------------------------- |
// OSD-Screen "General" |
// |
// nMode: 0 = update values |
// 1 = redraw labels and update values |
//-------------------------------------------------------------- |
const char * OSD_Screen_General( uint8_t nMode ) |
{ |
const char *ScreenName = PSTR("General"); |
//----------------------------------------- |
// REDRAW |
// statische Screen Elemente die nicht |
// jedesmal neu gezeichnet werden muessen |
//----------------------------------------- |
if( nMode == OSD_SCREEN_REDRAW ) |
{ |
// Display: 128 x 64 with 6x8 Font => 21 x 8 |
// Linien: Horizontal |
lcd_line (0, 28, 127, 28, 1); // mitte |
lcd_line (0, 51, 127, 51, 1); // unten |
// Linien: Vertikal |
lcd_line (65, 0, 65, 50, 1); // mitte |
//----------------------------------------- |
// Block: Oben - Links |
//----------------------------------------- |
draw_icon_battery(0,4); |
//lcdx_printp_at( 6, 0, PSTR("V") , MNORMAL, 1,0); // Spannung (Volt) |
lcdx_printp_at( 7, 2, PSTR(" mA"), MNORMAL, 0,2); |
//----------------------------------------- |
// Block: Oben - Rechts |
//----------------------------------------- |
lcdx_printp_at( 12, 0, PSTR("Alt:") , MNORMAL, 0,0); |
lcdx_printp_at( 12, 1, PSTR("Dir:") , MNORMAL, 0,1); |
draw_symbol_degree( 20, 1, 1,1); |
lcdx_printp_at( 12, 2, PSTR(" I:") , MNORMAL, 0,2); |
lcdx_printp_at( 20, 2, PSTR("A") , MNORMAL, 2,2); |
//----------------------------------------- |
// Block: Unten - Links |
//----------------------------------------- |
draw_icon_sat(0,33); |
lcdx_printp_at( 6, 5, PSTR(" kmh"), MNORMAL, 0,1); |
//----------------------------------------- |
// Block: Unten - Rechts |
//----------------------------------------- |
draw_icon_home( 70, 32); |
lcdx_printp_at( 20, 4, PSTR("m"), MNORMAL, 2,0); |
draw_symbol_degree( 20, 5, 1,1); |
//lcd_putc( 20, 5, 0x1E, 0); // alternativ: degree symbol |
//----------------------------------------- |
// unterste Zeile |
//----------------------------------------- |
draw_symbol_rc(20,7); // RC-transmitter |
} |
//----------------- |
// Batt Level (Volt) |
//----------------- |
OSD_Element_BattLevel2( 2, 0, 0,0 ); |
//----------------- |
// LowBat Warnung MK |
//----------------- |
OSD_Element_Flag( 8, 0, OSD_FLAG_BA, 0,0 ); |
//----------------- |
// Flugzeit |
//----------------- |
writex_time(2, 1, naviData->FlyingTime, MNORMAL, 0,1); |
//----------------- |
// entnommene Kapazitaet (mAh) |
//----------------- |
drawmode = (naviData->UsedCapacity > Config.OSD_mAh_Warning ? MINVERS : MNORMAL); |
writex_ndigit_number_u( 2, 2, naviData->UsedCapacity, 5, 0, drawmode, 0,2); |
//----------------- |
// Höhe |
//----------------- |
if (naviData->Altimeter > (300 / AltimeterAdjust) || naviData->Altimeter < (-300 / AltimeterAdjust)) // above 10m only write full meters |
write_ndigit_number_s ( 16, 0, naviData->Altimeter / (30 / AltimeterAdjust), 4, 0, MNORMAL); |
else // up to 10m write meters.dm |
write_ndigit_number_s_10th( 16, 0, naviData->Altimeter / (3 / AltimeterAdjust), 3, 0, MNORMAL); |
//----------------- |
// steigen / sinken |
//----------------- |
OSD_Element_UpDown( 20, 0, 2,0); |
//----------------- |
// Compass Degree |
//----------------- |
writex_ndigit_number_u (17, 1, naviData->CompassHeading, 3, 0,MNORMAL, 0,1); |
//----------------- |
// Strom |
//----------------- |
//write_ndigit_number_u_10th( 16, 2, naviData->Current, 3, 0,0); // alternativ mit Nachkomma |
writex_ndigit_number_u( 17, 2, naviData->Current/10, 3, 0,MNORMAL, 0,2); |
//----------------- |
// Sat Anzahl |
//----------------- |
write_ndigit_number_u (4, 4, naviData->SatsInUse, 2, 0,MNORMAL); |
//----------------- |
// Sat Warnung "!" |
//----------------- |
/* |
if( naviData->NCFlags & NC_FLAG_GPS_OK ) |
lcd_printp_at( 9, 4, PSTR(" "), MNORMAL); |
else |
lcd_printp_at( 9, 4, PSTR("!"), MNORMAL); |
*/ |
OSD_Element_Flag( 8, 4, OSD_FLAG_S0, -1,0 ); // Sat Warnung (GPS not ok) |
//----------------- |
// Geschwindigkeit |
//----------------- |
writex_ndigit_number_u( 3, 5, (uint16_t) (((uint32_t) naviData->GroundSpeed * (uint32_t) 9) / (uint32_t) 250), 3, 0,MNORMAL, 0,1); |
//----------------- |
// Home Distance |
//----------------- |
write_ndigit_number_u( 17, 4, naviData->HomePositionDeviation.Distance / 10, 3, 0,MNORMAL); |
//----------------- |
// Home Winkel |
//----------------- |
writex_ndigit_number_u( 16, 5, heading_home, 4, 0,MNORMAL, 0,1); |
//----------------- |
// Flags |
//----------------- |
OSD_Element_Flag( 1, 7, OSD_FLAG_CF, 0,0 ); // Care Free |
OSD_Element_Flag( 4, 7, OSD_FLAG_AH, 0,0 ); // Altitude Hold |
OSD_Element_Flag( 7, 7, OSD_FLAG_PH, 0,0 ); // Position Hold |
OSD_Element_Flag( 10, 7, OSD_FLAG_CH, 0,0 ); // Coming Home |
OSD_Element_Flag( 13, 7, OSD_FLAG_EL, 0,0 ); // Emergency Landing |
//----------------- |
// RC-Quality (MK) |
//----------------- |
write_ndigit_number_u( 17, 7, naviData->RC_Quality, 3, 0,MNORMAL); |
#ifdef OSD_DEMO |
//----------------- |
// Flags |
//----------------- |
OSD_Element_Flag_Label( 8, 0, OSD_FLAG_BA, true, 0,0 ); // DEMO: Batterie Warnung |
OSD_Element_Flag_Label( 8, 4, OSD_FLAG_S0, true, -1,0 ); // DEMO: Sat Warnung (GPS not ok) |
OSD_Element_Flag_Label( 1, 7, OSD_FLAG_CF, true, 0,0 ); // DEMO |
OSD_Element_Flag_Label( 4, 7, OSD_FLAG_AH, true, 0,0 ); // DEMO |
OSD_Element_Flag_Label( 7, 7, OSD_FLAG_PH, true, 0,0 ); // DEMO |
OSD_Element_Flag_Label( 10, 7, OSD_FLAG_CH, true, 0,0 ); // DEMO |
OSD_Element_Flag_Label( 13, 7, OSD_FLAG_EL, true, 0,0 ); // DEMO |
#endif |
return( ScreenName ); |
} |
//-------------------------------------------------------------- |
// OSD-Screen "Navigation" |
// |
// nMode: 0 = update values |
// 1 = redraw labels and update values |
//-------------------------------------------------------------- |
const char * OSD_Screen_Navigation( uint8_t nMode ) |
{ |
const char *ScreenName = PSTR("Navigation"); |
int8_t xoffs, yoffs; |
//----------------------------------------- |
// REDRAW |
// statische Screen Elemente die nicht |
// jedesmal neu gezeichnet werden muessen |
//----------------------------------------- |
if( nMode == OSD_SCREEN_REDRAW ) |
{ |
// do things here for static screen elements like labels and so.... |
lcd_line ((6*6-4), 0, (6*6-4), 9, 1); // Linie Vertikal links |
lcd_line ((15*6+3), 0, (15*6+3), 9, 1); // Linie Vertikal rechts |
lcd_line (0, 10, 127, 10, 1); // Linie Horizontal |
lcdx_printp_at( 0, 2, PSTR("Alt:"), MNORMAL, 0,2); // Hoehe |
lcdx_printp_at( 0, 5, PSTR("Home:"), MNORMAL, 0,3); // Home Distance |
} |
//----------------- |
// Oben: Batt Level (Volt) |
//----------------- |
OSD_Element_BattLevel2( 0, 0, 0,0 ); |
//----------------- |
// Oben: Kompass Rose |
//----------------- |
OSD_Element_CompassRose( 6, 0); |
//----------------- |
// Oben: Flugzeit |
//----------------- |
write_time(16, 0, naviData->FlyingTime); |
//----------------- |
// Hoehe |
//----------------- |
xoffs = 0; |
yoffs = 3; |
drawmode = MNORMAL; |
if (naviData->Altimeter > (300 / AltimeterAdjust) || naviData->Altimeter < (-300 / AltimeterAdjust)) // above 10m only write full meters |
writex_ndigit_number_s ( 0, 3, naviData->Altimeter / (30 / AltimeterAdjust), 4, 0, drawmode, xoffs,yoffs); |
else // up to 10m write meters.dm |
writex_ndigit_number_s_10th( 0, 3, naviData->Altimeter / (3 / AltimeterAdjust), 3, 0, drawmode, xoffs,yoffs); |
//----------------- |
// Steigen / Sinken |
//----------------- |
OSD_Element_UpDown( 4, 3, 1,yoffs); |
//----------------- |
// Home Distance |
//----------------- |
yoffs = 3; |
writex_ndigit_number_u( 0, 6, naviData->HomePositionDeviation.Distance / 10, 4, 0,MNORMAL, 0,yoffs+1); |
lcdx_printp_at( 4, 6, PSTR("m"), MNORMAL, 2,yoffs+1); // Home |
//----------------- |
// Home Circle |
//----------------- |
xoffs = 0; |
yoffs = 3; |
OSD_Element_HomeCircle( 8, 3, 9, 4, xoffs,yoffs); // Home Circle |
lcd_frect( (9*6)-3+xoffs, (4*8)-2+yoffs, (3*6)+4, (1*8)+2, 0); // inner clear |
lcd_rect ( (9*6)-4+xoffs, (4*8)-3+yoffs, (3*6)+6, (1*8)+4, 1); // inner rect |
lcd_frect ( 61+xoffs, 57+yoffs, 2, 2, 1); // bottom mini rect |
writex_ndigit_number_u( 9, 4, heading_home, 3, 0,MNORMAL, xoffs,yoffs); // Degree (Winkel) |
//----------------- |
// Variometer |
//----------------- |
//void draw_variometer (uint8_t x, uint8_t y, uint8_t width, uint8_t hight, int16_t variometer) |
//draw_variometer( 95, 38, 7, 30, naviData->Variometer); |
//draw_variometer( 94, 38, 7, 21, naviData->Variometer); |
//draw_variometer2( 94, 28, 7, 21, naviData->Variometer); |
//----------------- |
// Flags |
//----------------- |
OSD_Element_Flag( 16, 2, OSD_FLAG_BA, -3, 0); // MK Batt Warning |
OSD_Element_Flag( 19, 2, OSD_FLAG_CF, 0, 0); // Carefree |
OSD_Element_Flag( 19, 4, OSD_FLAG_AH, 0,-3); // Altitude Hold |
OSD_Element_Flag( 19, 6, OSD_FLAG_PH, 0,-6); // Position Hold |
OSD_Element_Flag( 19, 7, OSD_FLAG_CH, 0,-1); // Coming Home |
OSD_Element_Flag( 16, 7, OSD_FLAG_S0, -3,-1); // GPS-Sat not ok (GPS NOT ok) |
#ifdef OSD_DEMO |
//----------------- |
// Flags |
//----------------- |
OSD_Element_Flag_Label( 16, 2, OSD_FLAG_BA, true, -3,0); // DEMO |
OSD_Element_Flag_Label( 19, 2, OSD_FLAG_CF, true, 0,0); // DEMO |
OSD_Element_Flag_Label( 19, 4, OSD_FLAG_AH, true, 0,-3); // DEMO |
OSD_Element_Flag_Label( 19, 6, OSD_FLAG_PH, true, 0,-6); // DEMO |
OSD_Element_Flag_Label( 19, 7, OSD_FLAG_CH, true, 0,-1); // DEMO |
OSD_Element_Flag_Label( 16, 7, OSD_FLAG_S0, true, -3,-1); // DEMO |
#endif |
return( ScreenName ); |
} |
//-------------------------------------------------------------- |
// OSD-Screen "Status" |
// |
// nMode: 0 = update values |
// 1 = redraw labels and update values |
//-------------------------------------------------------------- |
const char * OSD_Screen_MKStatus( uint8_t nMode ) |
{ |
const char *ScreenName = PSTR("MK-Status"); |
int8_t xoffs; |
//----------------------------------------- |
// REDRAW |
// statische Screen Elemente die nicht |
// jedesmal neu gezeichnet werden muessen |
//----------------------------------------- |
if( nMode == OSD_SCREEN_REDRAW ) |
{ |
// do things here for static screen elements like labels and so.... |
lcd_line ((6*6-3), 0, (6*6-3), 9, 1); // Linie Vertikal links |
lcd_line ((15*6+3), 0, (15*6+3), 9, 1); // Linie Vertikal rechts |
lcd_line (0, 10, 127, 10, 1); // Linie Horizontal |
//lcdx_printp_at( 8, 0, PSTR("Status"), MNORMAL, -3,0); // oben, mitte Text |
lcdx_printp_at( 13, 0, PSTR("A"), MNORMAL, -4,0); // oben, mitte "A" |
} |
//----------------- |
// Oben: Batt Level (Volt) |
//----------------- |
OSD_Element_BattLevel2( 0, 0, 0,0 ); |
//----------------- |
// Strom |
//----------------- |
writex_ndigit_number_u_10th( 7, 0, naviData->Current, 4, 0,MNORMAL, 1,0); // Strom mit Nachkomma |
//----------------- |
// Oben: Flugzeit |
//----------------- |
write_time(16, 0, naviData->FlyingTime); |
//----------------- |
// Flags |
//----------------- |
xoffs = -7; |
OSD_Element_Flag( 19, 2, OSD_FLAG_CF, 0+xoffs, 0); // Carefree |
OSD_Element_Flag( 19, 4, OSD_FLAG_AH, 0+xoffs,-3); // Altitude Hold |
OSD_Element_Flag( 19, 6, OSD_FLAG_PH, 0+xoffs,-6); // Position Hold |
OSD_Element_Flag( 19, 7, OSD_FLAG_CH, 0+xoffs,-1); // Coming Home |
xoffs -= 4; |
OSD_Element_Flag( 16, 2, OSD_FLAG_BA, -3+xoffs, 0); // MK Batt Warning |
OSD_Element_Flag( 16, 4, OSD_FLAG_EL, -3+xoffs,-3); // Emergency Landing |
OSD_Element_Flag( 16, 6, OSD_FLAG_RL, -3+xoffs,-6); // Range Limit |
OSD_Element_Flag( 16, 7, OSD_FLAG_S0, -3+xoffs,-1); // GPS-Sat not ok (GPS NOT ok) |
xoffs -= 4; |
OSD_Element_Flag( 12, 2, OSD_FLAG_CA, 0+xoffs, 0); // Calibrate |
OSD_Element_Flag( 12, 4, OSD_FLAG_ST, 0+xoffs,-3); // Start |
OSD_Element_Flag( 12, 6, OSD_FLAG_MR, 0+xoffs,-6); // Motor Run |
OSD_Element_Flag( 12, 7, OSD_FLAG_FY, 0+xoffs,-1); // Fly |
xoffs -= 4; |
OSD_Element_Flag( 9, 2, OSD_FLAG_O1, -2+xoffs, 0); // Out1 |
OSD_Element_Flag( 9, 4, OSD_FLAG_O2, -2+xoffs,-3); // Out2 |
OSD_Element_Flag( 9, 6, OSD_FLAG_TR, -2+xoffs,-6); // Target Reached |
OSD_Element_Flag( 9, 7, OSD_FLAG_MC, -2+xoffs,-1); // Manual Control |
xoffs -= 4; |
OSD_Element_Flag( 6, 2, OSD_FLAG_TU, -4+xoffs, 0); // Vario Trim Up |
OSD_Element_Flag( 6, 4, OSD_FLAG_TD, -4+xoffs,-3); // Vario Trim Down |
OSD_Element_Flag( 6, 6, OSD_FLAG_FR, -4+xoffs,-6); // Free |
OSD_Element_Flag( 6, 7, OSD_FLAG_SL, -4+xoffs,-1); // No Serial Link |
#ifdef OSD_DEMO |
//----------------- |
// Flags |
//----------------- |
/* |
PSTR("AH"), // OSD_FLAG_AH Altitue Hold |
PSTR("PH"), // OSD_FLAG_PH Position Hold |
PSTR("CF"), // OSD_FLAG_CF Care Free |
PSTR("CH"), // OSD_FLAG_CH Coming Home |
PSTR("o1"), // OSD_FLAG_O1 Out1 |
PSTR("o2"), // OSD_FLAG_O2 Out2 |
PSTR("BA"), // OSD_FLAG_BA LowBat warning (MK) |
PSTR("CA"), // OSD_FLAG_CA Calibrate |
PSTR("ST"), // OSD_FLAG_ST Start |
PSTR("MR"), // OSD_FLAG_MR Motor Run |
PSTR("FY"), // OSD_FLAG_FY Fly |
PSTR("EL"), // OSD_FLAG_EL Emergency Landing |
PSTR("FS"), // OSD_FLAG_FS RX Failsave Active |
PSTR("GP"), // OSD_FLAG_GP GPS Ok |
PSTR("S!") // OSD_FLAG_S0 GPS-Sat not ok (GPS NOT ok) |
PSTR("TU"), // OSD_FLAG_TU Vario Trim Up |
PSTR("TD"), // OSD_FLAG_TD Vario Trim Down |
PSTR("FR"), // OSD_FLAG_FR Free |
PSTR("RL"), // OSD_FLAG_RL Range Limit |
PSTR("SL"), // OSD_FLAG_SL No Serial Link |
PSTR("TR"), // OSD_FLAG_TR Target Reached |
PSTR("MC") // OSD_FLAG_MC Manual Control |
*/ |
xoffs = -7; |
OSD_Element_Flag_Label( 19, 2, OSD_FLAG_CF, true, 0+xoffs, 0); // DEMO: Carefree |
OSD_Element_Flag_Label( 19, 4, OSD_FLAG_AH, true, 0+xoffs,-3); // DEMO: Altitude Hold |
OSD_Element_Flag_Label( 19, 6, OSD_FLAG_PH, true, 0+xoffs,-6); // DEMO: Position Hold |
OSD_Element_Flag_Label( 19, 7, OSD_FLAG_CH, true, 0+xoffs,-1); // DEMO: Coming Home |
xoffs -= 4; |
OSD_Element_Flag_Label( 16, 2, OSD_FLAG_BA, true, -3+xoffs, 0); // DEMO: MK Batt Warning |
OSD_Element_Flag_Label( 16, 4, OSD_FLAG_EL, true, -3+xoffs,-3); // DEMO: Emergency Landing |
OSD_Element_Flag_Label( 16, 6, OSD_FLAG_RL, true, -3+xoffs,-6); // DEMO: Range Limit |
OSD_Element_Flag_Label( 16, 7, OSD_FLAG_S0, true, -3+xoffs,-1); // DEMO: GPS-Sat not ok (GPS NOT ok) |
xoffs -= 4; |
OSD_Element_Flag_Label( 12, 2, OSD_FLAG_CA, true, 0+xoffs, 0); // DEMO: Calibrate |
OSD_Element_Flag_Label( 12, 4, OSD_FLAG_ST, true, 0+xoffs,-3); // DEMO: Start |
OSD_Element_Flag_Label( 12, 6, OSD_FLAG_MR, true, 0+xoffs,-6); // DEMO: Motor Run |
OSD_Element_Flag_Label( 12, 7, OSD_FLAG_FY, true, 0+xoffs,-1); // DEMO: Fly |
xoffs -= 4; |
OSD_Element_Flag_Label( 9, 2, OSD_FLAG_O1, true, -2+xoffs, 0); // DEMO: Out1 |
OSD_Element_Flag_Label( 9, 4, OSD_FLAG_O2, true, -2+xoffs,-3); // DEMO: Out2 |
OSD_Element_Flag_Label( 9, 6, OSD_FLAG_TR, true, -2+xoffs,-6); // DEMO: Target Reached |
OSD_Element_Flag_Label( 9, 7, OSD_FLAG_MC, true, -2+xoffs,-1); // DEMO: Manual Control |
xoffs -= 4; |
OSD_Element_Flag_Label( 6, 2, OSD_FLAG_TU, true, -4+xoffs, 0); // DEMO: Vario Trim Up |
OSD_Element_Flag_Label( 6, 4, OSD_FLAG_TD, true, -4+xoffs,-3); // DEMO: Vario Trim Down |
OSD_Element_Flag_Label( 6, 6, OSD_FLAG_FR, true, -4+xoffs,-6); // DEMO: Free |
OSD_Element_Flag_Label( 6, 7, OSD_FLAG_SL, true, -4+xoffs,-1); // DEMO: No Serial Link |
#endif |
return( ScreenName ); |
} |
//############################################################## |
#ifdef OSD_DEBUG_SCREEN |
//############################################################## |
//************************************************************** |
//* OSD_DEBUG_SCREEN - Experimental-Code usw. |
//* - nicht fuer die Oeffentlichkeit bestimmt |
//* - gesteuert ueber define OSD_DEBUG_SCREEN |
//************************************************************** |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// NOTIZEN |
// |
// 1. Thema: Motorwerte abfragen |
// |
// ja, auf die gleiche Weise wie man an die Config Parameter kommt. |
// |
// SwitchToFC(); |
// SendOutData( 'u', ADDRESS_FC, BL-Adresse, &tmp_dat, 1); |
// |
// Die Daten kommen dann in der Form: |
// typedef struct |
// { |
// uint8_t Version; // the version of the BL (0 = old) |
// uint8_t SetPoint; // written by attitude controller |
// uint8_t SetPointLowerBits; // for higher Resolution of new BLs |
// uint8_t State; // 7 bit for I2C error counter, highest bit indicates if motor is present |
// uint8_t ReadMode; // select data to read |
// // the following bytes must be exactly in that order! |
// uint8_t Current; // in 0.1 A steps, read back from BL |
// uint8_t MaxPWM; // read back from BL -> is less than 255 if BL is in current limit, not running (250) or starting (40) |
// int8_t Temperature; // old BL-Ctrl will return a 255 here, the new version the temp. in ?C |
// } __attribute__((packed)) MotorData_t; |
// |
// |
// kennst Du die Seite?:http://www.mikrokopter.de/ucwiki/en/SerialProtocol?highlight=%28%28----%28-*%29%28\r%29%3F\n%29%28.*%29CategoryCoding%29#en.2BAC8-SerialCommands.Flight-Ctrl |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
//-------------------------------------------------------------- |
//-------------------------------------------------------------- |
uint8_t xload_setting( uint8_t setting ) |
{ |
mode = 'Q'; // Settings |
uint8_t timeout = 50; |
rxd_buffer_locked = FALSE; |
while (!rxd_buffer_locked && timeout) |
{ |
SendOutData ('q', ADDRESS_FC, 1, &setting, 1); |
// _delay_ms(50); |
timer = 20; |
while (timer > 0); |
timeout--; |
} |
if (timeout != 0) |
{ |
Decode64 (); |
setting = *pRxData; |
mk_param_struct = (mk_param_struct_t *) (pRxData + 1) ; |
} |
else |
{ // timeout occured |
// lcd_printp_at (0, 2, PSTR("Fehler: keine Daten"), 0); |
lcd_puts_at(0, 2, strGet(OSD_ERROR), 0); |
timer = 100; |
while (timer > 0); |
setting = 255; |
} |
return setting; |
} |
//-------------------------------------------------------------- |
//-------------------------------------------------------------- |
const char * OSD_Screen_Debug( uint8_t nMode ) |
{ |
const char *ScreenName = PSTR("Debug"); |
static s16 min_debug = 0; |
static s16 max_debug = 0; |
static uint16_t debug_count = 0; |
//----------------------------------------- |
// REDRAW |
// statische Screen Elemente die nicht |
// jedesmal neu gezeichnet werden muessen |
//----------------------------------------- |
if( nMode == OSD_SCREEN_REDRAW ) |
{ |
// do things here for static screen elements like labels and so.... |
min_debug = 0; |
max_debug = 0; |
} |
lcd_printp_at( 0, 0, PSTR("Debug"), 0); |
debug_count++; |
if( naviData->Variometer < min_debug ) min_debug = naviData->Variometer; |
if( naviData->Variometer > max_debug ) max_debug = naviData->Variometer; |
write_ndigit_number_s ( 8, 1, (naviData->Variometer), 12, 0,MNORMAL); // s16 Variometer; |
write_ndigit_number_s ( 8, 2, (min_debug), 12, 0,MNORMAL); // s16 Variometer; |
write_ndigit_number_s ( 8, 3, (max_debug), 12, 0,MNORMAL); // s16 Variometer; |
write_ndigit_number_u ( 8, 5, (debug_count), 12, 0,MNORMAL); // |
//write_ndigit_number_u ( 8, 6, (timer), 12, 0,MNORMAL); // |
//draw_variometer2( 6, 19, 7, 21, naviData->Variometer); |
return( ScreenName ); |
} |
//############################################################## |
#endif // OSD_DEBUG_SCREEN |
//############################################################## |
//-------------------------------------------------------------- |
// ehemals: OSD_ALTITUDE,Config.OSD_ScreenMode == 0 |
//-------------------------------------------------------------- |
const char * OSD_Screen_OSD0( uint8_t nMode ) |
{ |
const char *ScreenName = PSTR("OSD0"); |
//uint8_t xoffs; |
//----------------------------------------- |
// REDRAW static screen elements |
//----------------------------------------- |
if( nMode == OSD_SCREEN_REDRAW ) |
{ |
// do things here for static screen elements like labels and so.... |
} |
OSD_Element_AltitudeControl ( 0, 3); |
OSD_Element_Altitude ( 11, 3, 0); |
OSD_Element_BatteryLevel ( 0, 7, 0); |
OSD_Element_Capacity ( 13, 7); |
OSD_Element_Current ( 8, 7); |
OSD_Element_CareFree ( 0, 5); |
OSD_Element_CompassDegree ( 13, 0, 0); |
OSD_Element_CompassDirection( 18, 0); |
OSD_Element_CompassRose ( 12, 1); |
OSD_Element_FlyingTime ( 0, 1); |
OSD_Element_GroundSpeed ( 0, 0); |
OSD_Element_HomeCircle ( 16, 4, 5, 0, 0,0); |
OSD_Element_HomeDegree ( 12, 4); |
OSD_Element_HomeDistance ( 10, 5, 0); |
OSD_Element_Target ( 10, 6, 0); |
//OSD_Element_TargetDegree ( x, y); |
OSD_Element_WayPoint ( 5, 6); |
OSD_Element_LED1Output ( 0, 6); |
OSD_Element_LED2Output ( 3, 6); |
//OSD_Element_Manuell ( x, y); |
OSD_Element_NaviMode ( 0, 4); |
//OSD_Element_RCIntensity ( x, y); |
OSD_Element_VarioWert ( 12, 2); |
OSD_Element_SatsInUse ( 18, 2, 0); |
OSD_Element_StatusFlags ( 0, 2); |
OSD_Element_Variometer ( 9, 0); |
return( ScreenName ); |
} |
//-------------------------------------------------------------- |
// ehemals: OSD_ALTITUDE,Config.OSD_ScreenMode == 1 |
//-------------------------------------------------------------- |
const char * OSD_Screen_OSD1( uint8_t nMode ) |
{ |
const char *ScreenName = PSTR("OSD1"); |
//uint8_t xoffs; |
//----------------------------------------- |
// REDRAW static screen elements |
//----------------------------------------- |
if( nMode == OSD_SCREEN_REDRAW ) |
{ |
// do things here for static screen elements like labels and so.... |
} |
//OSD_Element_AltitudeControl( x, y); |
OSD_Element_Altitude ( 1, 1, 1); |
OSD_Element_BatteryLevel ( 0, 7, 1); |
OSD_Element_Capacity ( 13, 7); |
OSD_Element_Current ( 8, 7); |
//OSD_Element_CareFree ( x, y); |
OSD_Element_CompassDegree ( 13, 0, 1); |
OSD_Element_CompassDirection( 18, 0); |
OSD_Element_CompassRose ( 12, 1); |
OSD_Element_FlyingTime ( 7, 6); |
OSD_Element_GroundSpeed ( 0, 0); |
OSD_Element_HomeCircle ( 1, 3, 7, 0, 0,0); |
OSD_Element_HomeDegree ( 8, 3); |
OSD_Element_HomeDistance ( 7, 2, 1); |
//OSD_Element_Target ( x, y, 1); |
//OSD_Element_TargetDegree ( x, y); |
//OSD_Element_WayPoint ( x, y); |
//OSD_Element_LED1Output ( x, y); |
//OSD_Element_LED2Output ( x, y); |
//OSD_Element_Manuell ( x, y); |
OSD_Element_NaviMode ( 8, 5); |
OSD_Element_RCIntensity ( 15, 6); |
OSD_Element_VarioWert ( 15, 2); |
OSD_Element_SatsInUse ( 8, 4, 1); |
//OSD_Element_StatusFlags ( x, y); |
OSD_Element_Variometer ( 9, 0); |
return( ScreenName ); |
} |
//-------------------------------------------------------------- |
// ehemals: OSD_ALTITUDE,Config.OSD_ScreenMode == 2 |
//-------------------------------------------------------------- |
const char * OSD_Screen_OSD2( uint8_t nMode ) |
{ |
const char *ScreenName = PSTR("OSD2"); |
//uint8_t xoffs; |
//----------------------------------------- |
// REDRAW static screen elements |
//----------------------------------------- |
if( nMode == OSD_SCREEN_REDRAW ) |
{ |
// do things here for static screen elements like labels and so.... |
} |
OSD_Element_AltitudeControl ( 0, 1); |
OSD_Element_Altitude ( 0, 4, 2); |
OSD_Element_BatteryLevel ( 13, 7, 2); |
OSD_Element_Capacity ( 0, 7); |
OSD_Element_Current ( 8, 7); |
OSD_Element_CareFree ( 0, 3); |
OSD_Element_CompassDegree ( 12, 3, 2); |
//OSD_Element_CompassDirection( x, y); |
//OSD_Element_CompassRose ( x, y); |
OSD_Element_FlyingTime ( 15, 5); |
//OSD_Element_GroundSpeed ( x, y); |
OSD_Element_HomeCircle ( 16, 0, 5, 0, 0,0); |
OSD_Element_HomeDegree ( 11, 5); |
OSD_Element_HomeDistance ( 0, 5, 2); |
OSD_Element_Target ( 0, 6, 2); |
OSD_Element_TargetDegree ( 11, 6); |
//OSD_Element_WayPoint ( x, y); |
OSD_Element_LED1Output ( 12, 2); |
OSD_Element_LED2Output ( 14, 2); |
//OSD_Element_Manuell ( x, y); |
OSD_Element_NaviMode ( 0, 2); |
//OSD_Element_RCIntensity ( x, y); |
OSD_Element_VarioWert ( 15, 4); |
OSD_Element_SatsInUse ( 10, 0, 2); |
OSD_Element_StatusFlags ( 0, 0); |
//OSD_Element_Variometer ( x, y); |
return( ScreenName ); |
} |
//-------------------------------------------------------------- |
//-------------------------------------------------------------- |
const char * OSD_Screen_3DLage( uint8_t nMode ) |
{ |
const char *ScreenName = PSTR("3D Lage"); |
uint16_t head_home; |
uint8_t Nick; |
uint8_t Roll; |
//----------------------------------------- |
// REDRAW static screen elements |
//----------------------------------------- |
if( nMode == OSD_SCREEN_REDRAW ) |
{ |
// do things here for static screen elements like labels and so.... |
} |
head_home = (naviData->HomePositionDeviation.Bearing + 360 - naviData->CompassHeading) % 360; |
//lcd_cls (); |
lcd_line(26,32,100,32,1); // horizontal // |
lcd_line(63,0,63,63,1); // vertical // |
//lcd_puts_at(12, 7, strGet(KEYLINE5), 0); |
// 45' Angel |
lcd_line(61,11,65,11,1); // -- // |
lcd_line(40,30,40,34,1); // | // |
lcd_line(86,30,86,34,1); // | // |
lcd_line(61,53,65,53,1); // -- // |
lcd_puts_at(9, 0, strGet(OSD_3D_V), 0); // V |
lcd_puts_at(3, 3, strGet(OSD_3D_L), 0); // L |
lcd_puts_at(17, 3, strGet(OSD_3D_R), 0); // R |
lcd_puts_at(9, 7, strGet(OSD_3D_H), 0); // H |
lcd_puts_at(0, 0, strGet(OSD_3D_NICK), 0); // Ni |
write_ndigit_number_s (2, 0, naviData->AngleNick, 3, 0,0); |
lcd_putc (5, 0, 0x1e, 0); // degree symbol |
lcd_puts_at(0, 7, strGet(OSD_3D_ROLL), 0); // Ro |
write_ndigit_number_s (2, 7, naviData->AngleRoll, 3, 0,0); |
lcd_putc (5, 7, 0x1e, 0); // degree symbol |
lcd_puts_at(13, 0, strGet(OSD_3D_COMPASS), 0); |
//write_ndigit_number_s (15, 0,head_home, 3, 0); |
write_ndigit_number_u (15, 0, naviData->CompassHeading, 3, 0,0); |
lcd_putc (18, 0, 0x1e, 0); // degree symbol |
lcd_printp_at (19, 0, (const char *) (pgm_read_word ( &(directions_p[heading_conv(naviData->CompassHeading)]))), 0); |
Nick = ((-naviData->AngleNick/2)+32); |
Roll = ((-naviData->AngleRoll/2)+63); |
lcd_ellipse ( old_AngleRoll, old_AngleNick, 9, 8, 0); |
lcd_ellipse_line( old_AngleRoll, old_AngleNick, 8, 7, old_hh, 0); |
lcd_ellipse ( Roll, Nick, 9, 8, 1); |
lcd_ellipse_line( Roll, Nick, 8, 7, head_home, 1); |
// remember last values (3DL) |
old_hh = head_home; |
old_AngleNick = Nick; |
old_AngleRoll = Roll; |
return( ScreenName ); |
} |
//-------------------------------------------------------------- |
//-------------------------------------------------------------- |
const char * OSD_Screen_Statistics( uint8_t nMode ) |
{ |
const char *ScreenName = PSTR("Statistics"); |
uint8_t line = 0; |
//----------------------------------------- |
// REDRAW static screen elements |
//----------------------------------------- |
/* |
if( nMode == OSD_SCREEN_REDRAW ) |
{ |
// do things here for static screen elements like labels and so.... |
} |
*/ |
//--------------------------- |
// max Altitude |
lcd_puts_at (0, line, strGet(STATS_ITEM_0), MNORMAL); |
write_ndigit_number_s (14, line, max_Altimeter / (30 / AltimeterAdjust), 4, 0,MNORMAL); |
lcdx_putc (18, line, 'm', MNORMAL, 2,0); |
//--------------------------- |
// max Speed |
// max_GroundSpeed = 1; |
lcd_puts_at (0, ++line, strGet(STATS_ITEM_1), MNORMAL); |
write_ndigit_number_u (15, line, (uint16_t) (((uint32_t) max_GroundSpeed * (uint32_t) 9) / (uint32_t) 250), 3, 0,MNORMAL); |
lcdx_printp_at(18, line, PSTR("kmh"), MNORMAL, 2,0); |
//--------------------------- |
// max Distance |
// max_Distance = 64512; |
lcd_puts_at (0, ++line, strGet(STATS_ITEM_2), MNORMAL); |
write_ndigit_number_u (14, line, max_Distance / 10, 4, 0,MNORMAL); |
lcdx_putc (18, line, 'm', MNORMAL, 2,0); |
//--------------------------- |
// max time |
// max_FlyingTime = 3600; |
lcd_puts_at (0, ++line, strGet(STATS_ITEM_4), MNORMAL); |
write_time (13, line, max_FlyingTime); |
//--------------------------- |
// min voltage |
lcd_puts_at (0, ++line, strGet(STATS_ITEM_3), MNORMAL); |
if( min_UBat==255 ) |
lcd_printp_at(14, line, PSTR(" 0"), MNORMAL); |
else |
write_ndigit_number_u_10th (14, line, min_UBat, 3, 0,MNORMAL); |
lcdx_putc (18, line, 'V', MNORMAL, 2,0); |
//--------------------------- |
// max Current |
// max_Current = 1000; |
lcd_puts_at (0, ++line, strGet(STATS_ITEM_5), MNORMAL); |
write_ndigit_number_u_10th (13, line, max_Current, 4, 0,MNORMAL); |
lcdx_putc (18, line, 'A', MNORMAL, 2,0); |
//--------------------------- |
// Used Capacity |
lcd_puts_at (0, ++line, strGet(STATS_ITEM_6), MNORMAL); |
write_ndigit_number_u (14, line, max_Capacity, 4, 0,MNORMAL); |
lcdx_printp_at(18, line, PSTR("mAh"), MNORMAL, 2,0); |
return( ScreenName ); |
} |
//-------------------------------------------------------------- |
//-------------------------------------------------------------- |
void print_statistics (void) |
{ |
lcd_cls (); |
lcd_puts_at(12, 7, strGet(ENDE), 0); |
OSD_Screen_Statistics( OSD_SCREEN_REDRAW ); |
while (!get_key_press (1 << KEY_ESC)) |
timer = TIMEOUT; |
COSD_FLAGS2 &= ~COSD_WASFLYING; |
get_key_press(KEY_ALL); |
lcd_cls(); |
} |
//----------------------------------------------------------- |
//----------------------------------------------------------- |
void OSD_Info( uint8_t ScreenNum, const char *ScreenName) |
{ |
lcd_frect( 0, 36, 127, 10, 0); // clear |
lcd_frect( 0, 34, 4, 4, 0); // clear links |
lcd_frect( 0, 40, 127, 24, 1); // Box |
lcd_frect( 10, 36, 108, 4, 1); // Filler oben |
lcd_fcircle( 8, 39, 7, 1); // Links |
lcd_fcircle( 121, 41, 5, 1); // Rechts |
lcd_line ( 4, 51, 122, 51, 0); // Linie mitte |
//----------------------- |
// ScreenNummer: ScreenName |
//----------------------- |
write_ndigit_number_s ( 1, 5, ScreenNum, 2, 1,2); |
lcd_printp_at( 3, 5, PSTR(":"), 2); |
lcd_printp_at( 5, 5, ScreenName, 2); |
//----------------------- |
// Key's |
//----------------------- |
lcd_puts_at(0, 7, strGet(KEYLINE3), 2); |
lcd_printp_at (17, 7, PSTR("Info"), 2); |
do |
{ |
timer = TIMEOUT; |
_delay_ms(50); |
} while ( !( (get_key_press (1 << KEY_ENTER)) || (get_key_press (1 << KEY_ESC)) || (get_key_press (1 << KEY_PLUS)) || (get_key_press (1 << KEY_MINUS)) ) ); |
} |
//############################################################## |
//# OSD MAIN LOOP |
//############################################################## |
//-------------------------------------------------------------- |
// OSD MAIN LOOP |
//-------------------------------------------------------------- |
void osd( uint8_t ShowMode ) |
{ |
uint8_t flag; |
uint8_t tmp_dat; |
uint8_t ScreenRefresh; |
uint8_t MAX_OSD_Screens; |
//uint8_t status; // FC Kommunikation |
const char *ScreenName = PSTR(""); |
lcd_cls(); |
//---------------------------------------- |
// NC Hardware needed |
//---------------------------------------- |
if( hardware == FC ) |
{ |
lcd_puts_at(0, 3, strGet(ONLY_NC), 0); // Nur mit NC |
timer = 100; |
while (timer > 0); |
return; |
} |
/* |
//----------------------------------------------------------------------------------------------- |
// 07.03.2013 OG: del |
// Dieser Teil hat immer wieder Probleme bereitet bei der Verbindung des PKT-OSD zum MK da |
// Timeouts zustande kamen. Eine Recherche im Code ergab, dass die Nutzdaten die |
// hierueber bezogen werden sich lediglich auf Flags_ExtraConfig beschraenkten (CFG2_HEIGHT_LIMIT). |
// Siehe dazu untere Kommentare. |
// |
// Der negative Effekt moeglicher Timeouts und Verzoegerungen sind es aktuell nicht Wert |
// CFG2_HEIGHT_LIMIT zu unterstuetzen. Dieses Feature ist erstmal raus. |
// |
// Falls gewuenscht wird, dass CFG2_HEIGHT_LIMIT wieder in das PKT-OSD kommt muss |
// es zuverlaessig an anderer Stelle implementiert werden - und zwar nicht in osd.c |
// weil es eine statische FC-Information ist (ggf. beim Verbindungsaufbau PKT <-> MK). |
// |
// Hat auch aktuell Auswirkung auf den Code OSD_Element_AltitudeControl() |
// |
lcd_printp_at( 0, 3, PSTR("connecting MK..."), 0); |
SwitchToFC(); |
status = load_setting(0xff); |
if( status == 255 ) |
{ |
lcd_puts_at(0, 0, strGet(NO_SETTINGS), 0); // Keine Settings |
_delay_ms(2000); |
} |
Flags_ExtraConfig = mk_param_struct->ExtraConfig; // OG: wird in osd.c nur verwendet von: OSD_Element_AltitudeControl() |
Flags_GlobalConfig = mk_param_struct->GlobalConfig; // OG: wird nicht in osd.c verwendet |
Flags_GlobalConfig3 = mk_param_struct->GlobalConfig3; // OG: wird nicht in osd.c verwendet |
*/ |
rxd_buffer_locked = FALSE; // 07.03.2013 OG: fix |
// es gab Probleme mit dem Empfang gueltiger NC-Daten, die zu unschoenen Starteffekten bei den |
// OSD-Screens gefuehrt haben. Mit rxd_buffer_locked = FALSE vor SwitchToNC() ist das PKT wieder im 'Takt' |
SwitchToNC(); |
mode = 'O'; |
// disable debug... |
// RS232_request_mk_data (0, 'd', 0); |
tmp_dat = 0; |
SendOutData ('d', ADDRESS_ANY, 1, &tmp_dat, 1); |
// request OSD Data from NC every 100ms |
// RS232_request_mk_data (1, 'o', 100); |
tmp_dat = 10; |
OSD_active = true; // benoetigt für Navidata Ausgabe an SV2 |
SendOutData( 'o', ADDRESS_NC, 1, &tmp_dat, 1); |
//------------------------- |
// Clear statistics |
//------------------------- |
max_Altimeter = 0; |
max_GroundSpeed = 0; |
max_Distance = 0; |
min_UBat = 255; |
max_FlyingTime = 0; |
CellIsChecked = 0; |
cells = 0; |
AkkuWarnThreshold = 0; |
OldWP = 0; |
NextWP = false; |
//------------------------- |
//------------------------- |
MAX_OSD_Screens = 8; |
#ifdef OSD_DEBUG_SCREEN |
MAX_OSD_Screens += 1; |
#endif |
if( Config.OSD_ScreenMode >= MAX_OSD_Screens ) Config.OSD_ScreenMode = 0; |
//------------------------- |
// Timer & Flags |
//------------------------- |
ScreenRefresh = OSD_SCREEN_REDRAW; |
flag = 0; |
timer = TIMEOUT; |
abo_timer = ABO_TIMEOUT; |
timer2 = OSD_REFRESH_TIME; |
do |
{ |
if( rxd_buffer_locked ) |
{ |
timer = TIMEOUT; |
Decode64 (); |
naviData = (NaviData_t *) pRxData; |
//---------------------------------- |
// Winkel zu Home |
//---------------------------------- |
if( Config.OSD_HomeMKView == 1 ) |
heading_home = (naviData->HomePositionDeviation.Bearing + 360 - naviData->CompassHeading) % 360; |
else |
heading_home = (naviData->CompassHeading - naviData->HomePositionDeviation.Bearing + 360 ) % 360; |
//---------------------------------- |
// speichere letzte GPS-Positionen |
//---------------------------------- |
GPS_Pos_t currpos; |
currpos.Latitude = naviData->CurrentPosition.Latitude; |
currpos.Longitude = naviData->CurrentPosition.Longitude; |
if((currpos.Latitude != last5pos[0].Latitude)&&(currpos.Longitude != last5pos[0].Longitude)) |
{ |
last5pos[6] = last5pos[5]; |
last5pos[5] = last5pos[4]; |
last5pos[4] = last5pos[3]; |
last5pos[3] = last5pos[2]; |
last5pos[2] = last5pos[1]; |
last5pos[1] = last5pos[0]; |
last5pos[0] = currpos; |
} |
// 07.03.2013 OG: Speichere permanent letzte Position in Config |
// wurde vorher nur in OSD_TimeOut() gemacht |
Config.LastLatitude = currpos.Latitude; // speichere letzte Position in Config |
Config.LastLongitude = currpos.Longitude; // speichere letzte Position in Config |
flag = 1; |
if (naviData->FCStatusFlags & FC_STATUS_MOTOR_RUN) |
{ // should be engines running |
// motors are on, assume we were/are flying |
COSD_FLAGS2 |= COSD_WASFLYING; |
} |
//---------------------------------- |
// remember statistics (only when engines running) |
//---------------------------------- |
if( naviData->FCStatusFlags & FC_STATUS_MOTOR_RUN ) |
{ |
if (naviData->Altimeter > max_Altimeter) max_Altimeter = naviData->Altimeter; |
if (naviData->GroundSpeed > max_GroundSpeed) max_GroundSpeed = naviData->GroundSpeed; |
if (naviData->HomePositionDeviation.Distance > max_Distance) max_Distance = naviData->HomePositionDeviation.Distance; |
if (naviData->FlyingTime > max_FlyingTime) max_FlyingTime = naviData->FlyingTime; |
if (naviData->UBat < min_UBat) min_UBat = naviData->UBat; |
if (naviData->Current > max_Current) max_Current = naviData->Current; |
if (naviData->UsedCapacity > max_Capacity) max_Capacity = naviData->UsedCapacity; |
} |
//---------------------------------- |
// OSD-Screens |
//---------------------------------- |
if( ScreenRefresh == OSD_SCREEN_REDRAW ) lcd_cls(); |
if( timer2 == 0 || ScreenRefresh == OSD_SCREEN_REDRAW) |
{ |
if( Config.OSD_ScreenMode == 0) ScreenName = OSD_Screen_General( ScreenRefresh ); |
else if( Config.OSD_ScreenMode == 1) ScreenName = OSD_Screen_Navigation( ScreenRefresh ); |
else if( Config.OSD_ScreenMode == 2) ScreenName = OSD_Screen_MKStatus( ScreenRefresh ); |
else if( Config.OSD_ScreenMode == 3) ScreenName = OSD_Screen_OSD0( ScreenRefresh ); |
else if( Config.OSD_ScreenMode == 4) ScreenName = OSD_Screen_OSD1( ScreenRefresh ); |
else if( Config.OSD_ScreenMode == 5) ScreenName = OSD_Screen_OSD2( ScreenRefresh ); |
else if( Config.OSD_ScreenMode == 6) ScreenName = OSD_Screen_3DLage( ScreenRefresh ); |
else if( Config.OSD_ScreenMode == 7) ScreenName = OSD_Screen_Statistics( ScreenRefresh ); |
#ifdef OSD_DEBUG_SCREEN |
else if( Config.OSD_ScreenMode == (MAX_OSD_Screens-1) ) ScreenName = OSD_Screen_Debug( ScreenRefresh ); |
#endif |
} |
ScreenRefresh = OSD_SCREEN_REFRESH; |
if( timer2 == 0 ) timer2 = OSD_REFRESH_TIME; |
//----------------------- |
// Key-Handler |
//----------------------- |
//if (get_key_press (1 << KEY_PLUS)) |
//{ |
// print_position (); |
//} |
if( get_key_press (1 << KEY_ENTER) ) // info |
{ |
OSD_Info( Config.OSD_ScreenMode, ScreenName); |
ScreenRefresh = OSD_SCREEN_REDRAW; |
} |
if (get_key_press (1 << KEY_MINUS)) // previous screen |
{ |
if( Config.OSD_ScreenMode == 0 ) |
Config.OSD_ScreenMode = MAX_OSD_Screens-1; |
else |
Config.OSD_ScreenMode--; |
ScreenRefresh = OSD_SCREEN_REDRAW; |
} |
if (get_key_press (1 << KEY_PLUS)) // next Screen |
{ |
Config.OSD_ScreenMode++; |
Config.OSD_ScreenMode = ( Config.OSD_ScreenMode >= MAX_OSD_Screens ? 0 : Config.OSD_ScreenMode ); |
ScreenRefresh = OSD_SCREEN_REDRAW; |
} |
//----------------------- |
// Akku Warnung |
//----------------------- |
CheckMKLipo(); |
// if (naviData->UBat > MK_LowBat) //bei kurzzeitigen Schwankungen Beeper erst wieder aus wenn UBat 0,2 V höher als Warnschwelle |
// { //Beeper aus |
// BeepTime = 0; |
// BeepMuster = 0xFFFF; |
// } |
// Akku Warnung Ende |
//----------------------- |
// remember last values |
//----------------------- |
last_RC_Quality = naviData->RC_Quality; |
last_UBat = naviData->UBat; |
old_FCFlags = naviData->FCStatusFlags; |
rxd_buffer_locked = FALSE; |
//----------------------- |
// abo_timer |
//----------------------- |
if (!abo_timer) |
{ // renew abo every 3 sec |
// request OSD Data from NC every 100ms |
// RS232_request_mk_data (1, 'o', 100); |
tmp_dat = 10; |
SendOutData ('o', ADDRESS_NC, 1, &tmp_dat, 1); |
abo_timer = ABO_TIMEOUT; |
} |
} //if (rxd_buffer_locked) |
if (!timer) |
{ |
OSD_Timeout(flag); |
flag = 0; |
ScreenRefresh = OSD_SCREEN_REDRAW; |
} |
} while (!get_key_press (1 << KEY_ESC)); |
OSD_active = false; |
} |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/osd/osd.h |
---|
0,0 → 1,111 |
/***************************************************************************** |
* Copyright (C) 2008 Thomas Kaiser, thomas@ft-fanpage.de * |
* Copyright (C) 2009 Peter "woggle" Mack, mac@denich.net * |
* Copyright (C) 2011 Christian "Cebra" Brandtner, brandtner@brandtner.net * |
* Copyright (C) 2011 Harald Bongartz * |
* * |
* This program is free software; you can redistribute it and/or modify * |
* it under the terms of the GNU General Public License as published by * |
* the Free Software Foundation; either version 2 of the License. * |
* * |
* This program is distributed in the hope that it will be useful, * |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
* GNU General Public License for more details. * |
* * |
* You should have received a copy of the GNU General Public License * |
* along with this program; if not, write to the * |
* Free Software Foundation, Inc., * |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
* * |
* * |
* Credits to: * |
* Holger Buss & Ingo Busker from mikrokopter.de for the MK project + SVN * |
* http://www.mikrokopter.de * |
* Gregor "killagreg" Stobrawa for his version of the MK code * |
* Thomas Kaiser "thkais" for the original project. See * |
* http://www.ft-fanpage.de/mikrokopter/ * |
* http://forum.mikrokopter.de/topic-4061-1.html * |
* Claas Anders "CaScAdE" Rathje for providing the font and his C-OSD code * |
* http://www.mylifesucks.de/oss/c-osd/ * |
* Harald Bongartz "HaraldB" for providing his Ideas and Code for usibility* |
*****************************************************************************/ |
#ifndef _OSD_H |
#define _OSD_H |
#define OSD_SCREEN_REFRESH 0 // Screen: Werte anzeigen |
#define OSD_SCREEN_REDRAW 1 // Screen: Labels und statischer Elemente neu zeichen, Werte anzeigen |
// Flags |
#define OSD_FLAG_AH 0 // Altitue Hold |
#define OSD_FLAG_PH 1 // Position Hold |
#define OSD_FLAG_CF 2 // Care Free |
#define OSD_FLAG_CH 3 // Coming Home |
#define OSD_FLAG_O1 4 // Out1 (LED 1) |
#define OSD_FLAG_O2 5 // Out2 (LED 2) |
#define OSD_FLAG_BA 6 // LowBat warning (MK) |
#define OSD_FLAG_CA 7 // Calibrate |
#define OSD_FLAG_ST 8 // Start |
#define OSD_FLAG_MR 9 // Motor Run |
#define OSD_FLAG_FY 10 // Fly |
#define OSD_FLAG_EL 11 // Emergency Landing |
#define OSD_FLAG_FS 12 // RS Failsave Active |
#define OSD_FLAG_GP 13 // GPS ok |
#define OSD_FLAG_S0 14 // GPS-Sat not ok (GPS NOT ok) |
#define OSD_FLAG_TU 15 // Vario Trim Up |
#define OSD_FLAG_TD 16 // Vario Trim Down |
#define OSD_FLAG_FR 17 // Free |
#define OSD_FLAG_RL 18 // Range Limit |
#define OSD_FLAG_SL 19 // No Serial Link |
#define OSD_FLAG_TR 20 // Target Reached |
#define OSD_FLAG_MC 21 // Manual Control |
#define OSD_FLAG_COUNT 22 |
void osd (uint8_t ShowMode); |
void vario_beep_output (void); |
void OSD_Timeout(uint8_t flag); |
void CheckMKLipo(void); |
extern volatile uint8_t OSD_active; |
extern volatile uint8_t error; |
void OSD_Element_Flag_Label( uint8_t xC, uint8_t yC, uint8_t item, uint8_t lOn, int8_t xoffs, int8_t yoffs); |
void OSD_Element_Flag( uint8_t xC, uint8_t yC, uint8_t item, int8_t xoffs, int8_t yoffs); |
void OSD_Element_AltitudeControl( uint8_t x, uint8_t y ); |
void OSD_Element_Altitude( uint8_t x, uint8_t y, uint8_t nStyle ); |
void OSD_Element_BattLevel2( uint8_t x, uint8_t y, int8_t xoffs, int8_t yoffs ); |
void OSD_Element_BatteryLevel_Bar( uint8_t x, uint8_t y ); |
void OSD_Element_BatteryLevel_Text( uint8_t x, uint8_t y, uint8_t nStyle ); |
void OSD_Element_BatteryLevel( uint8_t x, uint8_t y, uint8_t nStyle ); |
void OSD_Element_Capacity( uint8_t x, uint8_t y ); |
void OSD_Element_CareFree( uint8_t x, uint8_t y ); |
void OSD_Element_CompassDegree( uint8_t x, uint8_t y, uint8_t nStyle ); |
void OSD_Element_CompassDirection( uint8_t x, uint8_t y ); |
void OSD_Element_CompassRose( uint8_t x, uint8_t y ); |
void OSD_Element_Current( uint8_t x, uint8_t y ); |
void OSD_Element_FlyingTime( uint8_t x, uint8_t y ); |
void OSD_Element_GroundSpeed( uint8_t x, uint8_t y ); |
void OSD_Element_HomeCircle( uint8_t x, uint8_t y, uint8_t breite, int8_t rOffset, int8_t xoffs, int8_t yoffs ); |
void OSD_Element_HomeDegree( uint8_t x, uint8_t y ); |
void OSD_Element_HomeDistance( uint8_t x, uint8_t y, uint8_t nStyle ); |
void OSD_Element_LEDOutput( uint8_t x, uint8_t y, uint8_t bitmask ); |
void OSD_Element_LED1Output( uint8_t x, uint8_t y ); |
void OSD_Element_LED2Output( uint8_t x, uint8_t y ); |
void OSD_Element_Manuell( uint8_t x, uint8_t y ); |
void OSD_Element_NaviMode( uint8_t x, uint8_t y ); |
void OSD_Element_RCIntensity( uint8_t x, uint8_t y ); |
void OSD_Element_SatsInUse( uint8_t x, uint8_t y, uint8_t nStyle ); |
void OSD_Element_StatusFlags( uint8_t x, uint8_t y ); |
void OSD_Element_Variometer( uint8_t x, uint8_t y ); |
void OSD_Element_Target( uint8_t x, uint8_t y, uint8_t nStyle ); |
void OSD_Element_VarioWert( uint8_t x, uint8_t y ); |
void OSD_Element_WayPoint( uint8_t x, uint8_t y ); |
void OSD_Element_TargetDegree( uint8_t x, uint8_t y ); |
void OSD_Element_UpDown( uint8_t x, uint8_t y, int8_t xoffs, int8_t yoffs); |
#endif |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/parameter.c |
---|
0,0 → 1,1449 |
/***************************************************************************** |
* Copyright (C) 2008 Thomas Kaiser, thomas@ft-fanpage.de * |
* Copyright (C) 2009 Peter "woggle" Mack, mac@denich.net * |
* Copyright (C) 2011 Christian "Cebra" Brandtner, brandtner@brandtner.net * |
* Copyright (C) 2011 Harald Bongartz * |
* * |
* This program is free software; you can redistribute it and/or modify * |
* it under the terms of the GNU General Public License as published by * |
* the Free Software Foundation; either version 2 of the License. * |
* * |
* This program is distributed in the hope that it will be useful, * |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
* GNU General Public License for more details. * |
* * |
* You should have received a copy of the GNU General Public License * |
* along with this program; if not, write to the * |
* Free Software Foundation, Inc., * |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
* * |
* * |
* Credits to: * |
* Holger Buss & Ingo Busker from mikrokopter.de for the MK project + SVN * |
* http://www.mikrokopter.de * |
* Gregor "killagreg" Stobrawa for his version of the MK code * |
* Thomas Kaiser "thkais" for the original project. See * |
* http://www.ft-fanpage.de/mikrokopter/ * |
* http://forum.mikrokopter.de/topic-4061-1.html * |
* Claas Anders "CaScAdE" Rathje for providing the font and his C-OSD code * |
* http://www.mylifesucks.de/oss/c-osd/ * |
* Harald Bongartz "HaraldB" for providing his Ideas and Code for usibility* |
*****************************************************************************/ |
#include "cpu.h" |
#include <avr/io.h> |
#include <avr/pgmspace.h> |
#include <util/delay.h> |
#include <string.h> |
#include <stdlib.h> |
#include <stdbool.h> |
#include "lcd/lcd.h" |
#include "timer/timer.h" |
#include "uart/usart.h" |
#include "mk-data-structs.h" |
#include "parameter.h" |
#include "menu.h" |
#include "eeprom/eeprom.h" |
#include "parameter_names.h" |
#include "messages.h" |
#include "menu.h" |
#define TIMEOUT 500 // 5 sec |
uint8_t display_settings_menu (void); |
uint8_t display_param_menu (uint8_t); |
uint8_t load_setting (uint8_t); |
uint8_t write_setting (uint8_t); |
uint8_t display_section_menu(void); |
void edit_param(uint8_t); |
void copy_setting(void); |
mk_param_struct_t *mk_param_struct; |
//uint8_t ii; |
//volatile uint8_t offset = 0; |
//volatile uint8_t dmode = 0; |
//volatile uint8_t target_pos = 1; |
volatile uint8_t offset2 = 0; |
volatile uint8_t pmode = 0; |
volatile uint8_t target_pos2 = 1; |
volatile uint8_t setting = 0; |
uint8_t changes = 0; |
#define OFFSETOF(type, field) ((unsigned int) &(((type *) 0)->field)) |
#define MKOSO(field) (uint8_t)OFFSETOF(mk_param_struct_t, field) |
//-------------------------------------------------------------- |
// Typ == (0 ohne Poti, 1 mit Poti, 2 bitfield, 3 serCh, 4 LEDmask, 5 Angle, 6 Empfaenger), |
// ||| |
// Group, Typ, Min, Max, Struct-Name(Value), Default1, Default2, Default3+4+5, |
// 0 1 2 3 4 5 6 7 |
// | | | | | | | | |
// | | | / | | | / |
// | | | / | | | / |
// | | | / | | | / |
// | | / / | | | / |
// | | / / | | | / |
// | / / / | | / / |
// | / / / | | / / |
// | / / / | | / / |
// | / / / | | / / |
// | / / / | | / / |
// | | / / | | / / |
// | | | | | | / / |
// | | | | | | / / |
// | | | | | | | / |
// | | | | | | | / |
// | | | | | | | | |
// | | | | | | | | |
// 0,0,1,12, MKOSO(Kanalbelegung)+2 , 1,1,1, // gas |
prog_uchar param_config[8*PARAM_COUNT]= |
{ |
// group 0 (kanaele) 1-15 |
0,0,1,12, MKOSO(Kanalbelegung)+2 , 1,1,1, // gas |
0,0,1,12, MKOSO(Kanalbelegung)+3 , 4,4,4, // gier |
0,0,1,12, MKOSO(Kanalbelegung)+0 , 3,3,3, // nick |
0,0,1,12, MKOSO(Kanalbelegung)+1 , 2,2,2, // roll |
0,3,1,25, MKOSO(Kanalbelegung)+4 , 5,5,5, // poti1 |
0,3,1,25, MKOSO(Kanalbelegung)+5 , 6,6,6, // poti2 |
0,3,1,25, MKOSO(Kanalbelegung)+6 , 7,7,7, // poti3 |
0,3,1,25, MKOSO(Kanalbelegung)+7 , 8,8,8, // poti4 |
0,3,1,25, MKOSO(Kanalbelegung)+8 , 9,9,9, // poti5 |
0,3,1,25, MKOSO(Kanalbelegung)+9 , 10,10,10, // poti6 |
0,3,1,25, MKOSO(Kanalbelegung)+10, 11,11,11, // poti7 |
0,3,1,25, MKOSO(Kanalbelegung)+11, 12,12,12, // poti8 |
0,0,0,12, MKOSO(MotorSafetySwitch), 0,0,0, // Motor Sicherungsswitch |
0,2,0,CFG3_MOTOR_SWITCH_MODE , MKOSO(GlobalConfig3), 0,0,0, // kein Start ohne GPS Fix |
0,2,0,CFG_SENSITIVE_RC, MKOSO(ExtraConfig), 0,0,0, // erweiterte signal pruefung |
0,6,0,6, MKOSO(Receiver), 1,1,1, |
#ifdef MKVERSION090b |
0,2,0,CFG3_SPEAK_ALL , MKOSO(GlobalConfig3), 0,0,0, // Telemetry Speak all Events |
#endif |
// group 1 (main) 16-23 |
1,2,0,CFG_HOEHENREGELUNG, MKOSO(GlobalConfig), 0,0,0, // hoehenregler |
1,2,0,CFG_GPS_AKTIV, MKOSO(GlobalConfig), 1,1,1, // gps |
1,2,0,CFG_KOMPASS_AKTIV, MKOSO(GlobalConfig), 1,1,1, // kompass |
1,2,0,CFG_KOMPASS_FIX, MKOSO(GlobalConfig), 0,0,0, // feste ausrichtung |
1,2,0,CFG_SENSITIVE_RC, MKOSO(ExtraConfig), 0,0,0, // erweiterte signal pruefung |
1,2,0,CFG_ACHSENKOPPLUNG_AKTIV, MKOSO(GlobalConfig), 1,1,1, // achsentkopplung |
1,2,0,CFG_DREHRATEN_BEGRENZER, MKOSO(GlobalConfig), 0,0,0, // drehratenbregrenzung |
1,2,0,CFG_HEADING_HOLD, MKOSO(GlobalConfig), 0,0,0, // heading hold |
// group 2 (stick) 24-27 |
2,0,0,20, MKOSO(Stick_P), 10,8,6, |
2,0,0,20, MKOSO(Stick_D), 16,16,10, |
2,1,0,255, MKOSO(StickGier_P), 6,6,4, |
2,1,0,255, MKOSO(ExternalControl), 0,0,0, |
// group3 : looping 28-36 |
3,2,0,CFG_LOOP_OBEN, MKOSO(BitConfig), 0,0,0, // oben |
3,2,0,CFG_LOOP_UNTEN, MKOSO(BitConfig), 0,0,0, // unten |
3,2,0,CFG_LOOP_LINKS, MKOSO(BitConfig), 0,0,0, // links |
3,2,0,CFG_LOOP_RECHTS, MKOSO(BitConfig), 0,0,0, // rechts |
3,1,0,255, MKOSO(LoopGasLimit), 50,50,50, |
3,0,0,247, MKOSO(LoopThreshold), 90,90,90, |
3,0,0,247, MKOSO(LoopHysterese), 50,50,50, |
3,0,0,247, MKOSO(WinkelUmschlagNick), 78,78,78, |
3,0,0,247, MKOSO(WinkelUmschlagRoll), 78,78,78, |
// group 4 (hoehe) 37-50 |
4,2,0,CFG_HOEHENREGELUNG, MKOSO(GlobalConfig), 0,0,0, // hoehenrelger |
4,2,0,CFG2_HEIGHT_LIMIT, MKOSO(ExtraConfig), 0,0,0, // vario oder hoeenbergenzung |
4,2,0,CFG_HOEHEN_SCHALTER, MKOSO(GlobalConfig), 1,1,1, // hoehenschalter |
4,2,0,CFG2_VARIO_BEEP, MKOSO(ExtraConfig), 1,1,1, // variobeep |
4,1,0,255, MKOSO(MaxHoehe), 255,255,255, |
4,0,0,247, MKOSO(Hoehe_MinGas), 30,30,30, |
4,1,0,255, MKOSO(Hoehe_P), 15,15,15, |
4,1,0,255, MKOSO(Luftdruck_D), 30,30,30, |
4,1,0,255, MKOSO(Hoehe_ACC_Wirkung), 0,0,0, |
4,1,0,255, MKOSO(MaxAltitude), 150,150,150, |
4,0,0,247, MKOSO(Hoehe_Verstaerkung), 15,15,15, |
4,0,0,247, MKOSO(Hoehe_HoverBand), 8,8,8, |
4,1,0,255, MKOSO(Hoehe_GPS_Z), 64,64,64, |
4,0,0,160, MKOSO(Hoehe_StickNeutralPoint), 0,0,0, |
// group 5 : kamera 51-68 |
5,1,0,255, MKOSO(ServoNickControl), 128,128,128, |
5,0,0,247, MKOSO(ServoNickComp), 50,50,50, |
5,2,0,SVNick, MKOSO(ServoCompInvert), 0,0,0, // nick |
#ifdef MKVERSION090b |
5,2,0,SVRelMov, MKOSO(ServoCompInvert), 0,0,0, // nick Servo relative |
#endif |
5,0,0,247, MKOSO(ServoNickMin), 15,15,15, |
5,0,0,247, MKOSO(ServoNickMax), 230,230,230, |
5,0,0,25, MKOSO(ServoFilterNick), 0,0,0, //FC0.87 |
5,1,0,255, MKOSO(ServoRollControl), 128,128,128, |
5,0,0,247, MKOSO(ServoRollComp), 85,85,85, |
5,2,0,SVRoll, MKOSO(ServoCompInvert), 0,0,0, // roll |
5,0,0,247, MKOSO(ServoRollMin), 70,70,70, |
5,0,0,247, MKOSO(ServoRollMax), 220,220,220, |
5,0,0,25, MKOSO(ServoFilterRoll), 0,0,0, //FC0.87 |
5,0,2,8, MKOSO(ServoNickRefresh), 4,4,4, |
5,0,0,247, MKOSO(ServoManualControlSpeed), 60,60,60, |
5,5,0,247, MKOSO(CamOrientation), 0,0,0, |
5,1,0,255, MKOSO(Servo3), 125,125,125, |
5,1,0,255, MKOSO(Servo4), 125,125,125, |
5,1,0,255, MKOSO(Servo5), 125,125,125, |
// group 6 : navictrl 67-85 |
6,2,0,0x20, MKOSO(GlobalConfig), 1,1,1, // gps |
6,1,0,255, MKOSO(NaviGpsModeControl), 254,254,254, |
6,1,0,255, MKOSO(NaviGpsGain), 100,100,100, |
6,0,0,247, MKOSO(NaviStickThreshold), 8,8,8, |
6,0,0,247, MKOSO(NaviGpsMinSat), 6,6,6, |
6,1,0,255, MKOSO(NaviGpsP), 90,90,90, |
6,1,0,255, MKOSO(NaviGpsI), 90,90,90, |
6,1,0,255, MKOSO(NaviGpsD), 90,90,90, |
6,1,0,255, MKOSO(NaviGpsPLimit), 75,75,75, |
6,1,0,255, MKOSO(NaviGpsILimit), 85,85,85, |
6,1,0,255, MKOSO(NaviGpsDLimit), 75,75,75, |
6,1,0,255, MKOSO(NaviGpsACC), 0,0,0, |
6,1,0,255, MKOSO(NaviWindCorrection), 90,90,90, |
6,1,0,255, MKOSO(NaviAccCompensation), 42,42,42, |
6,1,0,255, MKOSO(NaviOperatingRadius), 245,245,245, |
6,1,0,255, MKOSO(NaviAngleLimitation), 140,140,140, |
6,0,0,247, MKOSO(NaviPH_LoginTime), 5,5,5, |
6,2,0,CFG_GPS_AID, MKOSO(ExtraConfig), 0,0,0, // FC0.87dynamic ph |
6,2,0,CFG3_DPH_MAX_RADIUS , MKOSO(GlobalConfig3), 0,0,0, // FC0.87 |
6,0,0,247, MKOSO(ComingHomeAltitude), 0,0,0, |
// group 7 : ausgaenge 86-95 |
7,4,0,255, MKOSO(J16Bitmask), 95,95,95, |
7,1,0,255, MKOSO(J16Timing), 20,20,20, |
7,2,0,CFG_MOTOR_OFF_LED1, MKOSO(BitConfig), 0,0,0, // Motor_Off_Led1 |
7,2,0,CFG_MOTOR_BLINK1, MKOSO(BitConfig), 1,1,1, // Motor_Blink1 |
#ifdef MKVERSION090b |
7,2,0,CFG3_USE_NC_FOR_OUT1, MKOSO(GlobalConfig3), 0,0,0, // combine with WP-WEvent |
7,1,0,255, MKOSO(NaviOut1Parameter), 0,0,0, |
#endif |
7,4,0,255, MKOSO(J17Bitmask), 243,243,243, |
7,1,0,255, MKOSO(J17Timing), 20,20,20, |
7,2,0,CFG_MOTOR_OFF_LED2, MKOSO(BitConfig), 0,0,0, // Motor_Off_Led2 |
7,2,0,CFG_MOTOR_BLINK2, MKOSO(BitConfig), 1,1,1, // Motor_Blink2 |
7,4,0,255, MKOSO(WARN_J16_Bitmask), 170,170,170, |
7,4,0,255, MKOSO(WARN_J17_Bitmask), 170,170,170, |
// group 8 : versch. 96-107 |
8,0,0,247, MKOSO(Gas_Min), 8,8,8, |
8,0,0,247, MKOSO(Gas_Max), 230,230,230, |
8,1,0,255, MKOSO(KompassWirkung), 64,64,64, |
8,1,0,255, MKOSO(CareFreeModeControl), 0,0,0, // Carefree |
8,2,0,CFG_LEARNABLE_CAREFREE, MKOSO(ExtraConfig), 0,0,0, // teachable Carefree |
8,0,0,247, MKOSO(UnterspannungsWarnung), 33,33,33, |
8,2,0,CFG_3_3V_REFERENCE, MKOSO(ExtraConfig), 0,0,0, // Voltage referenz |
8,0,0,247, MKOSO(NotGasZeit), 90,90,90, |
8,0,0,247, MKOSO(NotGas), 45,45,45, |
8,0,0,247, MKOSO(FailSafeTime), 0,0,0, // Failsavetime |
8,0,0,12, MKOSO(FailsafeChannel), 0,0,0, // FC0.87 Failsave Channel |
8,2,0,CFG_NO_RCOFF_BEEPING, MKOSO(ExtraConfig), 0,0,0, // Kein Summer ohne Sender beim Start |
8,2,0,CFG3_VARIO_FAILSAFE, MKOSO(GlobalConfig3), 0,0,0, //use vario Control for failsafe altitude |
8,2,0,CFG_IGNORE_MAG_ERR_AT_STARTUP, MKOSO(ExtraConfig), 0,0,0, // Ignore Compass Error |
8,2,0,CFG3_NO_SDCARD_NO_START , MKOSO(GlobalConfig3), 0,0,0, // nicht starten ohne SD Karte |
8,2,0,CFG3_NO_GPSFIX_NO_START , MKOSO(GlobalConfig3), 0,0,0, // kein Start ohne GPS Fix |
// group 9 : gyro 108-120 |
9,1,0,255, MKOSO(Gyro_P), 90,100,100, |
9,1,0,255, MKOSO(Gyro_I), 120,120,120, |
9,1,0,255, MKOSO(Gyro_D), 10,10,10, |
9,1,0,255, MKOSO(Gyro_Gier_P), 90,100,100, |
9,1,0,255, MKOSO(Gyro_Gier_I), 120,120,120, |
9,1,0,255, MKOSO(DynamicStability), 70,70,70, |
9,2,0,CFG_DREHRATEN_BEGRENZER, MKOSO(GlobalConfig), 0,0,0, // drehratenbregrenzung |
9,0,0,247, MKOSO(GyroAccFaktor), 27,27,27, |
9,0,0,247, MKOSO(GyroAccAbgleich), 32,32,32, |
9,1,0,255, MKOSO(I_Faktor), 16,16,16, |
9,0,0,247, MKOSO(Driftkomp), 0,0,0, |
9,0,0,16, MKOSO(Gyro_Stability), 6,6,6, |
9,0,0,247, MKOSO(MotorSmooth), 0,0,0, |
// group 10: benutzer 121-128 |
10,1,0,255, MKOSO(UserParam1), 0,0,0, |
10,1,0,255, MKOSO(UserParam2), 0,0,0, |
10,1,0,255, MKOSO(UserParam3), 0,0,0, |
10,1,0,255, MKOSO(UserParam4), 0,0,0, |
10,1,0,255, MKOSO(UserParam5), 0,0,0, |
10,1,0,255, MKOSO(UserParam6), 0,0,0, |
10,1,0,255, MKOSO(UserParam7), 0,0,0, |
10,1,0,255, MKOSO(UserParam8), 0,0,0, |
// group 11: achskoppl 129-132 |
11,2,0,CFG_ACHSENKOPPLUNG_AKTIV, MKOSO(GlobalConfig), 0,0,0, // achsentkopplung |
11,1,0,255, MKOSO(AchsKopplung1), 90,90,90, |
11,1,0,255, MKOSO(AchsKopplung2), 55,55,55, |
11,1,0,255, MKOSO(CouplingYawCorrection), 70,70,70, |
// group 12: mixer 133 |
12,5,0,23,MKOSO(OrientationAngle), 0,0,0, |
// group 13 (easy-setup) 134-144 |
13,2,0,0x01, MKOSO(GlobalConfig), 0,0,0, // hoehenrelger |
13,1,0,255, MKOSO(MaxHoehe), 255,255,255, |
13,0,0,160, MKOSO(Hoehe_StickNeutralPoint), 0,0,0, |
13,2,0,0x20, MKOSO(GlobalConfig), 1,1,1, // gps |
13,1,0,255, MKOSO(NaviGpsModeControl), 254,254,254, |
13,2,0,0x20, MKOSO(ExtraConfig), 0,0,0, // dynamic ph |
13,0,0,247, MKOSO(ComingHomeAltitude), 0,0,0, |
13,1,0,255, MKOSO(CareFreeModeControl), 0,0,0, // Carefree |
13,2,0,0x40, MKOSO(ExtraConfig), 0,0,0, // teachable Carefree |
13,0,0,12, MKOSO(MotorSafetySwitch), 0,0,0, // Motor Sicherungsswitch |
13,5,0,23, MKOSO(OrientationAngle), 0,0,0, |
}; |
//-------------------------------------------------------------- |
#define ITEMS_RX 9 |
prog_char param_items_rx[ITEMS_RX][17]= // zeilen,zeichen+1 |
{ |
"PPM ", |
"Spektrum ", |
"Spektrum HiRes ", |
"Spektrum LoRes ", |
"Jeti ", |
"ACT DSL ", |
"HOTT ", |
"Futuba SBUS ", |
"User ", |
}; |
//-------------------------------------------------------------- |
void edit_parameter(void) |
{ |
SwitchToFC(); |
// uint8_t setting; |
setting = display_settings_menu(); |
if(setting == 255) |
return; |
if(setting == 6) |
{ |
copy_setting(); |
return; |
} |
lcd_cls(); |
// lcd_printp_at (0, 0, PSTR(" Setting x "), 2); |
lcd_puts_at(0, 0, strGet(PARA_SETTINGS), 2); |
lcd_putc (15, 0, (setting + 48), 2); // ASCII ab 48 (hex 30) beginnt 0 - 9 |
// lcd_printp_at (3, 2, PSTR("ändern"), 0); |
// lcd_printp_at (3, 3, PSTR("aktivieren"), 0); |
lcd_puts_at(3, 2, strGet(PARA_CHANGE), 0); |
lcd_puts_at(3, 3, strGet(PARA_AKTIVI), 0); |
// lcd_printp_at (0, 7, PSTR(KEY_LINE_1), 0); |
lcd_puts_at(0, 7, strGet(KEYLINE1), 0); |
uint8_t val = menu_choose2 (2, 3, 2, 0, 0); |
if (val == 255) |
return; |
if(val == 3) |
{ |
load_setting(setting); |
uint8_t setting_written = write_setting(setting); |
if(setting_written == setting) |
{ |
lcd_cls_line (0,2,21); |
lcd_cls_line (0,3,21); |
// lcd_printp_at (11, 0, PSTR("aktiviert"), 0); |
lcd_puts_at(5, 2, strGet(PARA_AKTIV), 0); |
} |
else |
{ |
lcd_cls_line (0,2,21); |
lcd_cls_line (0,3,21); |
// lcd_printp_at (0, 4, PSTR("Error"), 0); |
lcd_puts_at(0, 4, strGet(FEHLER), 0); |
} |
_delay_ms(2000); |
return; |
} |
if(setting == 255) |
return; |
uint8_t setting_loaded = load_setting(setting); |
if(setting_loaded == 255) |
return; |
offset = 0; |
dmode = 0; |
target_pos = 1; |
changes =0; |
uint8_t group =0; |
do |
{ |
group = display_section_menu(); |
if(group != 255) |
{ |
offset2 = 0; |
pmode = 0; |
target_pos2 = 1; |
uint8_t param; |
do |
{ |
param = display_param_menu(group); |
if(param != 255) |
{ |
edit_param(param); |
} |
} |
while(param != 255); |
} |
} |
while(group != 255); |
if(changes == 1) |
{ |
lcd_cls(); |
// lcd_printp_at (0, 0, PSTR(" Setting x speichern?"), 2); |
lcd_puts_at(0, 0, strGet(PARA_SAVESETT), 2); |
lcd_putc (9, 0, (setting + 48), 2); // ASCII ab 48 (hex 30) beginnt 0 - 9 |
write_ndigit_number_u(9, 0, setting, 1, 0,0); |
// lcd_printp_at (3, 2, PSTR("Ja"), 0); |
// lcd_printp_at (3, 3, PSTR("Nein"), 0); |
lcd_puts_at(3, 2, strGet(YES), 0); |
lcd_puts_at(3, 3, strGet(NOO), 0); |
// lcd_printp_at (0, 7, PSTR(KEY_LINE_1), 0); |
lcd_puts_at(0, 7, strGet(KEYLINE1), 0); |
uint8_t val = menu_choose2 (2, 3, 2, 0, 0); |
if(val == 2) |
{ |
uint8_t setting_written = write_setting(setting); |
if(setting_written == setting) |
{ |
// lcd_printp_at (3, 4, PSTR("Gespeichert und"), 0); |
lcd_puts_at(3, 4, strGet(PARA_SETTSAVED), 0); |
// lcd_printp_at (3, 5, PSTR("Aktiviert"), 0); |
lcd_puts_at(3, 5, strGet(PARA_AKTIV), 0); |
} |
else |
{ |
// lcd_printp_at (0, 4, PSTR("Error"), 0); |
lcd_puts_at(0, 4, strGet(FEHLER), 0); |
} |
timer = 100; |
while (timer > 0); |
} |
} |
} |
//-------------------------------------------------------------- |
void copy_setting(void) |
{ |
uint8_t fromsetting = 3; |
uint8_t tosetting = 5; |
lcd_cls(); |
// lcd_printp_at (0, 1, PSTR("Kopiere Setting"), 0); |
// lcd_printp_at (0, 3, PSTR("von x nach y"), 0); |
// lcd_printp_at (0, 7, PSTR("von nach Ende OK"), 0); |
lcd_puts_at(0, 1, strGet(PARA_COPY), 0); |
lcd_puts_at(0, 3, strGet(PARA_FROMTO), 0); |
lcd_puts_at(0, 7, strGet(PARA_ENDE), 0); |
do |
{ |
write_ndigit_number_u(5,3,fromsetting, 1,0,0); |
write_ndigit_number_u(14,3,tosetting, 1,0,0); |
if(get_key_press (1 << KEY_MINUS)) |
{ |
fromsetting++; |
if(fromsetting == 6) fromsetting = 1; |
} |
if(get_key_press (1 << KEY_PLUS)) |
{ |
tosetting++; |
if(tosetting == 6) tosetting = 1; |
} |
if(get_key_press (1 << KEY_ENTER)) |
{ |
lcd_printp_at (0, 5, PSTR("Wirklich Kopieren?"), 0); |
lcd_puts_at(0, 5, strGet(PARA_COPYQ), 0); |
// lcd_printp_at (0, 7, PSTR(" Ende OK"), 0); |
lcd_puts_at(12, 7, strGet(KEYLINE4), 0); |
do |
{ |
if(get_key_press (1 << KEY_ENTER)) |
{ |
uint8_t loaded = load_setting(fromsetting); |
if(loaded == fromsetting) |
{ |
uint8_t written = write_setting(tosetting); |
if(written == tosetting) |
{ |
lcd_printp_at (0, 5, PSTR("Kopiert und Aktiviert"), 0); |
lcd_puts_at(0, 5, strGet(PARA_COPYACTIV), 0); |
} |
else |
{ |
// lcd_printp_at (0, 5, PSTR("Fehler"), 0); |
lcd_puts_at(0, 5, strGet(FEHLER), 0); |
lcd_cls_line (6, 5, 14); |
} |
} |
else |
{ |
// lcd_printp_at (0, 5, PSTR("Fehler"), 0); |
lcd_puts_at(0, 5, strGet(FEHLER), 0); |
lcd_cls_line (6, 5, 14); |
} |
timer = 100; |
while (timer > 0); |
return; |
} |
} |
while (!get_key_press (1 << KEY_ESC)); |
get_key_press(KEY_ALL); |
lcd_cls_line (0, 5, 21); |
// lcd_printp_at (0, 7, PSTR("von nach Ende OK"), 0); |
lcd_puts_at(0, 7, strGet(PARA_ENDE), 0); |
} |
} |
while (!get_key_press (1 << KEY_ESC)); |
get_key_press(KEY_ALL); |
} |
//-------------------------------------------------------------- |
void edit_param(uint8_t param) |
{ |
lcd_cls(); |
uint8_t type = pgm_read_byte(param_config+(8*param)+1); |
// lcd_printp_at (0, 0, PSTR(" Ändere Setting: "), 2); |
lcd_puts_at(0, 0, strGet(PARA_CHANGESETT), 2); |
// lcd_printp_at (0, 7, PSTR(KEY_LINE_1), 0); |
lcd_puts_at(0, 7, strGet(KEYLINE1), 0); |
if(type != 6) |
lcd_printp_at(0,2,param_names[param][Config.DisplayLanguage], 0); |
//------------------------------------------------------- |
if(type == 0) // ohne poti |
{ |
lcd_printp_at (4, 4, PSTR("( - ) (d: )"), 0); |
lcd_printp_at (12, 6, PSTR("Std."), 0); |
// lcd_printp_at (0, 7, PSTR(KEY_LINE_2), 0); |
lcd_puts_at(0, 7, strGet(KEYLINE2), 0); |
uint8_t min = pgm_read_byte(param_config+(8*param)+2); |
uint8_t max = pgm_read_byte(param_config+(8*param)+3); |
uint8_t value = *(((uint8_t*)mk_param_struct) + pgm_read_byte(param_config+(8*param)+4)); |
uint8_t defaultvalue = pgm_read_byte(param_config+(8*param)+4 + setting ); // 5 - 7 |
uint8_t newvalue = value; |
write_ndigit_number_u (5, 4, min, 3, 0,0); |
write_ndigit_number_u (9, 4, max, 3, 0,0); |
write_ndigit_number_u (17, 4, defaultvalue, 3, 0,0); |
do |
{ |
write_ndigit_number_u (0, 4, newvalue, 3, 0,0); |
lcd_frect ((8*0), (8*5), (newvalue * (16*8) / max), 6, 1); |
if(max >= 50) |
{ |
if(get_key_press (1 << KEY_PLUS) | get_key_long_rpt_sp ((1 << KEY_PLUS), 3)) |
{ |
if((newvalue+1) <= max) |
newvalue++; |
} |
if(get_key_press (1 << KEY_MINUS) | get_key_long_rpt_sp ((1 << KEY_MINUS), 3)) |
{ |
if((newvalue-1) >= min) |
{ |
lcd_frect (((newvalue - 1) * (16*8) / max), (8*5), (16*8), 6, 0); |
// lcd_frect ((newvalue * (16*8) / max), (8*5), ((16*8) / max), 6, 0); |
newvalue--; |
} |
} |
} |
else |
{ |
if(get_key_press (1 << KEY_PLUS) | get_key_long_rpt_sp ((1 << KEY_PLUS), 2)) |
{ |
if((newvalue+1) <= max) |
newvalue++; |
} |
if(get_key_press (1 << KEY_MINUS) | get_key_long_rpt_sp ((1 << KEY_MINUS), 2)) |
{ |
if((newvalue-1) >= min) |
{ |
lcd_frect (((newvalue - 1) * (16*8) / max), (8*5), (16*8), 6, 0); |
// lcd_frect ((newvalue * (16*8) / max), (8*5), ((16*8) / max), 6, 0); |
newvalue--; |
} |
} |
} |
if(get_key_long (1 << KEY_ESC)) |
{ |
lcd_frect ((8*0), (8*5), (16*8), 6, 0); |
newvalue = defaultvalue; |
} |
if(get_key_short (1 << KEY_ENTER)) |
{ |
if(newvalue != value) |
{ |
*(((uint8_t*)mk_param_struct) + pgm_read_byte(param_config+(8*param)+4)) = newvalue; |
changes=1; |
} |
break; |
} |
} |
while (!get_key_short (1 << KEY_ESC)); |
get_key_press(KEY_ALL); |
} |
//------------------------------------------------------- |
if(type == 1) // mit poti |
{ |
lcd_printp_at (4, 4, PSTR("(0-247-P8)(d:Po )"), 0); |
lcd_printp_at (12, 6, PSTR("Std."), 0); |
// lcd_printp_at (0, 7, PSTR(KEY_LINE_2), 0); |
lcd_puts_at(0, 7, strGet(KEYLINE2), 0); |
uint8_t min = pgm_read_byte(param_config+(8*param)+2); |
uint8_t max = pgm_read_byte(param_config+(8*param)+3); |
uint8_t value = *(((uint8_t*)mk_param_struct) + pgm_read_byte(param_config+(8*param)+4)); |
uint8_t defaultvalue = pgm_read_byte(param_config+(8*param)+4 + setting ); // 5 - 7 |
uint8_t newvalue = value; |
uint8_t mode = 0; |
if(defaultvalue > 247) |
{ |
lcd_printp_at (17, 4, PSTR("Po )"), 0); |
write_ndigit_number_u (19, 4, 256-defaultvalue, 1, 0,0); |
} |
else |
write_ndigit_number_u (17, 4, defaultvalue, 3, 0,0); |
if(value > 247) |
mode = 1; |
do |
{ |
if(newvalue > 247) |
mode = 1; |
else |
mode = 0; |
if(mode == 0) |
{ |
write_ndigit_number_u (0, 4, newvalue, 3, 0,0); |
lcd_frect ((8*0), (8*5), (newvalue * (16*8) / max), 6, 1); |
if(get_key_press (1 << KEY_PLUS) | get_key_long_rpt_sp ((1 << KEY_PLUS), 3)) |
{ |
if((newvalue+1) <= max) |
newvalue++; |
if(newvalue > 247) |
{ |
lcd_frect ((8*0), (8*5), (16*8), 6, 0); |
newvalue = 255; |
} |
} |
if(get_key_press (1 << KEY_MINUS) | get_key_long_rpt_sp ((1 << KEY_MINUS), 3)) |
{ |
if((newvalue-1)>=min) |
{ |
lcd_frect (((newvalue - 1) * (16*8) / max), (8*5), (16*8), 6, 0); |
// lcd_frect ((newvalue * (16*8) / max), (8*5), ((16*8) / max), 6, 0); |
newvalue--; |
} |
} |
} |
else |
{ |
lcd_printp_at (0, 4, PSTR("Po"), 0); |
write_ndigit_number_u (2, 4, 256 - newvalue, 1, 0,0); |
lcd_frect ((8*0), (8*5), ((256 - newvalue) * (16*8) / 8), 6, 1); |
if(get_key_press (1 << KEY_PLUS) | get_key_long_rpt_sp ((1 << KEY_PLUS), 1)) |
{ |
if(newvalue - 1 > 247) |
{ |
newvalue--; |
} |
} |
if(get_key_press (1 << KEY_MINUS) | get_key_long_rpt_sp ((1 << KEY_MINUS), 1)) |
{ |
lcd_frect (((255 - newvalue) * (16*8) / 8), (8*5), (16*8), 6, 0); |
// lcd_frect (((255 - newvalue) * (16*8) / 8), (8*5), ((16*8) / 8), 6, 0); |
newvalue++; |
if(newvalue == 0) |
{ |
lcd_frect ((8*0), (8*5), (16*8), 6, 0); // balken löschen |
newvalue = 247; |
} |
} |
} |
if(get_key_long (1 << KEY_ESC)) |
{ |
lcd_frect ((8*0), (8*5), (16*8), 6, 0); |
newvalue = defaultvalue; |
} |
if(get_key_short (1 << KEY_ENTER)) |
{ |
if(newvalue != value) |
{ |
*(((uint8_t*)mk_param_struct) + pgm_read_byte(param_config+(8*param)+4)) = newvalue; |
changes=1; |
} |
break; |
} |
} |
while (!get_key_short (1 << KEY_ESC)); |
get_key_press(KEY_ALL); |
} |
//------------------------------------------------------- |
if(type == 2) // ja/nein |
{ |
// lcd_printp_at (3, 4, PSTR("Ja"), 0); |
// lcd_printp_at (3, 5, PSTR("Nein"), 0); |
lcd_puts_at(3, 4, strGet(YES), 0); |
lcd_puts_at(3, 5, strGet(NOO), 0); |
// lcd_printp_at (0, 7, PSTR(KEY_LINE_1), 0); |
lcd_puts_at(0, 7, strGet(KEYLINE1), 0); |
uint8_t bitmap = pgm_read_byte(param_config+(8*param)+3); |
uint8_t value = *(((uint8_t*)mk_param_struct) + pgm_read_byte(param_config+(8*param)+4)); |
uint8_t defaultvalue = pgm_read_byte(param_config+(8*param)+4 + setting ); // 5 - 7 |
uint8_t newvalue = value; |
if(defaultvalue == 1) |
lcd_printp_at (8, 4, PSTR("*"), 0); |
if(defaultvalue == 0) |
lcd_printp_at (8, 5, PSTR("*"), 0); |
do |
{ |
if(newvalue & bitmap) |
{ |
lcd_printp_at (1, 4, PSTR("\x1d"), 0); |
lcd_printp_at (1, 5, PSTR(" "), 0); |
} |
else |
{ |
lcd_printp_at (1, 4, PSTR(" "), 0); |
lcd_printp_at (1, 5, PSTR("\x1d"), 0); |
} |
if((get_key_press (1 << KEY_MINUS)) && (!(newvalue & bitmap))) |
newvalue ^= bitmap; |
if((get_key_press (1 << KEY_PLUS)) && (newvalue & bitmap)) |
newvalue ^= bitmap; |
if(get_key_press (1 << KEY_ENTER)) |
{ |
if(newvalue != value) |
{ |
*(((uint8_t*)mk_param_struct) + pgm_read_byte(param_config+(8*param)+4)) = newvalue; |
changes=1; |
} |
break; |
} |
} |
while (!get_key_short (1 << KEY_ESC)); |
get_key_press(KEY_ALL); |
} |
//------------------------------------------------------- |
if(type == 3) // serCH |
{ |
lcd_printp_at (4, 4, PSTR("(1-S12/W) (d: )"), 0); |
lcd_printp_at (12, 6, PSTR("Std."), 0); |
// lcd_printp_at (0, 7, PSTR(KEY_LINE_2), 0); |
lcd_puts_at(0, 7, strGet(KEYLINE2), 0); |
uint8_t min = pgm_read_byte(param_config+(8*param)+2); |
uint8_t max = pgm_read_byte(param_config+(8*param)+3); |
uint8_t value = *(((uint8_t*)mk_param_struct) + pgm_read_byte(param_config+(8*param)+4)); |
uint8_t defaultvalue = pgm_read_byte(param_config+(8*param)+4 + setting ); // 5 - 7 |
uint8_t newvalue = value; |
write_ndigit_number_u (17, 4, defaultvalue, 3, 0,0); |
do |
{ |
if (newvalue<=(max-13)) |
write_ndigit_number_u (0, 4, newvalue, 3, 0,0); |
else |
{ |
if (newvalue<=(max-1)) |
{ |
lcd_printp_at (0, 4, PSTR("S"), 0); |
write_ndigit_number_u (1, 4, (newvalue-12), 2, 0,0); |
} |
} |
if (newvalue==max) |
lcd_printp_at (0, 4, PSTR("WPE"), 0); |
lcd_frect ((8*0), (8*5), (newvalue * (16*8)) / max, 6, 1); |
if(get_key_press (1 << KEY_PLUS) | get_key_long_rpt_sp ((1 << KEY_PLUS), 2)) |
{ |
if((newvalue+1) <= max) |
newvalue++; |
} |
if(get_key_press (1 << KEY_MINUS) | get_key_long_rpt_sp ((1 << KEY_MINUS), 2)) |
{ |
if((newvalue-1)>=min) |
{ |
lcd_frect (((newvalue - 1) * (16*8) / max), (8*5), (16*8), 6, 0); |
newvalue--; |
} |
} |
if(get_key_long (1 << KEY_ESC)) |
{ |
lcd_frect ((8*0), (8*5), (16*8), 6, 0); |
newvalue = defaultvalue; |
} |
if(get_key_short (1 << KEY_ENTER)) |
{ |
if(newvalue != value) |
{ |
*(((uint8_t*)mk_param_struct) + pgm_read_byte(param_config+(8*param)+4)) = newvalue; |
changes=1; |
} |
break; |
} |
} |
while (!get_key_short (1 << KEY_ESC)); |
get_key_press(KEY_ALL); |
} |
//------------------------------------------------------- |
if(type == 4) // led bitfeld |
{ |
// TODO: Übersetzung |
lcd_printp_at (0, 7, PSTR(" \x19 0\x11I Ende OK"), 0); |
if (param == 93 || param == 94) |
// lcd_printp_at (5, 6, PSTR("aktiv"), 0); |
lcd_puts_at(5, 6, strGet(AKTIV), 0); |
uint8_t value = *(((uint8_t*)mk_param_struct) + pgm_read_byte(param_config+(8*param)+4)); |
uint8_t newvalue = value; |
uint8_t pos = 0; |
do |
{ |
for(ii = 0; ii < 8; ii++) |
{ |
if(newvalue & (1 << ii)) |
lcd_printp_at (8-ii, 4,PSTR("1"),0); |
else |
lcd_printp_at (8-ii, 4,PSTR("0"),0); |
} |
lcd_printp_at (pos+1, 5,PSTR("\x12"),0); |
if(get_key_press (1 << KEY_MINUS)) |
{ |
lcd_printp_at (pos+1, 5,PSTR(" "),0); |
pos++; |
if(pos == 8) |
pos = 0; |
} |
if (param == 93 || param == 94) |
{ |
if(get_key_long (1 << KEY_PLUS)) |
{ |
if (newvalue != 0) |
newvalue = 0; |
else |
newvalue = 170; |
} |
} |
if(get_key_short (1 << KEY_PLUS)) |
newvalue ^= (1<<(7-pos)); |
if(get_key_short (1 << KEY_ENTER)) |
{ |
if(newvalue != value) |
{ |
*(((uint8_t*)mk_param_struct) + pgm_read_byte(param_config+(8*param)+4)) = newvalue; |
changes = 1; |
} |
break; |
} |
} |
while (!get_key_short (1 << KEY_ESC)); |
get_key_press(KEY_ALL); |
} |
//------------------------------------------------------- |
if(type == 5) // Angle |
{ |
// lcd_printp_at (0, 7, PSTR(KEY_LINE_2), 0); |
lcd_puts_at(0, 7, strGet(KEYLINE2), 0); |
uint8_t value = *(((uint8_t*)mk_param_struct) + pgm_read_byte(param_config+(8*param)+4)); |
lcd_ecircle(102, 35, 16, 1); |
uint8_t newvalue = value; |
uint8_t oldvalue = newvalue; |
do |
{ |
if(oldvalue != newvalue) lcd_ecirc_line (102, 35, 15, oldvalue*15, 0); |
oldvalue = newvalue; |
lcd_ecirc_line (102, 35, 15, newvalue*15, 1); |
if(get_key_press (1 << KEY_PLUS) | get_key_long_rpt_sp ((1 << KEY_PLUS), 1)) |
{ |
newvalue++; |
if(newvalue == 24) |
newvalue = 0; |
} |
if(get_key_press (1 << KEY_MINUS) | get_key_long_rpt_sp ((1 << KEY_MINUS), 1)) |
{ |
if(newvalue == 0) |
newvalue = 24; |
newvalue--; |
} |
if(get_key_short (1 << KEY_ENTER)) |
{ |
if(newvalue != value) |
{ |
*(((uint8_t*)mk_param_struct) + pgm_read_byte(param_config+(8*param)+4)) = newvalue; |
changes=1; |
} |
break; |
} |
} |
while (!get_key_short (1 << KEY_ESC)); |
get_key_press(KEY_ALL); |
} |
//------------------------------------------------------- |
if(type == 6) // receiver |
{ |
uint8_t value = *(((uint8_t*)mk_param_struct) + pgm_read_byte(param_config+(8*param)+4)); |
uint8_t newvalue = value + 1; |
uint8_t val =0; |
uint8_t ii = 0; |
uint8_t offset = 0; |
uint8_t dmode = 0; |
uint8_t target_pos = 1; |
uint8_t size = ITEMS_RX; |
// lcd_printp_at (0, 7, PSTR(KEY_LINE_1), 0); |
lcd_puts_at(0, 7, strGet(KEYLINE1), 0); |
while(1) |
{ |
ii = 0; |
if(offset > 0) |
lcd_printp_at(1,1, PSTR("\x12"), 0); |
for(ii = 0;ii < 6 ; ii++) |
{ |
if((ii+offset) < size) |
lcd_printp_at(3,ii+1,param_items_rx[ii+offset], 0); |
if((ii == 5)&&(ii+offset < (size-1))) |
lcd_printp_at(1,6, PSTR("\x13"), 0); |
} |
if(dmode == 0) |
{ |
if(offset == 0) |
{ |
if(size > 6) |
val = menu_choose3 (1, 5, target_pos,0,1); //menu_choose3 (min, max, start, return_at_start, return_at_end) |
else |
val = menu_choose3 (1, size, target_pos,0,0); |
} |
else |
val = menu_choose3 (2, 5, target_pos,1,1); |
} |
if(dmode == 1) |
{ |
if(offset+7 > size) |
val = menu_choose3 (2, 6, target_pos,1,0); |
else |
val = menu_choose3 (2, 5, target_pos,1,1); |
} |
if(val == 254) // überlauf unten |
{ |
offset++; |
dmode = 1; |
target_pos = 5; |
} |
else if(val == 253) // überlauf oben |
{ |
offset--; |
dmode = 0; |
target_pos = 2; |
} |
else if(val == 252) // ESC |
return; |
else if(val <= size) |
{ |
newvalue = val + offset - 1; |
*(((uint8_t*)mk_param_struct) + pgm_read_byte(param_config+(8*param)+4)) = newvalue; |
changes=1; |
return; |
} |
} |
} |
} |
//-------------------------------------------------------------- |
uint8_t display_param_menu(uint8_t group) |
{ |
uint8_t items[20]; |
uint8_t size=0; |
for(ii = 0;ii < PARAM_COUNT; ii++) |
{ |
if(pgm_read_byte(param_config+(8*ii)) == (group-1)) |
{ |
items[size] = ii; |
size++; |
} |
} |
uint8_t val =0 ; |
while(1) |
{ |
lcd_cls (); |
// lcd_printp_at (0, 0, PSTR(" Wähle Parameter: "), 2); |
lcd_puts_at(0, 0, strGet(PARA_SELECT), 2); |
// lcd_printp_at (0, 7, PSTR(KEY_LINE_1), 0); |
lcd_puts_at(0, 7, strGet(KEYLINE1), 0); |
ii = 0; |
if(offset2 > 0) |
lcd_printp_at(1,1, PSTR("\x12"), 0); |
for(ii = 0;ii < 6 ; ii++) |
{ |
if((ii+offset2) < size) |
{ |
lcd_printp_at(3,ii+1,param_names[items[ii+offset2]][Config.DisplayLanguage], 0); |
// this reads the the offset in the struct from the pgm configuration table and then reads the value from the struct |
uint8_t type = pgm_read_byte(param_config+(8*items[ii+offset2])+1); |
if(type == 0) |
{ |
write_ndigit_number_u (18, ii+1, *(((uint8_t*)mk_param_struct) + pgm_read_byte(param_config+(8*items[ii+offset2])+4)), 3, 0,0); |
if (group == 9) // % Anzeige für Notgas wenn Variohöhe für Notgas verwendet wird |
{ |
if (ii+offset2 == 8) |
{ |
uint8_t value = *(((uint8_t*)mk_param_struct) + pgm_read_byte(param_config+(8*items[(ii+offset2)+4])+4)); // Abfrage Variohöhe Notgas |
uint8_t bitmap = pgm_read_byte(param_config+(8*items[(ii+offset2)+4])+3); // Abfrage Variohöhe Notgas |
if(value & bitmap) |
lcd_printp_at(17,ii+1,PSTR("%"), 0); |
else |
lcd_printp_at(17,ii+1,PSTR(" "), 0); |
} |
} |
} |
if(type == 1) |
{ |
uint8_t value = *(((uint8_t*)mk_param_struct) + pgm_read_byte(param_config+(8*items[ii+offset2])+4)); |
if(value < 248) |
write_ndigit_number_u (18, ii+1, value, 3, 0,0); |
if(value >= 248) |
{ |
lcd_printp_at (18, ii+1, PSTR(" P"), 0); |
write_ndigit_number_u (20, ii+1, 256-value, 1, 0,0); |
} |
} |
if(type == 2) |
{ |
uint8_t value = *(((uint8_t*)mk_param_struct) + pgm_read_byte(param_config+(8*items[ii+offset2])+4)); |
uint8_t bitmap = pgm_read_byte(param_config+(8*items[ii+offset2])+3); |
if(value & bitmap) |
lcd_printp_at (18, ii+1, PSTR(" J"), 0); |
else |
lcd_printp_at (18, ii+1, PSTR(" N"), 0); |
} |
if(type == 3) |
{ |
uint8_t value = *(((uint8_t*)mk_param_struct) + pgm_read_byte(param_config+(8*items[ii+offset2])+4)); |
if (value<=12) |
write_ndigit_number_u (18, ii+1, value, 3, 0,0); |
else |
if (value<=(24)) |
{ |
lcd_printp_at (18, ii+1, PSTR("S"), 0); |
write_ndigit_number_u (19, ii+1, (value-12), 2, 0,0); |
} |
if (value==25) |
lcd_printp_at (18, ii+1, PSTR("WPE"), 0); |
} |
if(type == 4) |
write_ndigit_number_u (18, ii+1, *(((uint8_t*)mk_param_struct) + pgm_read_byte(param_config+(8*items[ii+offset2])+4)), 3, 0,0); |
if(type == 5) |
write_ndigit_number_u (18, ii+1, (*(((uint8_t*)mk_param_struct) + pgm_read_byte(param_config+(8*items[ii+offset2])+4)))*15, 3, 0,0); |
if(type == 6) // Empfänger Typ |
{ |
uint8_t value = *(((uint8_t*)mk_param_struct) + pgm_read_byte(param_config+(8*items[ii+offset2])+4)); |
if(value == 0) |
lcd_printp_at (18, ii+1, PSTR("PPM"), 0); |
else if(value == 1) |
lcd_printp_at (18, ii+1, PSTR("Spe"), 0); |
else if(value == 2) |
lcd_printp_at (18, ii+1, PSTR("SpH"), 0); |
else if(value == 3) |
lcd_printp_at (18, ii+1, PSTR("SpL"), 0); |
else if(value == 4) |
lcd_printp_at (18, ii+1, PSTR("Jet"), 0); |
else if(value == 5) |
lcd_printp_at (18, ii+1, PSTR("ACT"), 0); |
else if(value == 6) |
lcd_printp_at (18, ii+1, PSTR("HoT"), 0); |
else if(value == 7) |
lcd_printp_at (18, ii+1, PSTR("SBU"), 0); |
else if(value == 8) |
lcd_printp_at (18, ii+1, PSTR("USR"), 0); |
else |
write_ndigit_number_u (18, ii+1, *(((uint8_t*)mk_param_struct) + pgm_read_byte(param_config+(8*items[ii+offset2])+4)), 3, 0,0); |
} |
} |
if((ii == 5)&&(ii+offset2 < (size-1))) |
lcd_printp_at(1,6, PSTR("\x13"), 0); |
} |
if(pmode == 0) |
{ |
if(offset2 == 0) |
{ |
if(size > 6) |
val = menu_choose2 (1, 5, target_pos2,0,1); |
else |
val = menu_choose2 (1, size, target_pos2,0,0); |
} |
else |
val = menu_choose2 (2, 5, target_pos2,1,1); |
} |
if(pmode == 1) |
{ |
if(offset2+7 > size) |
val = menu_choose2 (2, 6, target_pos2,1,0); |
else |
val = menu_choose2 (2, 5, target_pos2,1,1); |
} |
if(val == 254) |
{ |
offset2++; |
pmode = 1; |
target_pos2 = 5; |
} |
else if(val == 253) |
{ |
offset2--; |
pmode = 0; |
target_pos2 = 2; |
} |
else |
break; |
} |
if(val != 255) |
{ |
target_pos2=val; |
return items[val+offset2-1]; |
} |
else |
return val; |
} |
//-------------------------------------------------------------- |
uint8_t display_section_menu(void) |
{ |
uint8_t size = PAGES; |
uint8_t val =0; |
while(1) |
{ |
lcd_cls (); |
// lcd_printp_at (0, 0, PSTR(" Wähle Seite: "), 2); |
lcd_puts_at(0, 0, strGet(PARA_SEITE),2); |
// lcd_printp_at (0, 7, PSTR(KEY_LINE_1), 0); |
lcd_puts_at(0, 7, strGet(KEYLINE1), 0); |
ii = 0; |
if(offset > 0) |
lcd_printp_at(1,1, PSTR("\x12"), 0); |
for(ii = 0;ii < 6 ; ii++) |
{ |
if((ii+offset) < size) |
lcd_printp_at(3,ii+1,param_pages[ii+offset][Config.DisplayLanguage], 0); |
if((ii == 5)&&(ii+offset < (size-1))) |
lcd_printp_at(1,6, PSTR("\x13"), 0); |
} |
if(dmode == 0) |
{ |
if(offset == 0) |
{ |
if(size > 6) |
val = menu_choose2 (1, 5, target_pos,0,1); |
else |
val = menu_choose2 (1, size, target_pos,0,0); |
} |
else |
val = menu_choose2 (2, 5, target_pos,1,1); |
} |
if(dmode == 1) |
{ |
if(offset+7 > size) |
val = menu_choose2 (2, 6, target_pos,1,0); |
else |
val = menu_choose2 (2, 5, target_pos,1,1); |
} |
if(val == 254) |
{ |
offset++; |
dmode = 1; |
target_pos = 5; |
} |
else if(val == 253) |
{ |
offset--; |
dmode = 0; |
target_pos = 2; |
} |
else |
break; |
} |
if(val != 255) |
{ |
target_pos=val; |
return val+offset; |
} |
else |
return val; |
} |
//-------------------------------------------------------------- |
uint8_t display_settings_menu (void) |
{ |
uint8_t status; |
lcd_cls (); |
// lcd_printp_at (0, 0, PSTR(" Wähle Setting: "), 2); |
lcd_puts_at(0, 0, strGet(PARA_SELSETT), 2); |
// lcd_printp_at (0, 7, PSTR(KEY_LINE_1), 0); |
lcd_puts_at(0, 7, strGet(KEYLINE1), 0); |
for(setting=1;setting<6;setting++) |
{ |
status = load_setting(setting); |
if(status == 255) |
return 255; |
write_ndigit_number_u (3, setting, status, 1, 0,0); |
lcd_print_at (5,setting,(uint8_t*)mk_param_struct->Name, 0); |
} |
// lcd_printp_at (3, 6, PSTR("Kopiere Setting"), 0); |
lcd_puts_at(3, 6, strGet(PARA_COPY), 0); |
status = load_setting(0xff); |
if(status == 255) |
return 255; |
setting = menu_choose (1, 6, 1,status); |
return setting; |
} |
//-------------------------------------------------------------- |
uint8_t load_setting(uint8_t setting) |
{ |
mode = 'Q'; // Settings |
uint8_t timeout = 50; |
rxd_buffer_locked = FALSE; |
while (!rxd_buffer_locked && timeout) |
{ |
SendOutData ('q', ADDRESS_FC, 1, &setting, 1); |
// _delay_ms(50); |
timer = 20; |
while (timer > 0); |
timeout--; |
} |
if (timeout != 0) |
{ |
Decode64 (); |
setting = *pRxData; |
mk_param_struct = (mk_param_struct_t *) (pRxData + 1) ; |
} |
else |
{ // timeout occured |
// lcd_printp_at (0, 2, PSTR("Fehler: keine Daten"), 0); |
lcd_puts_at(0, 2, strGet(OSD_ERROR), 0); |
timer = 100; |
while (timer > 0); |
setting = 255; |
} |
return setting; |
} |
//-------------------------------------------------------------- |
uint8_t write_setting(uint8_t setting) |
{ |
mode = 'S'; // Settings |
uint8_t timeout = 50; |
rxd_buffer_locked = FALSE; |
while (!rxd_buffer_locked && timeout) |
{ |
SendOutData ('s', ADDRESS_FC, 2, &setting, 1, mk_param_struct, sizeof(mk_param_struct_t)); |
// _delay_ms(50); |
timer = 20; |
while (timer > 0); |
timeout--; |
} |
if (timeout != 0) |
{ |
Decode64 (); |
setting = *pRxData; |
} |
else // timeout occured |
{ |
// lcd_printp_at (0, 2, PSTR("Fehler: keine Daten"), 0); |
lcd_puts_at(0, 2, strGet(OSD_ERROR), 0); |
timer = 100; |
while (timer > 0); |
setting = 255; |
} |
return setting; |
} |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/parameter.h |
---|
0,0 → 1,46 |
/***************************************************************************** |
* Copyright (C) 2008 Thomas Kaiser, thomas@ft-fanpage.de * |
* Copyright (C) 2009 Peter "woggle" Mack, mac@denich.net * |
* Copyright (C) 2011 Christian "Cebra" Brandtner, brandtner@brandtner.net * |
* Copyright (C) 2011 Harald Bongartz * |
* * |
* This program is free software; you can redistribute it and/or modify * |
* it under the terms of the GNU General Public License as published by * |
* the Free Software Foundation; either version 2 of the License. * |
* * |
* This program is distributed in the hope that it will be useful, * |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
* GNU General Public License for more details. * |
* * |
* You should have received a copy of the GNU General Public License * |
* along with this program; if not, write to the * |
* Free Software Foundation, Inc., * |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
* * |
* * |
* Credits to: * |
* Holger Buss & Ingo Busker from mikrokopter.de for the MK project + SVN * |
* http://www.mikrokopter.de * |
* Gregor "killagreg" Stobrawa for his version of the MK code * |
* Thomas Kaiser "thkais" for the original project. See * |
* http://www.ft-fanpage.de/mikrokopter/ * |
* http://forum.mikrokopter.de/topic-4061-1.html * |
* Claas Anders "CaScAdE" Rathje for providing the font and his C-OSD code * |
* http://www.mylifesucks.de/oss/c-osd/ * |
* Harald Bongartz "HaraldB" for providing his Ideas and Code for usibility* |
*****************************************************************************/ |
#ifndef _PARAMETER_H |
#define _PARAMETER_H |
#include "main.h" |
void edit_parameter (void); |
uint8_t load_setting(uint8_t setting); |
#endif |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/parameter_names.h |
---|
0,0 → 1,293 |
/***************************************************************************** |
* Copyright (C) 2008 Thomas Kaiser, thomas@ft-fanpage.de * |
* Copyright (C) 2009 Peter "woggle" Mack, mac@denich.net * |
* Copyright (C) 2011 Christian "Cebra" Brandtner, brandtner@brandtner.net * |
* Copyright (C) 2011 Harald Bongartz * |
* * |
* This program is free software; you can redistribute it and/or modify * |
* it under the terms of the GNU General Public License as published by * |
* the Free Software Foundation; either version 2 of the License. * |
* * |
* This program is distributed in the hope that it will be useful, * |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
* GNU General Public License for more details. * |
* * |
* You should have received a copy of the GNU General Public License * |
* along with this program; if not, write to the * |
* Free Software Foundation, Inc., * |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
* * |
* * |
* Credits to: * |
* Holger Buss & Ingo Busker from mikrokopter.de for the MK project + SVN * |
* http://www.mikrokopter.de * |
* Gregor "killagreg" Stobrawa for his version of the MK code * |
* Thomas Kaiser "thkais" for the original project. See * |
* http://www.ft-fanpage.de/mikrokopter/ * |
* http://forum.mikrokopter.de/topic-4061-1.html * |
* Claas Anders "CaScAdE" Rathje for providing the font and his C-OSD code * |
* http://www.mylifesucks.de/oss/c-osd/ * |
* Harald Bongartz "HaraldB" for providing his Ideas and Code for usibility* |
*****************************************************************************/ |
#define PAGES 14 |
#ifdef MKVERSION088n |
#define PARAM_COUNT 152 //152 FC088L |
#endif |
#ifdef MKVERSION090b |
#define PARAM_COUNT 156 //156 FC090b |
#endif |
#define PARAM_LENGTH 15 |
#define PARAM_NUM_LANG 3 |
// German Englisch Holländisch |
prog_char param_pages[PAGES][PARAM_NUM_LANG][PARAM_LENGTH]= // zeilen,zeichen+1 |
{ |
{"Kanäle ","Channel ","Kanaal "}, |
{"Konfiguration ","main ","Configuratie "}, |
{"Stick ","stick ","Stick "}, |
{"Looping ","Looping ","Looping "}, |
{"Höhe ","Altitude ","Hoogte "}, |
{"Kamera ","Camera ","Camera "}, |
{"NaviCtrl ","NaviCtrl ","NaviCtrl "}, |
{"Ausgänge ","Outputs ","Uitgangen "}, |
{"Verschiedenes ","Divers ","Diversen "}, |
{"Gyro ","Gyro ","Gyro "}, |
{"Benutzer ","User ","Gebruiker "}, |
{"Achskopplung ","Coupl Axes ","Koppeling Ass "}, |
{"Mixer-Setup ","Config Mix ","Config. Mixer "}, |
{"Easy Setup ","Config Easy ","Config. easy "}, |
}; |
//Namen |
prog_char param_names[PARAM_COUNT][PARAM_NUM_LANG][PARAM_LENGTH]= |
{ |
// group 0 (kanaele) 1-15 |
{"Gas ","Throttle ","Gas "}, |
{"Gier ","Gier ","Gier "}, |
{"Nick ","Nick ","Nick "}, |
{"Roll ","Roll ","Roll "}, |
{"Poti 1 ","Poti 1 ","Poti 1 "}, |
{"Poti 2 ","Poti 2 ","Poti 2 "}, |
{"Poti 3 ","Poti 3 ","Poti 3 "}, |
{"Poti 4 ","Poti 4 ","Poti 4 "}, |
{"Poti 5 ","Poti 5 ","Poti 5 "}, |
{"Poti 6 ","Poti 6 ","Poti 6 "}, |
{"Poti 7 ","Poti 7 ","Poti 7 "}, |
{"Poti 8 ","Poti 8 ","Poti 8 "}, |
{"Motor Sich.Sch","Mot.Safety Sw.","Mot.saf.schak."}, |
{"Motor Swi.Mode","Motor Swi.Mode","Motor Swi.Mode"}, |
{"Erw. Sig. Pr. ","Enh. Sig.Check","Uitg.Sig.Check"}, |
{"Empfänger Typ ","Receiver Type ","Ontvang. Type "}, |
#ifdef MKVERSION090b |
{"Spk all Events","Spk all Events","Spk all Events"}, |
#endif |
// group 1 (main) 16-23 |
{"Höhenregeler ","Ctrl Altitude ","Ctrl Hoogte "}, |
{"GPS ","GPS ","GPS "}, |
{"Kompass ","Compass ","Kompas "}, |
{"KompFest Ausr.","CompOrient.Fix","Kompas vast "}, |
{"Erw. Sig. Pr. ","Sens.RcvSigVal","ExtRec Signaal"}, |
{"Achs(e.)koppl.","Axis Couping ","As koppeling "}, |
{"Drehratenbegr.","RotRate limit.","RotRate limit."}, |
{"Heading Hold ","Nick/Roll ","Koers vast "}, |
// group 2 (stick) 24-27 |
{"Nick/Roll P ","Nick/Roll P ","Nick/Roll P "}, |
{"Nick/Roll D ","Nick/Roll D ","Nick/Roll D "}, |
{"Gier P ","Gier P ","Gier P "}, |
{"Externe Kontr.","Extern Ctrl ","Extern Control"}, |
// group3 : (looping) 28-36 |
{"Looping oben ","Looping up ","Looping omhoog"}, |
{"Looping unten ","Looping down ","Looping bened."}, |
{"Looping links ","Looping left ","Looping links "}, |
{"Looping rechts","Looping right ","Looping rechts"}, |
{"Gas Limit ","Throttle Limit","Gas Limiet "}, |
{"Ansprechschw. ","Resp. Thresh. ","Drempelwaarde "}, |
{"Hysterese ","Hysteresis ","Hysterese "}, |
{"Umkehrp. Nick ","Turnover Nick ","Nick geinvert."}, |
{"Umkehrp. Roll ","Turnover Roll ","Roll geinvert."}, |
// group 4 (hoehe) 37-50 |
{"Höhenregelung ","Altitude Ctrl ","Hoogte Control"}, |
{"J:HBeg,N:Vario","Y:LimH,N:Vario","Y:LimH,N:Vario"}, |
{"Schalter f. H.","use Sw. f.Setp","Schak. Hoogte "}, |
{"akust. Vario ","acoustic Vario","Akoest. Vario "}, |
{"Sollhöhe ","Setpoint ","Gewenste hoogt"}, |
{"Min. Gas ","min. throttle ","Minimaal gas "}, |
{"Höhe P ","Altitude P ","Hoogte P "}, |
{"Luftdruck D ","Barometric D ","Barometr. D "}, |
{"Z-ACC ","ACC Z ","ACC Z "}, |
{"Max. Höhe ","Max. Altitude ","Max. hoogte "}, |
{"Verstärkung/R ","gain/rate ","Verst./rate "}, |
{"Schwebegas +/-","hoover varia. ","hoover varia. "}, |
{"GPS Z ","GPS Z ","GPS Z "}, |
{"Stick Neutr. P","stick neutr. P","stick neutr. P"}, |
// group 5 : (kamera) 51-68 |
{"Nick S. Anst. ","nick serv ctrl","nick serv ctrl"}, |
{"Nick Kompens. ","nick compens. ","nick compens. "}, |
{"Nick Umkehren ","nick inv. dir.","nick inv.rich."}, |
#ifdef MKVERSION090b |
{"Nick Servo rel","nick servo rel","nick servo rel"}, |
#endif |
{"Nick Servo min","nick servo min","nick servo min"}, |
{"Nick Servo max","nick servo max","nick servo max"}, |
{"Nick Serv Filt","Nick Serv Filt","Nick Serv Filt"}, //FC0.87 |
{"Roll S. Anst. ","roll serv ctrl","roll serv ctrl"}, |
{"Roll Kompens. ","roll compens. ","roll compens. "}, |
{"Roll Umkehren ","roll inv. dir.","roll omkeren "}, |
{"Roll Servo min","roll servo min","roll servo min"}, |
{"Roll Servo max","roll servo max","roll servo max"}, |
{"Roll Serv Filt","Roll Serv Filt","Roll Serv Filt"}, //FC0.87 |
{"Anst. Geschw. ","servo refresh ","Servo refresh "}, |
{"Manuelle Gesch","manuell Speed ","Snelh.handbed."}, |
{"Cam Richtung ","Cam Orient ","Camera richt. "}, |
{"Servo 3 ","Servo 3 ","Servo 3 "}, |
{"Servo 4 ","Servo 4 ","Servo 4 "}, |
{"Servo 5 ","Servo 5 ","Servo 5 "}, |
// group 6 : (navictrl) 69-88 "CH Hoogte " |
{"GPS ","enable GPS ","enable GPS "}, |
{"GPS Modus St. ","GPS mode contr","GPS mode contr"}, |
{"GPS Verstärk. ","GPS Gain ","GPS versterk. "}, |
{"GPS St. Schw. ","GPS stick thre","GPS st. dremp."}, |
{"Min. Sat. ","Min. Sat. ","Min. Sat. "}, |
{"GPS-P ","GPS-P ","GPS-P "}, |
{"GPS-I ","GPS-I ","GPS-I "}, |
{"GPS-D ","GPS-D ","GPS-D "}, |
{"P Limit ","Limit P ","Limiet P "}, |
{"I Limit ","Limit I ","Limiet I "}, |
{"D Limit ","Limit D ","Limiet D "}, |
{"GPS Acc ","GPS Acc ","GPS Acc "}, |
{"GPS Windkorr. ","GPS Wind Corr.","GPS Wind Corr."}, |
{"Bremswirkung ","Speed compens.","Remwerking "}, |
{"GPS max. Rad. ","GPS max.radius","GPS max.radius"}, |
{"GPS Winkel Li.","GPS angl.limit","GPS hoek lim. "}, |
{"PH Login time ","PH login time ","PH login tijd "}, |
{"Dynamic PH ","Dynamic PH ","Dynamische PH "}, |
{"GPS m. Rad dPH","GPS m. Rad dPH","GPS m. Rad dPH"}, //FC0.87 |
{"CH Höhe ","CH Altitude ","CH Hoogte "}, |
// group 7 : (ausgaenge) 89-98 |
{"LED1 Bitmaske ","Out1 Bitmask ","Uitg1 Bitpatr."}, |
{" Timing ","Out1 Timing ","Uitg1 Timing "}, |
{" sofort an","Activ ","Direct aan "}, |
{" n.m.Motor","Act. wi. Motor","Akt. motor uit"}, |
#ifdef MKVERSION090b |
{"mit WP-Event ","comb. WP-Event","comb. WP-Event"}, |
{"AutoTr. m/Poti","AutoTr. m/poti","AutoTr. m/poti"}, |
#endif |
{"LED2 Bitmaske ","Out2 Bitmask ","Uitg2 Bitpatr."}, |
{" Timing ","Out2 Timing ","Uitg2 Timing "}, |
{" sofort an","Activ ","Direct aan "}, |
{" n.m.Motor","Act. wi. Motor","Akt. motor uit"}, |
{"Out1 Vmin.Warn","Out1 undervolt","Uitg1 ondersp."}, |
{"Out2 Vmin.Warn","Out2 undervolt","Uitg2 ondersp."}, |
// group 8 : (verschiedenes) 99-11 |
{"Min. Gas ","min. throttle ","minimaal gas "}, |
{"Max. Gas ","max. throttle ","maximaal gas "}, |
{"Kompasswirkung","compass effect","Kompas effect "}, |
{"Carefree St. ","Carefree Ctrl ","Carefree Ctrl "}, |
{"Teachable Care","Teachable Care","Teachable Care"}, |
{"Unterspannung ","undervoltage ","Onderspanning "}, |
{"Volt Referenz ","Volt Referenz ","Ref. spanning "}, |
{"Not Gas Zeit ","Emerg.Thr.Time","Nood gas tijd "}, |
{"Not Gas ","Emerg.Throttle","Nood gas "}, |
{"Fails. CH Time","Fails. CH Time","Fails. CH Tijd"}, |
{"Fails. Channel","Fails. Channel","Fails. Channel"}, //FC 0.87 |
{"k.Summer o Sen","n beep act TX ","n beep act TX "}, // Pos Change FC0.87 |
{"Vario fail Alt","Vario fail Alt","Vario fail Alt"}, //FC 0.87 |
{"Compass Error ","Compass Error ","Kompas Error "}, |
{"k.Start o.SD-K","n st. wtho SD ","n st. wtho SD "}, //FC 0.87 |
{"k.Start o.GPS ","n st. wtho GPS","n st. wtho GPS"}, //FC 0.88L |
// group 9 : (gyro) 114-126 |
{"Gyro P ","Gyro P ","Gyro P "}, |
{"Gyro I ","Gyro I ","Gyro I "}, |
{"Gyro D ","Gyro D ","Gyro D "}, |
{"Gier P ","Lacet P ","Gier P "}, |
{"Gier I ","Lacet I ","Gier I "}, |
{"Dynamische St.","dynamic stabi.","Dynamis. stab."}, |
{"Drehratenbeg. ","RotRate limit.","Toerental lim."}, |
{"ACC/Gyro Fak. ","ACC/Gyro Fact ","ACC/Gyro Fact "}, |
{"ACC/Gyro Komp.","Comp ACC/Gyro ","Comp ACC/Gyro "}, |
{"Hauptregler I ","Main I ","Hoofdregel. I "}, |
{"Drifkompensat.","drift Compens.","Drift compens."}, |
{"Gyro stab. ","Gyro stability","Gyro stabilit."}, |
{"Motor smooth ","Motor smooth ","Motor smooth "}, |
// group 10: (benutzer) 127-134 |
{"Parameter 1 ","Parameter 1 ","Parameter 1 "}, |
{"Parameter 2 ","Parameter 2 ","Parameter 2 "}, |
{"Parameter 3 ","Parameter 3 ","Parameter 3 "}, |
{"Parameter 4 ","Parameter 4 ","Parameter 4 "}, |
{"Parameter 5 ","Parameter 5 ","Parameter 5 "}, |
{"Parameter 6 ","Parameter 6 ","Parameter 6 "}, |
{"Parameter 7 ","Parameter 7 ","Parameter 7 "}, |
{"Parameter 8 ","Parameter 8 ","Parameter 8 "}, |
// group 11: (achskopplung) 135-13 |
{"Achs(e.)koppl.","(De)Coupl Axes","As koppeling "}, |
{"Gier pos. Kopp","Retroac lacet ","Gier pos. kop."}, |
{"Nick/Roll Kopp","Retro roul/tan","Nick/Roll kop."}, |
{"Gier Korrektur","Correct lacet ","Gier correctie"}, |
// group 12: (mixer) 139 |
{"Orientierung ","Orientierung ","Orientation "}, |
// group 13 (easy) 140-150 |
{"Höhenregelung ","Altitude Ctrl ","Hoogte Contr. "}, |
{"Sollhöhe ","Setpoint ","Gewenst.hoogte"}, |
{"Stick Neutr. P","stick neutr. P","Stick neutr. P"}, |
{"GPS ","enable GPS ","Enable GPS "}, |
{"GPS Modus St. ","GPS mode contr","GPS mode contr"}, |
{"Dynamic PH ","Dynamic PH ","Dynamic PH "}, |
{"CH Höhe ","CH High ","CH hoogte "}, |
{"Carefree St. ","Carefree Ctrl ","Carefree Ctrl "}, |
{"Teachable Care","Teachable Care","Teachable Care"}, |
{"Motor Sich.Sch","Mot.Safety Sw.","Mot.saf.schak."}, |
{"Orientierung ","Orientation ","Orientatie "}, |
}; |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/setup/.directory |
---|
0,0 → 1,3 |
[Dolphin] |
Timestamp=2013,3,4,21,10,43 |
ViewMode=1 |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/setup/setup.c |
---|
0,0 → 1,2518 |
/***************************************************************************** |
* Copyright (C) 2008 Thomas Kaiser, thomas@ft-fanpage.de * |
* Copyright (C) 2009 Peter "woggle" Mack, mac@denich.net * |
* Copyright (C) 2011 Christian "Cebra" Brandtner, brandtner@brandtner.net * |
* Copyright (C) 2011 Harald Bongartz * |
* * |
* This program is free software; you can redistribute it and/or modify * |
* it under the terms of the GNU General Public License as published by * |
* the Free Software Foundation; either version 2 of the License. * |
* * |
* This program is distributed in the hope that it will be useful, * |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
* GNU General Public License for more details. * |
* * |
* You should have received a copy of the GNU General Public License * |
* along with this program; if not, write to the * |
* Free Software Foundation, Inc., * |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
* * |
* * |
* Credits to: * |
* Holger Buss & Ingo Busker from mikrokopter.de for the MK project + SVN * |
* http://www.mikrokopter.de * |
* Gregor "killagreg" Stobrawa for his version of the MK code * |
* Thomas Kaiser "thkais" for the original project. See * |
* http://www.ft-fanpage.de/mikrokopter/ * |
* http://forum.mikrokopter.de/topic-4061-1.html * |
* Claas Anders "CaScAdE" Rathje for providing the font and his C-OSD code * |
* http://www.mylifesucks.de/oss/c-osd/ * |
* Harald Bongartz "HaraldB" for providing his Ideas and Code for usibility* |
*****************************************************************************/ |
//############################################################################ |
//# HISTORY setup.c |
//# |
//# 04.03.2013 Cebra |
//# - del: OSD-Sreenmode ,is no longer necessary, last OSD-Screen is saved at shutdown |
//############################################################################ |
//bt_connect |
#include "../cpu.h" |
#include <avr/io.h> |
#include <avr/interrupt.h> |
#include <avr/pgmspace.h> |
#include <string.h> |
#include <util/delay.h> |
#include "../main.h" |
#include "../setup/setup.h" |
#include "../lcd/lcd.h" |
#include "../eeprom/eeprom.h" |
#include "../timer/timer.h" |
#include "../menu.h" |
#include "../wi232/Wi232.h" |
#include "../bluetooth/bluetooth.h" |
#include "../connect.h" |
#include "../lipo/lipo.h" |
#include "../messages.h" |
#include "../eeprom/eeprom.h" |
#include "../tracking/tracking.h" |
#include "../uart/uart1.h" |
#include "../osd/osd.h" |
#include "../sound/pwmsine8bit.h" |
#include "../tracking/servo_setup.h" |
#include "../bluetooth/error.h" |
#include "../stick/stick_setup.h" |
uint8_t spalte; |
uint8_t mmode; |
uint8_t edit; |
uint8_t LCD_Orientation; |
uint8_t edit = 0; |
uint8_t LCD_Change = 0; |
uint8_t PKT_Change = 0; |
uint16_t Pre; |
uint16_t Pre16; |
char EditString[21]; |
uint8_t bt_name_len; |
uint8_t length_tmp; |
uint8_t CheckGPS=false; |
uint8_t Old_Baudrate = 0; //Merkzelle für alte Baudrate |
//-------------------------------------------------------------- |
#define ITEMS_PKT 13 |
const prog_char param_menuitems_pkt[ITEMS_PKT][NUM_LANG][18]= // zeilen,zeichen+1 |
// German, English, French, Dutch |
{ |
{"Verbindung zum MK","connection to MK ","Aansluiting op MK"}, |
{"PKT allgemein \x1d","PKT global \x1d","PKT global \x1d"}, |
{"Wi.232 \x1d","Wi.232 \x1d","Wi.232 \x1d"}, |
{"BTM-222 \x1d","BTM-222 \x1d","BTM-222 \x1d"}, |
{"Servo Menü \x1d","servo menu \x1d","servo menu \x1d"}, |
{"OSD Anzeige \x1d","OSD screen \x1d","OSD screen \x1d"}, |
{"GPS \x1d","GPS \x1d","GPS \x1d"}, |
{"Follow Me \x1d","Follow Me \x1d","Follow Me \x1d"}, |
{"Joystick \x1d","joystick \x1d","joystick \x1d"}, |
{"PKT-Akku \x1d","PKT-Accu \x1d","PKT-Accu \x1d"}, |
{"PKT Update ","PKT Update ","PKT Update "}, |
{"Debug PKT ","Debug PKT ","Debug PKT "}, |
{"EEProm Reset ","EEProm Reset ","EEProm Reset "}, |
}; |
#define ITEMS_LCD 11 |
const prog_char param_menuitems_lcd[ITEMS_LCD][NUM_LANG][18]= // zeilen,zeichen+1 |
// German, English, French, Dutch |
{ |
{"Infos beim Start ","info at startup ","info bij opstart "}, |
{"OSD Empfangsausf.","OSD receive Error","OSD receive Error"}, |
{"Sprache ","language ","taal "}, |
{"Licht aus nach...","light off after ","licht uit na "}, |
{"Helligkeit ","brightness ","helderheid "}, |
{"Kontrast ","contrast ","contrast "}, |
{"Normal/Invers ","normal/inverted ","Normal/inverted "}, |
{"Orientierung ","orientation ","orientatie "}, |
{"Vario Ton Erw. ","Vario Sound Ext. ","Vario Sound Ext. "}, |
{"Hardware Beeper ","Hardware Beeper ","Hardware Beeper "}, |
{"Lautstärke Ton ","Volume ","Volume "}, |
}; |
#define ITEMS_WI 9 |
const prog_char param_menuitems_wi[ITEMS_WI][NUM_LANG][18]= // zeilen,zeichen+1 |
// German, English, French, Dutch |
{ |
{"Modul eingebaut? ","module built in? ","Module geinstal.?"}, |
{"TX/RX Kanal ","TX/RX Channel ","TX/RX Channel "}, |
{"NetW. Gruppe ","NetW. Group ","NetW. Group "}, |
{"NetW. Mode ","NetW. Mode ","NetW. Mode "}, |
{"TX Timeout ","TX Timeout ","TX Timeout "}, |
{"TX MTU ","TX MTU ","TX MTU "}, |
{"Baudrate Wi232/BT","Baudrate Wi232/BT","Baudrate Wi232/BT"}, |
{"Initialisieren ","initialize ","Initialize "}, |
{"Konfig. mit PC ","config. with PC ","Config. met PC "}, |
}; |
#define ITEMS_BT 7 |
const prog_char param_menuitems_bt[ITEMS_BT][NUM_LANG][18]= // zeilen,zeichen+1 |
// German, English, Dutch |
{ |
{"Modul eingebaut? ","module built in? ","module geinstall?"}, |
{"Name ","name ","Naam "}, |
{"Pin ","pin ","Pin "}, |
{"Initialisieren ","initialize ","Initialize "}, |
{"Bluetooth MAC-Adr","Bluetooth MAC-Adr","Bluetooth MAC-Adr"}, |
{"RE-ID ","RE-ID ","RE-ID "}, |
{"Konfig. mit PC ","config. with PC ","Config. met PC "}, |
}; |
#define ITEMS_Accu 2 |
const prog_char param_menuitems_Accu[ITEMS_Accu][NUM_LANG][18]= // zeilen,zeichen+1 |
// German, English, French, Dutch |
{ |
{"PKT-Akkutyp ","PKT-Accutyp ","PKT-batterij type"}, |
{"PKT Akku Messung ","PKT AccuMeasure ","PKT batt. meting "}, |
}; |
#define ITEMS_GPS 6 |
const prog_char param_menuitems_GPS[ITEMS_GPS][NUM_LANG][18]= // zeilen,zeichen+1 |
// German, English, French, Dutch |
{ |
{"wähle GPS Maus ","select GPS mouse ","select GPS mouse "}, |
{"Suche GPS Maus ","search GPS mouse ","search GPS mouse "}, |
{"GPS Maus Typ ","GPS mouse typ ","GPS mouse typ "}, |
{"GPS Maus aktiv? ","GPS mouse activ? ","GPS mouse activ? "}, |
{"Zeige GPS Device ","show GPS device ","show GPS device "}, |
{"GPS Daten ","GPS data ","GPS data "}, |
}; |
#define ITEMS_FOLLOWME 3 |
const prog_char param_menuitems_FOLLOWME[ITEMS_GPS][NUM_LANG][18]= // zeilen,zeichen+1 |
// German, English, French, Dutch |
{ |
{"FollowMe Refresh","FollowMe Refresh","FollowMe Refresh"}, |
{"FollowMe Speed ","FollowMe Speed ","FollowMe Speed "}, |
{"Toleranz Radius ","Tolerance Radius","Tolerance Radius"}, |
}; |
#define ITEMS_OSD 9 |
const prog_char param_menuitems_OSD[ITEMS_OSD][NUM_LANG][18]= // zeilen,zeichen+1 |
// German, English, French, Dutch |
{ |
{"OUT1/2 Format ","OUT1/2 format ","OUT1/2 format "}, |
{"OUT1/2 Polarität ","OUT1/2 polarity ","OUT1/2 polarity "}, |
{"Navi Daten an SV2","Navi data to SV2 ","Navi data to SV2 "}, |
{"Max. Sinkrate m/s","max fallspeed m/s","max fallspeed m/s"}, |
{"Variometer Beep ","Variometer beep ","Variometer beep "}, |
{"Home aus MK Sicht","home from MK view","home from MK view"}, |
{"MK LowBat Warnung","MK LowBat warning","MK LoBat alarm "}, |
{"MK mAh Warnung","MK mAh warning ","MK mAh alarm "}, |
{"MK Volt Balken","MK volt bargraph ","MK volt bargraph "}, |
}; |
//-------------------------------------------------------------- |
void Show_Error_HW12(void) |
{ |
lcd_cls(); |
lcd_printp_at (0,3,PSTR(" Mit Hardware 1.x "), 2); |
lcd_printp_at (0,4,PSTR(" nicht möglich "), 2); |
_delay_ms(1000); |
} |
void Edit_printout(uint16_t Value,uint16_t min,uint16_t max, uint8_t what) |
{ |
switch (what) |
{ |
case Show_uint3: write_ndigit_number_u (16, 2,Value, 3, 0,0);break; |
case Show_uint5: write_ndigit_number_u (16, 2,Value, 5, 0,0);break; |
case Show_uint10th: write_ndigit_number_u_10th (16, 2,Value, 3, 0,0); break; |
case GPSMOUSE: |
switch(Value) |
{ |
case GPS_Bluetoothmouse1: lcd_printp_at (12, 2, PSTR("BT-Mouse1"), 0);break; |
case GPS_Mikrokopter: lcd_printp_at (12, 2, PSTR("Mikrokopt"), 0);break; |
lcd_printp_at (12, 2, PSTR("unknown"), 0); |
break; |
} |
break; |
case Wi_Netmode: |
switch (Value) |
{ |
case false :lcd_puts_at(15, 2, strGet(SLAVE), 0); |
break; |
case true :lcd_puts_at(15, 2, strGet(NORMAL), 0); |
break; |
break; |
} |
break; |
case OnOff: |
switch (Value) |
{ |
case false :lcd_puts_at(17, 2, strGet(OFF), 0); |
break; |
case true :lcd_puts_at(17, 2, strGet(ON), 0); |
break; |
break; |
} |
break; |
case YesNo: |
switch (Value) |
{ |
case false :lcd_puts_at(17, 2, strGet(NOO), 0); |
break; |
case true :lcd_puts_at(17, 2, strGet(YES), 0); |
break; |
break; |
} |
break; |
case NormRev: |
switch (Value) |
{ |
case false :lcd_puts_at(14, 2, strGet(NORMAL), 0); |
break; |
case true :lcd_puts_at(14, 2, strGet(REVERSE), 0); |
break; |
break; |
} |
break; |
case Kontrast: { |
write_ndigit_number_u (16, 2,Value, 3, 0,0); |
if (Value >= max) |
{ |
Value = max; |
set_beep ( 200, 0x0080, BeepNormal); |
write_ndigit_number_u (16, 2,Value, 3, 0,0); |
} |
else |
{ |
write_ndigit_number_u (16, 2,Value, 3, 0,0); |
cli(); |
clr_A0 (); |
send_byte (0x81); |
send_byte (Value); // Daten zum LCD senden |
set_A0 (); |
sei(); |
} |
// break; |
if (Value == min) |
{ |
write_ndigit_number_u (16, 2,Value, 3, 0,0); |
Value = min; |
set_beep ( 200, 0x0080, BeepNormal); |
} |
else |
{ |
write_ndigit_number_u (16, 2,Value, 3, 0,0); |
cli(); |
clr_A0 (); |
send_byte (0x81); |
send_byte (Value); // Daten zum LCD senden |
set_A0 (); |
sei(); |
} |
} |
break; |
case Baudrate: |
switch (Value) |
{ |
case 0x0 : lcd_printp_at(15, 2, PSTR("2400 "), 0); |
break; |
case 0x1 : lcd_printp_at(15, 2, PSTR("9600 "), 0); |
break; |
case 0x2 : lcd_printp_at(15, 2, PSTR("19200 "), 0); |
break; |
case 0x3 : lcd_printp_at(15, 2, PSTR("38400 "), 0); |
break; |
case 0x4 : lcd_printp_at(15, 2, PSTR("57600 "), 0); |
break; |
case 0x5 : lcd_printp_at(15, 2, PSTR("115200"), 0); |
break; |
case 0x6 : lcd_printp_at(15, 2, PSTR("4800 "), 0); |
break; |
break; |
} |
break; |
case Language: |
switch (Value) |
{ |
case |
0x0 : lcd_puts_at(10, 2, strGet(DEUTSCH), 0);//lcd_printp_at (14, 2, PSTR("Deutsch"), 0); |
break; |
case 0x1 : lcd_puts_at(10, 2, strGet(ENGLISCH), 0);//lcd_printp_at (14, 2, PSTR("English"), 0); |
break; |
case 0x2 : lcd_puts_at(10, 2, strGet(NETHERL), 0);//lcd_printp_at (14, 2, PSTR("Netherl"), 0); |
break; |
break; |
} |
break; |
case Sticktype: |
switch (Value) |
{ |
case false :lcd_puts_at(14, 2, strGet(POTI), 0); |
break; |
case true :lcd_puts_at(14, 2, strGet(TASTER), 0); |
break; |
break; |
} |
break; |
break; |
} |
} |
uint16_t Edit_generic(uint16_t Value, uint16_t min, uint16_t max,uint8_t Text, uint8_t what) |
{ |
Pre = Value; |
lcd_cls(); |
lcd_puts_at(0, 2, strGet(Text), 0); |
Edit_printout(Value,min,max, what); |
lcd_puts_at(0, 7, strGet(KEYLINE2), 0); |
do |
{ |
if ((get_key_press (1 << KEY_PLUS) || get_key_long_rpt_sp ((1 << KEY_PLUS), 2)) && (Value < max)) |
{ |
edit = 1; |
Value++; |
Edit_printout(Value,min,max, what); |
playTone(500,20,Config.Volume); |
} |
if ((get_key_press (1 << KEY_MINUS) || get_key_long_rpt_sp ((1 << KEY_MINUS), 2)) && (Value > min)) |
{ |
edit = 1; |
Value--; |
Edit_printout(Value,min,max, what); |
playTone(500,20,Config.Volume); |
} |
if (get_key_press (1 << KEY_ENTER)) |
{ |
return Value; |
} |
} |
while (!get_key_press (1 << KEY_ESC)); |
get_key_press(KEY_ALL); |
edit = 0; |
return Pre; |
} |
//-------------------------------------------------------------- |
uint8_t ChangeWi_SV2(uint8_t Value) |
{ |
Pre = Value; |
lcd_cls(); |
lcd_puts_at(0, 1, strGet(CONNECT1), 0); |
lcd_puts_at(0, 2, strGet(CONNECT2), 0); |
if(Config.UseWi == false) |
{ |
lcd_puts_at(0, 1, strGet(CONNECT1), 0); |
lcd_puts_at(0, 2, strGet(CONNECT4), 0); |
lcd_puts_at(0, 1, strGet(CONNECT5), 0); |
lcd_puts_at(0, 2, strGet(CONNECT6), 0); |
lcd_puts_at(0, 1, strGet(CONNECT7), 0); |
lcd_puts_at(0, 2, strGet(CONNECT8), 0); |
lcd_puts_at(0, 1, strGet(CONNECT9), 0); |
// lcd_printp_at (12, 7, PSTR("Ende"), 0); |
lcd_puts_at(12, 7, strGet(ENDE), 0); |
while (!get_key_press (1 << KEY_ESC)); |
get_key_press(KEY_ALL); |
edit = 0; |
return Pre; |
} |
else |
{ |
switch (Value) |
{ |
case 0x0 :lcd_printp_at (14, 2, PSTR("Wi232"), 0); |
break; |
case 0x1 : lcd_puts_at(14, 2, strGet(KABEL), 0); |
//lcd_printp_at (14, 2, PSTR("Kabel"), 0); |
break; |
break; |
} |
// lcd_printp_at (0, 7, PSTR(KEY_LINE_2), 0); |
lcd_puts_at(0, 7, strGet(KEYLINE2), 0); |
do |
{ |
if(Config.UseWi == true) |
{ |
if ((get_key_press (1 << KEY_PLUS)) && (Value == 0)) |
{ |
edit = 1; |
Value = 1; |
// lcd_printp_at (14, 2, PSTR("Kabel"), 0); |
lcd_puts_at(14, 2, strGet(KABEL), 0); |
Change_Output(Uart02FC); |
} |
if ((get_key_press (1 << KEY_MINUS)) && (Value == 1)) |
{ |
edit = 1; |
Value = 0; |
lcd_printp_at (14, 2, PSTR("Wi232"), 0); |
Change_Output(Uart02Wi); |
} |
if (get_key_press (1 << KEY_ENTER)) |
{ |
// lcd_printp_at (0, 4, PSTR("Sie müssen das PKT"), 0); |
// lcd_printp_at (0, 5, PSTR("jetzt neu starten!"), 0); |
lcd_puts_at(0, 4, strGet(CONNECT10), 0); |
lcd_puts_at(0, 5, strGet(CONNECT11), 0); |
lcd_cls_line (0, 7, 18); |
while (!get_key_press (1 << KEY_ENTER)); |
return Value; |
} |
} |
} |
while (!get_key_press (1 << KEY_ESC)); |
} |
get_key_press(KEY_ALL); |
edit = 0; |
return Pre; |
} |
//-------------------------------------------------------------- |
uint8_t Edit_DisplayHelligkeit(uint8_t Value, uint8_t min, uint8_t max, uint8_t Text) |
{ |
float ValCorr = 2.55; // (Value * ValCorr) maximal 255 |
Pre = Value; |
OCR2A = Value * ValCorr; |
lcd_cls(); |
// lcd_printp_at (0, 2, Text, 0); |
lcd_puts_at(0, 2, strGet(Text), 0); |
write_ndigit_number_u (16, 2, Value, 3, 0,0); |
lcd_printp_at (17, 2, PSTR("%"), 0); |
// lcd_printp_at (0, 7, PSTR(KEY_LINE_2), 0); |
lcd_puts_at(0, 7, strGet(KEYLINE2), 0); |
do |
{ |
write_ndigit_number_u (16, 2,Value, 3, 0,0); |
lcd_frect ((8*0), (8*4), (Value * (16*8) / 100), 6, 1); |
if ((get_key_press (1 << KEY_PLUS) || get_key_long_rpt_sp ((1 << KEY_PLUS), 3)) && (Value < max)) |
{ |
Value++; |
if (Value >= max) |
{ |
Value = max; |
set_beep ( 200, 0x0080, BeepNormal); |
} |
else |
OCR2A = Value * ValCorr; |
} |
if ((get_key_press (1 << KEY_MINUS) || get_key_long_rpt_sp ((1 << KEY_MINUS), 3)) && (Value > min)) |
{ |
lcd_frect (((Value - 1) * (16*8) / 100), (8*4), (16*8), 6, 0); |
Value--; |
if (Value == min) |
{ |
Value = min; |
set_beep ( 200, 0x0080, BeepNormal); |
} |
else |
OCR2A = Value * ValCorr; |
} |
if (get_key_press (1 << KEY_ENTER)) |
{ |
edit = 1; |
OCR2A = Value * ValCorr; |
Config.LCD_Helligkeit = Value; |
// WriteParameter(); |
edit = 0; |
return Value; |
} |
} |
while (!get_key_press (1 << KEY_ESC)); |
{ |
get_key_press(KEY_ALL); |
edit = 0; |
OCR2A = Pre * ValCorr; |
Config.LCD_Helligkeit = Pre; |
// WriteParameter(); |
return Pre; |
} |
} |
//-------------------------------------------------------------- |
void Reset_EEprom(void) |
{ |
lcd_cls(); |
get_key_press(KEY_ALL); |
// lcd_printp_at (0, 2, PSTR(" EEProm wirklich"), 0); |
// lcd_printp_at (0, 3, PSTR(" löschen?"), 0); |
// lcd_printp_at (12, 7, PSTR("Ende OK"), 0); |
lcd_puts_at(0, 2, strGet(EEPROM1), 0); |
lcd_puts_at(0, 3, strGet(EEPROM2), 0); |
lcd_puts_at(12, 7, strGet(ENDOK), 0); |
do |
{ |
if (get_key_press (1 << KEY_ENTER)) |
{ |
Delete_EEPROM(); |
clr_V_On(); |
return; |
} |
} |
while (!get_key_press (1 << KEY_ESC)); |
get_key_press(KEY_ALL); |
} |
//-------------------------------------------------------------- |
void PKT_Setup (void) |
{ |
// uint8_t ii = 0; |
// uint8_t Offset = 0; |
// uint8_t size = 0; |
// uint8_t dmode = 0; |
uint8_t target_pos=1; |
// uint8_t val; |
lcd_cls (); |
mmode = 0; |
edit= 0; |
val = 0; |
while(1) |
{ |
size = ITEMS_PKT; |
lcd_cls (); |
lcd_printp_at (0, 0, PSTR(" PKT-Setup "), 2); |
// lcd_printp_at (0, 7, PSTR(KEY_LINE_1), 0); |
lcd_puts_at(0, 7, strGet(KEYLINE1), 0); |
// while(1) |
// { |
// ii = 0; |
// |
// if(Offset > 0) |
// lcd_printp_at(1,1, PSTR("\x12"), 0); |
// |
// for(ii = 0;ii < 6 ; ii++) |
// { |
// if((ii+Offset) < size) |
// lcd_printp_at(3,ii+1,param_menuitems_pkt[ii+Offset][Config.DisplayLanguage], 0); |
// |
// if((ii == 5)&&(ii+Offset < (size-1))) |
// lcd_printp_at(1,6, PSTR("\x13"), 0); |
// |
// } |
// |
// if(dmode == 0) |
// { |
// if(Offset == 0) |
// { |
// if(size > 6) |
// val = menu_choose2 (1, 5, target_pos,0,1); |
// else |
// val = menu_choose2 (1, size, target_pos,0,0); |
// |
// } |
// else |
// val = menu_choose2 (2, 5, target_pos,1,1); |
// |
// } |
// |
// if(dmode == 1) |
// { |
// if(Offset+7 > size) |
// val = menu_choose2 (2, 6, target_pos,1,0); |
// else |
// val = menu_choose2 (2, 5, target_pos,1,1); |
// |
// } |
// |
// if(val == 254) |
// { |
// Offset++; |
// dmode = 1; |
// target_pos = 5; |
// } |
// else if(val == 253) |
// { |
// Offset--; |
// dmode = 0; |
// target_pos = 2; |
// } |
// else if(val == 255) |
// { // Ende mit ESC, speichern |
// if (edit == 1) |
// { |
// WriteParameter(); |
// edit = 0; |
// return; |
// } |
// return; |
// } |
// else |
// break; |
// } |
val = menu_select(param_menuitems_pkt,size,target_pos); |
if (val==255) break; |
target_pos = val; |
// |
// {"Verbindung zum MK","connection to MK "," connexion a MK " ,"Aansluiting op MK"}, |
// {"MK LowBat Warnung","MK LowBat warning","MK LowBat Attent", "MK LoBat alarm "}, |
// {"Anzeige \x1d","Display \x1d","d'affichage \x1d","Display \x1d"}, |
// {"Wi.232 \x1d","Wi.232 \x1d","Wi.232 \x1d","Wi.232 \x1d"}, |
// {"BTM-222 \x1d","BTM-222 \x1d","BTM-222 \x1d","BTM-222 \x1d"}, |
// {"Antennen Track. \x1d","antenna tracking\x1d","antenna tracking\x1d","antenna tracking\x1d"}, |
// {"OSD \x1d","OSD \x1d","OSD \x1d","OSD \x1d"}, |
// {"GPS \x1d","GPS \x1d","GPS \x1d","GPS \x1d"}, |
// "Follow Me \x1d" |
// {"PKT-Akku \x1d","PKT-Accu \x1d","PKT-Accu \x1d","PKT-Accu \x1d"}, |
// {"PKT Update ","PKT Update ","PKT Mise a jour ","PKT Update "}, |
// {"Debug PKT ","Debug PKT ","Debug PKT ","Debug PKT "}, |
// {"EEProm Reset ","EEProm Reset ","EEProm Reinitiali","EEProm Reset "}, |
if((val + offset) == 1) |
{ |
#ifdef HWVERSION3_9 |
Config.U02SV2 = ChangeWi_SV2(Config.U02SV2); |
if (edit == 1) |
PKT_Change = 1; |
#else |
Show_Error_HW12(); |
#endif |
} |
if((val + offset) == 2) Display_Setup(); |
if((val + offset) == 3) |
{ |
#if defined HWVERSION3_9 || defined HWVERSION1_2W || defined HWVERSION1_3W |
if(Config.UseWi == false) |
// Wi_Use(); |
{ |
Config.UseWi = Edit_generic(Config.UseWi,0,1,WI2321,YesNo); |
if (edit==1) |
if (Config.UseWi== true) InitWi232(Config.PKT_Baudrate); |
} |
else |
Wi_Setup(); |
#else |
Show_Error_HW12(); |
#endif |
} |
if((val + offset) == 4) |
{ |
#ifdef HWVERSION3_9 |
if(Config.UseBT == 0) |
{ |
Config.UseBT = Edit_generic(Config.UseBT,0,1,BT1,YesNo); |
if (edit==1) |
if (Config.UseBT == 1) |
{ |
if (bt_init()) Config.BTIsSet = true; else Config.BTIsSet = false; |
// WriteParameter(); |
edit = 0; |
} |
} |
else |
BT_Setup(); |
#else |
Show_Error_HW12(); |
#endif |
} |
if((val + offset) == 5) servo_menu(); |
if((val + offset) == 6) OSD_Setup(); |
#ifdef HWVERSION3_9 |
if((val + offset) == 7) GPS_Setup(); |
if((val + offset) == 8) FollowMe_Setup(); |
if((val + offset) == 9) Joysticks_Setup(); |
if((val + offset) == 10) Accu_Setup(); |
#else |
Show_Error_HW12(); |
#endif |
if((val + offset) == 11) Update_PKT(); |
if((val + offset) == 12) Config.Debug = Edit_generic(Config.Debug,0,1,DEBUGPKT,Show_uint3); |
if((val + offset) == 13) Reset_EEprom(); |
} |
} |
//-------------------------------------------------------------- |
void Display_Setup (void) |
{ |
// uint8_t ii = 0; |
// uint8_t Offset = 0; |
// uint8_t size = 0; |
// uint8_t dmode = 0; |
uint8_t target_pos = 1; |
// uint8_t val; |
lcd_cls (); |
mmode = 0; |
edit= 0; |
LCD_Change = 0; |
// val = 0; |
while(1) |
{ |
size = ITEMS_LCD; |
lcd_cls (); |
lcd_puts_at(0, 0, strGet(DISPLAY1), 2); |
lcd_puts_at(0, 7, strGet(KEYLINE1), 0); |
// while(1) |
// { |
// ii = 0; |
// |
// if(Offset > 0) |
// lcd_printp_at(1, 1, PSTR("\x12"), 0); |
// |
// for(ii = 0; ii < 6 ; ii++) |
// { |
// if((ii + Offset) < size) |
// lcd_printp_at(3, ii + 1, param_menuitems_lcd[ii + Offset][Config.DisplayLanguage], 0); |
// |
// if((ii == 5)&&(ii+Offset < (size - 1))) |
// lcd_printp_at(1,6, PSTR("\x13"), 0); |
// |
// } |
// |
// if(dmode == 0) |
// { |
// if(Offset == 0) |
// { |
// if(size > 6) |
// val = menu_choose2 (1, 5, target_pos,0,1); |
// else |
// val = menu_choose2 (1, size, target_pos,0,0); |
// |
// } |
// else |
// val = menu_choose2 (2, 5, target_pos,1,1); |
// |
// } |
// |
// if(dmode == 1) |
// { |
// if(Offset + 7 > size) |
// val = menu_choose2 (2, 6, target_pos,1,0); |
// else |
// val = menu_choose2 (2, 5, target_pos,1,1); |
// |
// } |
// |
// if(val == 254) |
// { |
// Offset++; |
// dmode = 1; |
// target_pos = 5; |
// } |
// else if(val == 253) |
// { |
// Offset--; |
// dmode = 0; |
// target_pos = 2; |
// } |
// else if(val == 255) |
// { // Ende mit ESC, speichern |
// if (edit == 1) |
// { |
// WriteParameter(); |
// edit = 0; |
// return; |
// } |
// return; |
// } |
// else |
// break; |
// } |
val = menu_select(param_menuitems_lcd,size,target_pos); |
if (val==255) break; |
target_pos = val; |
if((val + offset) == 1) |
Config.PKT_StartInfo = Edit_generic(Config.PKT_StartInfo,0,2,DISPLAY2,OnOff); |
if((val + offset) == 2) |
Config.OSD_RCErrorbeep = Edit_generic(Config.OSD_RCErrorbeep,0,2,DISPLAY9,OnOff); |
if((val + offset) == 3) |
Config.DisplayLanguage = Edit_generic(Config.DisplayLanguage,0,2,DISPLAY3,Language); |
if((val + offset) == 4) |
Config.DisplayTimeout = Edit_generic(Config.DisplayTimeout,0,254,DISPLAY4,Show_uint3); |
if((val + offset) == 5) |
{ |
if (Config.HWSound==0) |
{ |
Config.LCD_Helligkeit = Edit_DisplayHelligkeit(Config.LCD_Helligkeit,0,100,DISPLAY5); |
if (edit == 1) |
if(!LCD_Change) |
LCD_Change =1; |
} |
} |
if((val + offset) == 6) |
Config.LCD_Kontrast = Edit_generic(Config.LCD_Kontrast,0,63,DISPLAY6,Kontrast); |
if (edit == 1) |
if(!LCD_Change) |
LCD_Change =1; |
if((val + offset) == 7) |
{ |
Config.LCD_DisplayMode = Edit_generic(Config.LCD_DisplayMode,0,4,DISPLAY7,NormRev); |
if (edit == 1) |
if(!LCD_Change) |
LCD_Change =1; |
} |
if((val + offset) == 8) |
{ |
Config.LCD_ORIENTATION = Edit_generic(Config.LCD_ORIENTATION,0,4,DISPLAY8,NormRev); |
if (edit == 1) |
if(!LCD_Change) |
LCD_Change =1; |
} |
if((val + offset) == 9) |
{ |
Config.HWSound = Edit_generic(Config.HWSound,0,1,HWSOUND,YesNo); |
} |
if((val + offset) == 10) |
{ |
Config.HWBeeper = Edit_generic(Config.HWBeeper,0,1,HWBEEPER,YesNo); |
} |
if((val + offset) == 11) |
Config.Volume = Edit_generic(Config.Volume,0,50,VOLUME,Show_uint3); |
} |
} |
//-------------------------------------------------------------- |
void Wi_Setup (void) |
{ |
// uint8_t ii = 0; |
// uint8_t Offset = 0; |
// uint8_t size = 0; |
// uint8_t dmode = 0; |
uint8_t target_pos = 1; |
// uint8_t val = 0; |
mmode = 0; |
edit = 0; |
// WiIsSet = true; |
lcd_cls (); |
while(1) |
{ |
size = ITEMS_WI; |
lcd_cls (); |
lcd_printp_at (0, 0, PSTR(" Wi.232 Setup "), 2); |
lcd_puts_at(0, 7, strGet(KEYLINE1), 0); |
// while(1) |
// { |
// ii = 0; |
// |
// if(Offset > 0) |
// lcd_printp_at(1, 1, PSTR("\x12"), 0); |
// |
// for(ii = 0; ii < 6; ii++) |
// { |
// if((ii + Offset) < size) |
// lcd_printp_at(3, ii+1, param_menuitems_wi[ii+Offset][Config.DisplayLanguage], 0); |
// |
// if((ii == 5)&&(ii + Offset < (size - 1))) |
// lcd_printp_at(1, 6, PSTR("\x13"), 0); |
// |
// } |
// |
// if(dmode == 0) |
// { |
// if(Offset == 0) |
// { |
// if(size > 6) |
// val = menu_choose2 (1, 5, target_pos,0,1); |
// else |
// val = menu_choose2 (1, size, target_pos,0,0); |
// |
// } |
// else |
// val = menu_choose2 (2, 5, target_pos,1,1); |
// |
// } |
// |
// if(dmode == 1) |
// { |
// if(Offset + 7 > size) |
// val = menu_choose2 (2, 6, target_pos, 1, 0); |
// else |
// val = menu_choose2 (2, 5, target_pos, 1, 1); |
// |
// } |
// |
// if(val == 254) |
// { |
// Offset++; |
// dmode = 1; |
// target_pos = 5; |
// } |
// else if(val == 253) |
// { |
// Offset--; |
// dmode = 0; |
// target_pos = 2; |
// } |
// else if(val == 255) |
// { // Ende mit ESC, speichern |
// if (edit == 1) |
// { |
// if (Config.UseWi==true) InitWi232(Config.PKT_Baudrate); |
// //Old_Baudrate = PKT_Baudrate; |
// WriteParameter(); |
// edit = 0; |
// } |
// |
// return; |
// } |
// else |
// |
// break; |
// } |
val = menu_select(param_menuitems_wi,size,target_pos); |
if (val==255) |
{ |
if (edit == 1) |
{ |
if (Config.UseWi==true) InitWi232(Config.PKT_Baudrate); |
//Old_Baudrate = PKT_Baudrate; |
// WriteParameter(); |
edit = 0; |
} |
break; |
} |
target_pos = val; |
if((val + offset) == 1) |
{ |
Config.UseWi = Edit_generic(Config.UseWi,0,1,WI2321,YesNo); |
} |
if((val + offset) == 2) |
{ |
Config.WiTXRXChannel = Edit_generic(Config.WiTXRXChannel, 0, 5,WITXRX,Show_uint3); |
} |
if((val + offset) == 3) |
{ |
Config.WiNetworkGroup = Edit_generic(Config.WiNetworkGroup, 0, 127, WINETWG,Show_uint3); |
} |
if((val + offset) == 4) |
{ |
Config.WiNetworkMode = Edit_generic(Config.WiNetworkMode,0,1,WINETWM,Wi_Netmode); |
} |
if((val + offset) == 5) |
{ |
Config.WiTXTO = Edit_generic(Config.WiTXTO,0,127,WITIMEOUT,Show_uint3); |
} |
if((val + offset) == 6) |
{ |
Config.WiUartMTU = Edit_generic(Config.WiUartMTU,0,127,WIUART,Show_uint3); |
} |
if((val + offset) == 7) |
{ |
Old_Baudrate = Config.PKT_Baudrate; |
Config.PKT_Baudrate = Edit_generic(Config.PKT_Baudrate,1,6,PKT_BAUDRATE,Baudrate); |
Wi232_New_Baudrate = Config.PKT_Baudrate; |
BT_New_Baudrate = Config.PKT_Baudrate; |
if (edit==1) |
{ if (Config.UseBT==true) { set_BTOn(); bt_setbaud(BT_New_Baudrate); set_BTOff();} |
if (Config.UseWi==true) InitWi232(Wi232_New_Baudrate); |
// WriteParameter(); |
Old_Baudrate = Config.PKT_Baudrate; |
edit = 0; |
} |
} |
if((val + offset) == 8) |
InitWi232(Config.PKT_Baudrate); |
if((val + offset) == 9) |
Port_USB2CFG_Wi(); |
} |
} |
uint8_t Edit_String(const char *data, const uint8_t length, uint8_t type, const char *Text) |
{ |
uint8_t y = 1; |
uint8_t x = 1; |
uint8_t I = 0; |
lcd_cls(); |
lcd_printp_at (0, 0, Text, 2); |
for (uint8_t i = 0; i < length; i++) |
{ |
lcd_putc (y++, 3, data[i], 0); |
lcd_printp_at (y++, 3, PSTR(" "), 0); |
EditString[i] = data[i]; |
} |
lcd_rect ((x*6)-3, (8*3)-2, 10, 10, 1); |
lcd_printp_at (0, 6, PSTR(" C"), 0); |
lcd_printp_at (0, 7, PSTR(" \x17 \x16 \x19 OK"), 0); |
do |
{ |
if (type == 1) // Name |
{ |
for (uint8_t i = bt_name_length; i > 0; i--) |
{ |
if (EditString[i - 1] != ' ') |
{ |
bt_name_len = i; |
break; |
} |
} |
if ((get_key_press (1 << KEY_PLUS) || get_key_long_rpt_sp ((1 << KEY_PLUS), 2)) && EditString[I] < 'z') |
{ |
EditString[I]++; |
if (EditString[I] >= 0x00 && EditString[I] < ' ') |
EditString[I] = ' '; |
if (EditString[I] > ' ' && EditString[I] < '0') |
EditString[I] = '0'; |
if (EditString[I] > '9' && EditString[I] < 'A') |
EditString[I] = 'A'; |
if (EditString[I] > 'Z' && EditString[I] < 'a') |
EditString[I] = 'a'; |
lcd_putc (x, 3, EditString[I], 0); |
edit = 1; |
} |
if ((get_key_press (1 << KEY_MINUS) || get_key_long_rpt_sp ((1 << KEY_MINUS), 2)) && EditString[I] > ' ') |
{ |
EditString[I]--; |
if (EditString[I] < 'a' && EditString[I] > 'Z') |
EditString[I] = 'Z'; |
if (EditString[I] < 'A' && EditString[I] > '9') |
EditString[I] = '9'; |
if (EditString[I] < '0' && EditString[I] > ' ') |
EditString[I] = ' '; |
lcd_putc (x, 3, EditString[I], 0); |
edit = 1; |
} |
} |
else if (type == 2) // PIN |
{ |
if ((get_key_press (1 << KEY_PLUS) || get_key_long_rpt_sp ((1 << KEY_PLUS), 1)) && (EditString[I] < '9')) |
{ |
EditString[I]++; |
if (EditString[I] >= 0x00 && EditString[I] < ' ') |
EditString[I] = ' '; |
if (EditString[I] > ' ' && EditString[I] < '0') |
EditString[I] = '0'; |
lcd_putc (x, 3, EditString[I], 0); |
edit = 1; |
} |
if ((get_key_press (1 << KEY_MINUS) || get_key_long_rpt_sp ((1 << KEY_MINUS), 1)) && (EditString[I] > '0')) |
{ |
EditString[I]--; |
if (EditString[I] < 'A' && EditString[I] > '9') |
EditString[I] = '9'; |
lcd_putc (x, 3, EditString[I], 0); |
edit = 1; |
} |
} |
if (get_key_long (1 << KEY_ESC)) |
{ |
if (type == 1) // Name |
EditString[I] = ' '; // Zeichen l�schen |
else if (type == 2) // Pin |
EditString[I] = '0'; // Zeichen setzen |
lcd_putc (x, 3, EditString[I], 0); |
edit = 1; |
} |
if (get_key_short (1 << KEY_ESC)) |
{ |
if (type == 1) |
length_tmp = bt_name_length; |
else if (type == 2) |
length_tmp = bt_pin_length; |
if ((x / 2) + 2 > length_tmp) |
{ |
lcd_rect ((x*6)-3, (8*3)-2, 10, 10, 0); |
x = 1; |
lcd_rect ((x*6)-3, (8*3)-2, 10, 10, 1); |
I = 0; |
} |
else |
{ |
lcd_rect ((x*6)-3, (8*3)-2, 10, 10, 0); |
x++; |
x++; |
lcd_rect ((x*6)-3, (8*3)-2, 10, 10, 1); |
I++; //Zeiger auf Zeichen |
} |
} |
} |
while (!get_key_press (1 << KEY_ENTER)); |
{ |
return 1; |
} |
} |
void BT_SelectDevice (void) |
{ |
uint8_t ii = 0; |
uint8_t Offset = 0; |
uint8_t size = 0; |
uint8_t dmode = 0; |
uint8_t target_pos = 1; |
uint8_t val = 0; |
mmode = 0; |
edit = 0; |
lcd_cls (); |
while(1) |
{ |
size = bt_devicecount; |
lcd_cls (); |
lcd_printp_at (0, 0, PSTR(" BT select Device "), 2); |
lcd_puts_at(0, 7, strGet(KEYLINE1), 0); |
while(1) |
{ |
ii = 0; |
if(Offset > 0) |
lcd_printp_at(1, 1, PSTR("\x12"), 0); |
for(ii = 0; ii < 6; ii++) |
{ |
if((ii + Offset) < size) |
{ |
if (strncmp (device_list[ii + Offset].mac, Config.gps_UsedMac, 14) == 0) |
{ |
lcd_puts_at(3, ii+1, device_list[ii + Offset].DevName, 2); |
// lcd_puts_at(3, 4, strGet(KEYLINE1), 0); |
} |
else |
{ |
lcd_puts_at(3, ii+1, device_list[ii + Offset].DevName, 0); |
// lcd_puts_at(3, 5, strGet(KEYLINE1), 0); |
} |
} |
if((ii == 5)&&(ii + Offset < (size - 1))) |
lcd_printp_at(1, 6, PSTR("\x13"), 0); |
} |
if(dmode == 0) |
{ |
if(Offset == 0) |
{ |
if(size > 6) |
val = menu_choose2 (1, 5, target_pos,0,1); |
else |
val = menu_choose2 (1, size, target_pos,0,0); |
} |
else |
val = menu_choose2 (2, 5, target_pos,1,1); |
} |
if(dmode == 1) |
{ |
if(Offset + 7 > size) |
val = menu_choose2 (2, 6, target_pos, 1, 0); |
else |
val = menu_choose2 (2, 5, target_pos, 1, 1); |
} |
if(val == 254) |
{ |
Offset++; |
dmode = 1; |
target_pos = 5; |
} |
else if(val == 253) |
{ |
Offset--; |
dmode = 0; |
target_pos = 2; |
} |
else if(val == 255) |
{ // Ende mit ESC, speichern |
if (edit == 1) |
{ |
// WriteParameter(); |
edit = 0; |
} |
return; |
} |
else |
break; |
} |
target_pos = val; |
if(val > 0 ) |
{ |
for(uint8_t i = 0; i < 14; i++) |
{ |
Config.gps_UsedMac[i] = device_list[val-1].mac[i]; |
} |
for(uint8_t i = 0; i < 20; i++) |
{ |
Config.gps_UsedDevName[i] = device_list[val-1].DevName[i]; |
} |
edit = 1; |
} |
} |
} |
//-------------------------------------------------------------- |
// |
void BT_Setup (void) |
{ |
// uint8_t ii = 0; |
uint8_t z = 0; |
// uint8_t Offset = 0; |
// uint8_t size = 0; |
// uint8_t dmode = 0; |
uint8_t target_pos = 1; |
// uint8_t val; |
char string[20]; |
mmode = 0; |
edit = 0; |
// val = 0; |
// BTIsSet = true; |
lcd_cls (); |
while(1) |
{ |
size = ITEMS_BT; |
lcd_cls (); |
lcd_puts_at(0, 0, strGet(BT1), 2); |
lcd_puts_at(0, 7, strGet(KEYLINE1), 0); |
// while(1) |
// { |
// ii = 0; |
// |
// if(Offset > 0) |
// lcd_printp_at(1,1, PSTR("\x12"), 0); |
// |
// for(ii = 0; ii < 6; ii++) |
// { |
// if((ii + Offset) < size) |
// { |
// lcd_printp_at(3, ii + 1, param_menuitems_bt[ii+Offset][Config.DisplayLanguage], 0); |
// if ((ii+Offset)==5) |
// { |
// for (uint8_t i = 0; i < RE_ID_length; i++) |
// { |
// lcd_putc (10+i, ii+1, Config.RE_ID[i], 0); |
// |
// } |
// } |
// } |
// |
// |
// if((ii == 5) && (ii + Offset < (size - 1))) |
// lcd_printp_at(1,6, PSTR("\x13"), 0); |
// |
// } |
// |
// if(dmode == 0) |
// { |
// if(Offset == 0) |
// { |
// if(size > 6) |
// val = menu_choose2 (1, 5, target_pos, 0, 1); |
// else |
// val = menu_choose2 (1, size, target_pos, 0, 0); |
// |
// } |
// else |
// val = menu_choose2 (2, 5, target_pos, 1, 1); |
// |
// } |
// |
// if(dmode == 1) |
// { |
// if(Offset + 7 > size) |
// val = menu_choose2 (2, 6, target_pos, 1, 0); |
// else |
// val = menu_choose2 (2, 5, target_pos, 1, 1); |
// } |
// |
// if(val == 254) |
// { |
// Offset++; |
// dmode = 1; |
// target_pos = 5; |
// } |
// else if(val == 253) |
// { |
// Offset--; |
// dmode = 0; |
// target_pos = 2; |
// } |
// else if(val == 255) |
// { // Ende mit ESC, speichern |
// if (edit == 1) |
// { |
// if (Config.UseBT == 1); |
// if (bt_init()) Config.BTIsSet = true; else Config.BTIsSet = false; |
// WriteParameter(); |
// return; |
// } |
// return; |
// } |
// else |
// break; |
// } |
val = menu_select(param_menuitems_bt,size,target_pos); |
if (val==255) |
{ |
if (edit == 1) |
{ |
if (Config.UseBT == 1); |
if (bt_init()) Config.BTIsSet = true; else Config.BTIsSet = false; |
} |
break; |
} |
target_pos = val; |
if((val + offset) == 1) |
Config.UseBT = Edit_generic(Config.UseBT,0,1,BT4,YesNo); |
if((val + offset) == 2) |
{ |
for (uint8_t i = 0; i < bt_name_length; i++) |
{ |
string[i] = Config.bt_name[i]; |
} |
string[bt_name_length] = 0; |
Edit_String(string, bt_name_length, 1, PSTR(" Bluetooth Name ")); |
if (edit == 1) |
{ |
for (uint8_t i = 0; i < bt_name_len; i++) |
{ |
Config.bt_name[i] = EditString[i]; |
// WriteParameter(); |
} |
if (bt_name_len < 10) |
{ |
for (uint8_t i = bt_name_len; i < 10; i++) |
{ |
Config.bt_name[i] = ' '; |
// WriteParameter(); |
} |
} |
} |
} |
if((val + offset) == 3) |
{ |
for (uint8_t i = 0; i < bt_pin_length; i++) |
{ |
string[i] = Config.bt_pin[i]; |
} |
string[bt_pin_length] = 0; |
Edit_String(string, bt_pin_length, 2, PSTR(" Bluetooth Pin ")); |
if (edit == 1) |
{ |
for (uint8_t i = 0; i < bt_pin_length; i++) |
{ |
Config.bt_pin[i] = EditString[i]; |
// WriteParameter(); |
} |
} |
} |
if((val + offset) == 4) |
{ |
// if (edit == 1) |
// if(BTIsSet) |
// BTIsSet = false; |
if (bt_init() == true) |
{ |
lcd_printp_at (0, 3, PSTR("BT Init ok"), 0); |
WriteBTInitFlag(); |
} |
else |
{ |
lcd_printp_at (0, 3, PSTR("BT Init Error"), 0); |
Config.BTIsSet = false; |
set_beep ( 1000, 0x0040, BeepNormal); |
} |
} |
if((val + offset) == 5) |
{ |
lcd_cls (); |
lcd_printp_at (0, 0, PSTR(" BTM-222 MAC-Adresse "), 2); |
lcd_puts_at(18, 7, strGet(OK), 0); |
lcd_printp_at (0, 4, PSTR("MAC:"), 0); |
z = 0; |
for(uint8_t i = 0; i < 13; i++) |
{ |
lcd_putc (z, 5, Config.bt_Mac[i],0); |
if ((i%2==1)&&(i<11)) |
{ |
z++; |
lcd_printp_at(z, 5, PSTR(":"),0); |
} |
z++; |
} |
while (!get_key_press (1 << KEY_ENTER)); |
} |
if((val + offset) == 6) |
{ |
for (uint8_t i = 0; i < RE_ID_length; i++) |
{ |
string[i] = Config.RE_ID[i]; |
} |
string[RE_ID_length] = 0; |
Edit_String(string, RE_ID_length, 2, PSTR(" RE-ID Notiz ")); |
if (edit == 1) |
{ |
for (uint8_t i = 0; i < RE_ID_length; i++) |
{ |
Config.RE_ID[i] = EditString[i]; |
// WriteParameter(); |
} |
} |
} |
if((val + offset) == 7) |
Port_FC2CFG_BT(); |
} |
} |
void GPS_Setup (void) |
{ |
// uint8_t ii = 0; |
// uint8_t Offset = 0; |
// uint8_t size = 0; |
// uint8_t dmode = 0; |
uint8_t target_pos = 1; |
// uint8_t val; |
uint8_t BT_WhasOn = 0; |
uint8_t status; |
// uint16_t uart_bytes; |
mmode = 0; |
edit = 0; |
val = 0; |
lcd_cls (); |
while(1) |
{ |
size = ITEMS_GPS; |
lcd_cls (); |
lcd_puts_at(0, 0, strGet(GPS1), 2); |
lcd_puts_at(0, 7, strGet(KEYLINE1), 0); |
// while(1) |
// { |
// ii = 0; |
// |
// if(Offset > 0) |
// lcd_printp_at(1,1, PSTR("\x12"), 0); |
// |
// for(ii = 0; ii < 6; ii++) |
// { |
// if((ii + Offset) < size) |
// lcd_printp_at(3, ii + 1, param_menuitems_GPS[ii+Offset][Config.DisplayLanguage], 0); |
// |
// if((ii == 5) && (ii + Offset < (size - 1))) |
// lcd_printp_at(1,6, PSTR("\x13"), 0); |
// |
// } |
// |
// if(dmode == 0) |
// { |
// if(Offset == 0) |
// { |
// if(size > 6) |
// val = menu_choose2 (1, 5, target_pos, 0, 1); |
// else |
// val = menu_choose2 (1, size, target_pos, 0, 0); |
// |
// } |
// else |
// val = menu_choose2 (2, 5, target_pos, 1, 1); |
// |
// } |
// |
// if(dmode == 1) |
// { |
// if(Offset + 7 > size) |
// val = menu_choose2 (2, 6, target_pos, 1, 0); |
// else |
// val = menu_choose2 (2, 5, target_pos, 1, 1); |
// } |
// |
// if(val == 254) |
// { |
// Offset++; |
// dmode = 1; |
// target_pos = 5; |
// } |
// else if(val == 253) |
// { |
// Offset--; |
// dmode = 0; |
// target_pos = 2; |
// } |
// else if(val == 255) |
// { // Ende mit ESC, speichern |
// if (edit == 1) |
// { |
// WriteParameter(); |
// if (BT_WhasOn) |
// { |
// set_BTOn(); |
//// bt_set_mode(SLAVE); |
// bt_init(); |
// set_BTOff(); |
// } |
// |
// return; |
// } |
// return; |
// } |
// else |
// break; |
// } |
val = menu_select(param_menuitems_GPS,size,target_pos); |
if (val==255) |
{ |
if (edit == 1) |
{ |
// WriteParameter(); |
if (BT_WhasOn) |
{ |
set_BTOn(); |
// bt_set_mode(SLAVE); |
bt_init(); |
set_BTOff(); |
} |
} |
break; |
} |
target_pos = val; |
// |
// {"Suche GPS Maus ","search GPS mouse ","search GPS mouse ","search GPS mouse "}, |
// {"GPS Maus Typ ","GPS mouse typ ","GPS mouse typ ","GPS mouse typ "}, |
// {"GPS Maus aktiv? ","GPS mouse activ? ","GPS mouse activ? ","GPS mouse activ? "}, |
// {"Zeige GPS Device ","show GPS device ","show GPS device ","show GPS device "}, |
// |
if((val + offset) == 1) |
{ |
if (bt_devicecount ==0) |
{ |
lcd_cls (); |
lcd_printp_at (0, 0, PSTR("wähle BT Device"), 0); |
set_BTOn(); |
BT_WhasOn = true; |
// _delay_ms(2000); |
bt_downlink_init(); |
bt_searchDevice(); |
set_BTOff(); |
BT_SelectDevice(); |
} |
else |
BT_SelectDevice(); |
// if (edit == 1) WriteParameter(); |
} |
if((val + offset) == 2) |
{ |
lcd_cls (); |
lcd_printp_at (0, 0, PSTR("suche BT Device"), 0); |
set_BTOn(); |
BT_WhasOn = true; |
bt_downlink_init(); |
bt_searchDevice(); |
set_BTOff(); |
BT_SelectDevice(); |
} |
if((val + offset) == 3) |
{ |
Config.gps_UsedGPSMouse = Edit_generic(Config.gps_UsedGPSMouse,0,1,GPS_MOUSETYP,GPSMOUSE); |
if (edit == 1) { |
// WriteParameter(); |
edit = 0; |
} |
} |
if((val + offset) == 4) |
{ |
Config.gps_UseGPS = Edit_generic(Config.gps_UseGPS,0,1,GPS3,YesNo); |
if (edit == 1) { |
// WriteParameter(); |
edit = 0; |
} |
} |
if((val + offset) == 5) |
{ |
lcd_cls (); |
lcd_puts_at(0, 0, strGet(GPS2), 2); |
lcd_puts_at(18, 7, strGet(OK), 0); |
lcd_printp_at (0, 1, PSTR("Device:"), 0); |
lcd_printp_at (0, 4, PSTR("MAC:"), 0); |
lcd_puts_at (0, 2,Config.gps_UsedDevName, 0); |
for(uint8_t i = 0; i < 12; i++) |
{ |
lcd_putc (i, 5, Config.gps_UsedMac[i],0); |
} |
while (!get_key_press (1 << KEY_ENTER)); |
} |
if((val + offset) == 6) |
{ |
get_key_press(KEY_ALL); |
lcd_cls (); |
lcd_puts_at(18, 7, strGet(OK), 0); |
lcd_puts_at (0, 0,Config.gps_UsedDevName, 2); |
set_BTOn(); |
BT_WhasOn = true; |
if (Config.BTIsSlave==true) |
{ |
bt_downlink_init(); |
} |
lcd_printp_at (0, 1, PSTR("try to connect"), 0); |
status = bt_connect(Config.gps_UsedMac); |
lcd_printp_at (0, 2, PSTR("connect status"), 0); |
write_ndigit_number_u (14, 2, status, 2, 0,0); |
if (status==true) |
{ |
lcd_printp_at (0, 1, PSTR("connected "), 0); |
receiveNMEA = true; |
} |
else |
{ |
lcd_printp_at (0, 2, PSTR("connect Error"), 0); |
write_ndigit_number_u (14, 2, status, 2, 0,0); |
} |
//---OG:BEGIN--- |
if (receiveNMEA==true) |
{ |
lcd_cls(); |
// BT-Device Name |
lcd_puts_at(0, 0,Config.gps_UsedDevName, 2); |
// Labels |
lcd_printp_at( 0, 1, PSTR("Sat: "), 0); |
lcd_printp_at(11, 1, PSTR("XErr: "), 0); |
lcd_printp_at( 0, 2, PSTR("Fix: "), 0); |
lcd_printp_at(11, 2, PSTR("HDOP: "), 0); |
lcd_printp_at( 0, 3, PSTR(" Latitude Longitude"), 2); |
lcd_printp_at( 0, 6, PSTR("Alt: "), 0); |
// Bottom-Line: OK |
lcd_puts_at(18, 7, strGet(OK), 0); |
bt_rx_ready = 0; |
do |
{ |
CheckGPS = true; |
if (!bt_receiveNMEA()){ receiveNMEA = false; break;} |
Tracking_NMEA(); |
//--------------------------------------------------------------------- |
// Line 1 L: Sat-Anzahl |
write_ndigit_number_u (5, 1, NMEAsatsInUse, 2, 0,0); |
// Line 1 R: BT RX Error's |
write_ndigit_number_u (17, 1, bt_rxerror, 4, 0,0); |
//--------------------------------------------------------------------- |
// Line 2 L: Fix |
write_ndigit_number_u (5, 2, posfix, 2, 0,0); |
// Line 2 R: HDOP |
if( HDOP == 0 ) |
lcd_printp_at(16, 2, PSTR(" ---"), 0); |
else |
write_ndigit_number_u_10th (16, 2, HDOP, 4, 0,0); |
//--------------------------------------------------------------------- |
// Line 4 L: Latitude |
write_ndigit_number_u (1, 4, (uint16_t)(NMEAlatitude/10000000), 2, 0,0); |
lcd_printp_at (3, 4, PSTR("."), 0); |
write_ndigit_number_u (4, 4, (uint16_t)((NMEAlatitude/1000) % 10000), 4, 1,0); |
write_ndigit_number_u (8, 4, (uint16_t)((NMEAlatitude/10) % 100), 2, 1,0); |
// Line 4 R: Longitude |
write_ndigit_number_u (12, 4, (uint16_t)(NMEAlongitude/10000000), 2, 0,0); |
lcd_printp_at (14, 4, PSTR("."), 0); |
write_ndigit_number_u (15, 4, (uint16_t)((NMEAlongitude/1000) % 10000), 4, 1,0); |
write_ndigit_number_u (19, 4, (uint16_t)((NMEAlongitude/10) % 100), 2, 1,0); |
//--------------------------------------------------------------------- |
// Line 6 L: Altitude |
write_ndigit_number_u_10th (5, 6, NMEAaltitude, 5, 0,0); |
lcd_printp_at (11, 6, PSTR("m"), 0); |
// Line 6 R: GPS Time |
lcd_puts_at (13, 6, NMEAtime, 0); |
//--------------------------------------------------------------------- |
} while (!get_key_press (1 << KEY_ENTER) || !receiveNMEA==true); |
CheckGPS = false; |
lcd_cls(); |
if (!receiveNMEA) { |
lcd_printp_at (0, 1, PSTR("lost BT data"), 0); |
set_beep ( 400, 0x0080, BeepNormal); |
} |
lcd_printp_at (0, 3, PSTR("GPS trennen"), 0); |
lcd_printp_at (0, 4, PSTR("bitte warten..."), 0); |
} |
else |
{ |
lcd_printp_at (0, 3, PSTR("Error connecting!"), 0); |
while (!get_key_press (1 << KEY_ENTER)); |
} |
receiveNMEA = false; |
CheckGPS = false; |
if (!bt_disconnect()) lcd_printp_at (0, 3, PSTR("Error disconnecting!"), 0); |
//---OG:END--- |
// if (receiveNMEA==true) |
// { |
// lcd_printp_at (0, 3, PSTR(" Latitude Longitude"), 2); |
// bt_rx_ready = 0; |
// do |
// { |
// CheckGPS = true; |
// if (!bt_receiveNMEA()){ receiveNMEA = false; break;} |
// |
// |
// Tracking_NMEA(); |
// |
// |
// write_ndigit_number_u (1, 4, (uint16_t)(NMEAlatitude/10000000), 2, 0,0); |
// lcd_printp_at (3, 4, PSTR("."), 0); |
// write_ndigit_number_u (4, 4, (uint16_t)((NMEAlatitude/1000) % 10000), 4, 1,0); |
// write_ndigit_number_u (8, 4, (uint16_t)((NMEAlatitude/10) % 100), 2, 1,0); |
// |
// |
// write_ndigit_number_u (12, 4, (uint16_t)(NMEAlongitude/10000000), 2, 0,0); |
// lcd_printp_at (14, 4, PSTR("."), 0); |
// write_ndigit_number_u (15, 4, (uint16_t)((NMEAlongitude/1000) % 10000), 4, 1,0); |
// write_ndigit_number_u (19, 4, (uint16_t)((NMEAlongitude/10) % 100), 2, 1,0); |
// lcd_printp_at (0, 2, PSTR("GPS Time: "), 0); |
// lcd_puts_at (10, 2, NMEAtime, 0); |
// lcd_printp_at (0, 6, PSTR("Satellite: "), 0); |
// write_ndigit_number_u (11, 6, NMEAsatsInUse, 2, 1,0); |
// lcd_printp_at (0, 5, PSTR("Fix: "), 0); |
// write_ndigit_number_u (5, 5, posfix, 1, 1,0); |
// lcd_printp_at (8, 5, PSTR("HDOP: "), 0); |
// write_ndigit_number_u_10th (14, 5, HDOP, 4, 0,0); |
// lcd_printp_at (0, 7, PSTR("Alitude: "), 0); |
// write_ndigit_number_u_10th (9, 7, NMEAaltitude, 5, 0,0); |
// lcd_printp_at (15, 7, PSTR("m"), 0); |
// lcd_printp_at (0, 1, PSTR(" BT RX Error: "), 0); |
// write_ndigit_number_u (13, 1, bt_rxerror, 3, 1,0); |
//// write_ndigit_number_u (13, 1, UART1_RxError, 5, 1,0); |
// |
//// uart_bytes = uart1_available(); |
//// lcd_printp_at (0, 1, PSTR(" UartAvail: "), 0); |
//// write_ndigit_number_u (13, 1,uart_bytes , 4, 1,0); |
// } |
// |
// |
// while (!get_key_press (1 << KEY_ENTER) || !receiveNMEA==true); |
// |
// CheckGPS = false; |
// lcd_cls_line(0,1,21); |
// lcd_cls_line(0,2,21); |
// lcd_cls_line(0,3,21); |
// lcd_cls_line(0,4,21); |
// lcd_cls_line(0,5,21); |
// lcd_cls_line(0,6,21); |
// lcd_cls_line(0,7,21); |
// if (!receiveNMEA) lcd_printp_at (0, 2, PSTR("lost BT data"), 0); |
// lcd_printp_at (0, 3, PSTR("GPS trennen"), 0); |
// lcd_printp_at (0, 4, PSTR("bitte warten"), 0); |
// } |
// else |
// { |
// lcd_printp_at (0, 4, PSTR("Error at connecting"), 0); |
// while (!get_key_press (1 << KEY_ENTER)); |
// } |
// receiveNMEA = false; |
// CheckGPS = false; |
// if (!bt_disconnect()) lcd_printp_at (0, 3, PSTR("Fehler beim Trennen"), 0); |
set_BTOff(); |
} |
} |
} |
//-------------------------------------------------------------- |
uint8_t Edit_PKT_Accu(uint8_t Value, uint8_t min, uint8_t max) |
{ |
Pre = Value; |
lcd_cls(); |
// lcd_printp_at (0, 2, Text, 0); |
lcd_puts_at(0, 2, strGet(LIPO2), 0); |
switch (Value) |
{ |
case false :lcd_printp_at (15, 2, PSTR("LiIo"), 0); |
break; |
case true :lcd_printp_at (15, 2, PSTR("LiPo"), 0); |
break; |
break; |
} |
lcd_puts_at(0, 7, strGet(KEYLINE2), 0); |
do |
{ |
if ((get_key_press (1 << KEY_PLUS)) && (Value == 0)) |
{ |
Value = 1; |
lcd_printp_at (15, 2, PSTR("LiPo"), 0); |
} |
if ((get_key_press (1 << KEY_MINUS)) && (Value == 1)) |
{ |
Value = 0; |
lcd_printp_at (15, 2, PSTR("LiIo"), 0); |
} |
if (get_key_press (1 << KEY_ENTER)) |
{ |
edit = 1; |
Config.PKT_Accutyp = Value; |
return Value; |
} |
} |
while (!get_key_press (1 << KEY_ESC)); |
{ |
get_key_press(KEY_ALL); |
edit = 0; |
Config.PKT_Accutyp = Pre; |
return Pre; |
} |
} |
//-------------------------------------------------------------- |
uint16_t Edit_LipoOffset(uint16_t Value, uint16_t min, uint16_t max) |
{ |
lcd_cls(); |
lcd_puts_at(0, 2, strGet(LIPO3), 0); |
lcd_puts_at(0, 5, strGet(LIPO5), 0); |
lcd_puts_at(0, 6, strGet(LIPO6), 0); |
Pre16 = Value; |
write_ndigit_number_u (16, 2, Value, 4, 0,0); |
lcd_puts_at(0, 7, strGet(KEYLINE2), 0); |
do |
{ |
if ((get_key_press (1 << KEY_PLUS) || get_key_long_rpt_sp ((1 << KEY_PLUS), 2)) && (Value < max-10)) |
{ |
edit = 1; |
Value = Value +10; |
Config.Lipo_UOffset = Value; |
write_ndigit_number_u (16, 2,Value, 4, 0,0); |
} |
if ((get_key_press (1 << KEY_MINUS) || get_key_long_rpt_sp ((1 << KEY_MINUS), 2)) && (Value > min)) |
{ |
edit = 1; |
Value=Value -10; |
Config.Lipo_UOffset = Value; |
write_ndigit_number_u (16, 2,Value, 4, 0,0); |
} |
if (get_key_press (1 << KEY_ENTER)) |
return Value; |
show_Lipo(); |
write_ndigit_number_u_100th(8, 3, volt_avg, 0, 0); |
lcd_printp_at(3, 3, PSTR("Volt"), 0); |
} |
while (!get_key_press (1 << KEY_ESC)); |
{ |
get_key_press(KEY_ALL); |
edit = 0; |
Config.Lipo_UOffset = Pre16; |
return Pre16; |
} |
} |
//-------------------------------------------------------------- |
void Accu_Setup (void) |
{ |
// uint8_t ii = 0; |
// uint8_t Offset = 0; |
// uint8_t size = 0; |
// uint8_t dmode = 0; |
uint8_t target_pos = 1; |
// uint8_t val; |
mmode = 0; |
edit = 0; |
val = 0; |
lcd_cls (); |
while(1) |
{ |
size = ITEMS_Accu; |
lcd_cls (); |
lcd_puts_at(0, 0, strGet(LIPO1), 2); |
lcd_puts_at(0, 7, strGet(KEYLINE1), 0); |
// while(1) |
// { |
// ii = 0; |
// |
// if(Offset > 0) |
// lcd_printp_at(1,1, PSTR("\x12"), 0); |
// |
// for(ii = 0; ii < 6; ii++) |
// { |
// if((ii + Offset) < size) |
// lcd_printp_at(3, ii + 1, param_menuitems_Accu[ii+Offset][Config.DisplayLanguage], 0); |
// |
// if((ii == 5) && (ii + Offset < (size - 1))) |
// lcd_printp_at(1,6, PSTR("\x13"), 0); |
// |
// } |
// |
// if(dmode == 0) |
// { |
// if(Offset == 0) |
// { |
// if(size > 6) |
// val = menu_choose2 (1, 5, target_pos, 0, 1); |
// else |
// val = menu_choose2 (1, size, target_pos, 0, 0); |
// |
// } |
// else |
// val = menu_choose2 (2, 5, target_pos, 1, 1); |
// |
// } |
// |
// if(dmode == 1) |
// { |
// if(Offset + 7 > size) |
// val = menu_choose2 (2, 6, target_pos, 1, 0); |
// else |
// val = menu_choose2 (2, 5, target_pos, 1, 1); |
// } |
// |
// if(val == 254) |
// { |
// Offset++; |
// dmode = 1; |
// target_pos = 5; |
// } |
// else if(val == 253) |
// { |
// Offset--; |
// dmode = 0; |
// target_pos = 2; |
// } |
// else if(val == 255) |
// { // Ende mit ESC, speichern |
// if (edit == 1) |
// { |
// WriteParameter(); |
// edit = 0; |
// return; |
// } |
// return; |
// } |
// else |
// break; |
// } |
val = menu_select(param_menuitems_Accu,size,target_pos); |
if (val==255) break; |
target_pos = val; |
if((val + offset) == 1) |
{ |
Config.PKT_Accutyp= Edit_PKT_Accu(Config.PKT_Accutyp,0,1); |
if (edit == 1) { |
// WriteParameter(); |
edit = 0; |
} |
} |
if((val + offset) == 2) |
{ |
Config.Lipo_UOffset = Edit_LipoOffset(Config.Lipo_UOffset,0,9999); |
if (edit == 1) { |
// WriteParameter(); |
edit = 0; |
} |
} |
} |
} |
//-------------------------------------------------------------- |
uint8_t Edit_LED_Form (uint8_t Value, uint8_t min, uint8_t max, uint8_t Text) |
{ |
Pre = Value; |
lcd_cls(); |
lcd_puts_at(0, 2, strGet(Text), 0); |
switch (Value) |
{ |
case 0x1: |
lcd_circle (14 * 6 + 5, 2 * 8 + 3, 3, 1); // kreis |
lcd_fcircle (16 * 6 + 5, 2 * 8 + 3, 3, 0); // löschen |
lcd_circle (16 * 6 + 5, 2 * 8 + 3, 3, 1); // kreis |
lcd_fcircle (16 * 6 + 5, 2 * 8 + 3, 1, 1); // plus |
break; |
case 0x3 : |
lcd_circle (14 * 6 + 5, 2 * 8 + 3, 3, 1); // kreis |
lcd_fcircle (16 * 6 + 5, 2 * 8 + 3, 3, 1); // schwarz |
break; |
break; |
} |
lcd_puts_at(0, 7, strGet(KEYLINE2), 0); |
do |
{ |
if ((get_key_press (1 << KEY_PLUS)) && (Value == 1)) |
{ |
Value = 3; |
lcd_circle (14 * 6 + 5, 2 * 8 + 3, 3, 1); // kreis |
lcd_fcircle (16 * 6 + 5, 2 * 8 + 3, 3, 1); // schwarz |
} |
if ((get_key_press (1 << KEY_MINUS)) && (Value == 3)) |
{ |
Value = 1; |
lcd_circle (14 * 6 + 5, 2 * 8 + 3, 3, 1); // kreis |
lcd_fcircle (16 * 6 + 5, 2 * 8 + 3, 3, 0); // löschen |
lcd_circle (16 * 6 + 5, 2 * 8 + 3, 3, 1); // kreis |
lcd_fcircle (16 * 6 + 5, 2 * 8 + 3, 1, 1); // plus |
} |
if (get_key_press (1 << KEY_ENTER)) |
{ |
edit = 1; |
Config.OSD_LEDform = Value; |
// WriteParameter(); |
edit = 0; |
return Value; |
} |
} |
while (!get_key_press (1 << KEY_ESC)); |
{ |
get_key_press(KEY_ALL); |
edit = 0; |
Config.OSD_LEDform = Pre; |
return Pre; |
} |
} |
//-------------------------------------------------------------- |
void OSD_Setup (void) |
{ |
// uint8_t ii = 0; |
// uint8_t Offset = 0; |
// uint8_t size = 0; |
// uint8_t dmode = 0; |
uint8_t target_pos = 1; |
// uint8_t val; |
mmode = 0; |
edit = 0; |
val = 0; |
lcd_cls (); |
while(1) |
{ |
size = ITEMS_OSD; |
lcd_cls (); |
lcd_puts_at(0, 0, strGet(OSD_Screen), 2); |
lcd_puts_at(0, 7, strGet(KEYLINE1), 0); |
// while(1) |
// { |
// ii = 0; |
// |
// if(Offset > 0) |
// lcd_printp_at(1,1, PSTR("\x12"), 0); |
// |
// for(ii = 0; ii < 6; ii++) |
// { |
// if((ii + Offset) < size) |
// lcd_printp_at(3, ii + 1, param_menuitems_OSD[ii+Offset][Config.DisplayLanguage], 0); |
// |
// if((ii == 5) && (ii + Offset < (size - 1))) |
// lcd_printp_at(1,6, PSTR("\x13"), 0); |
// |
// } |
// |
// if(dmode == 0) |
// { |
// if(Offset == 0) |
// { |
// if(size > 6) |
// val = menu_choose2 (1, 5, target_pos, 0, 1); |
// else |
// val = menu_choose2 (1, size, target_pos, 0, 0); |
// |
// } |
// else |
// val = menu_choose2 (2, 5, target_pos, 1, 1); |
// |
// } |
// |
// if(dmode == 1) |
// { |
// if(Offset + 7 > size) |
// val = menu_choose2 (2, 6, target_pos, 1, 0); |
// else |
// val = menu_choose2 (2, 5, target_pos, 1, 1); |
// } |
// |
// if(val == 254) |
// { |
// Offset++; |
// dmode = 1; |
// target_pos = 5; |
// } |
// else if(val == 253) |
// { |
// Offset--; |
// dmode = 0; |
// target_pos = 2; |
// } |
// else if(val == 255) |
// { // Ende mit ESC, speichern |
// if (edit == 1) |
// { |
// WriteParameter(); |
// edit = 0; |
// return; |
// } |
// return; |
// } |
// else |
// break; |
// } |
val = menu_select(param_menuitems_OSD,size,target_pos); |
if (val==255) break; |
target_pos = val; |
//4.3.13 CB if((val + Offset) == 1) Config.OSD_ScreenMode = Edit_generic(Config.OSD_ScreenMode, 0, OSD_MaxScreen, OSD_SCREENMODE,Show_uint); |
if((val + offset) == 1) Config.OSD_LEDform = Edit_LED_Form(Config.OSD_LEDform, 1, 3, OSD_LED_Form); |
if((val + offset) == 2) Config.OSD_InvertOut = Edit_generic(Config.OSD_InvertOut, 0, 1, OSD_Invert_Out,YesNo); |
if((val + offset) == 3) Config.OSD_SendOSD = Edit_generic(Config.OSD_SendOSD, 0, 1,OSD_Send_OSD ,YesNo); |
if((val + offset) == 4) Config.OSD_Fallspeed = Edit_generic(Config.OSD_Fallspeed,0,247,FALLSPEED,Show_uint10th); |
if((val + offset) == 5) Config.OSD_VarioBeep = Edit_generic(Config.OSD_VarioBeep,0,1,OSD_VARIOBEEP,YesNo); |
if((val + offset) == 6) Config.OSD_HomeMKView = Edit_generic(Config.OSD_HomeMKView,0,1,OSD_HOMEMKVIEW,YesNo); |
if((val + offset) == 7) Config.MK_LowBat = Edit_generic(Config.MK_LowBat,32,247,LOWBAT,Show_uint10th); |
if((val + offset) == 8) Config.OSD_mAh_Warning = Edit_generic(Config.OSD_mAh_Warning,0,30000,OSD_MAHWARNING, Show_uint5); |
if((val + offset) == 9)Config.OSD_LipoBar = Edit_generic(Config.OSD_LipoBar, 0, 1, OSD_LIPOBAR,YesNo); |
} |
} |
//-------------------------------------------------------------- |
void FollowMe_Setup (void) |
{ |
// uint8_t ii = 0; |
// uint8_t Offset = 0; |
// uint8_t size = 0; |
// uint8_t dmode = 0; |
uint8_t target_pos = 1; |
// uint8_t val; |
mmode = 0; |
edit = 0; |
val = 0; |
lcd_cls (); |
while(1) |
{ |
size = ITEMS_FOLLOWME; |
lcd_cls (); |
lcd_puts_at(0, 0, strGet(FOLLOWME_0), 2); |
lcd_puts_at(0, 7, strGet(KEYLINE1), 0); |
// while(1) |
// { |
// ii = 0; |
// |
// if(Offset > 0) |
// lcd_printp_at(1,1, PSTR("\x12"), 0); |
// |
// for(ii = 0; ii < 6; ii++) |
// { |
// if((ii + Offset) < size) |
// lcd_printp_at(3, ii + 1, param_menuitems_FOLLOWME[ii+Offset][Config.DisplayLanguage], 0); |
// |
// if((ii == 5) && (ii + Offset < (size - 1))) |
// lcd_printp_at(1,6, PSTR("\x13"), 0); |
// |
// } |
// |
// if(dmode == 0) |
// { |
// if(Offset == 0) |
// { |
// if(size > 6) |
// val = menu_choose2 (1, 5, target_pos, 0, 1); |
// else |
// val = menu_choose2 (1, size, target_pos, 0, 0); |
// |
// } |
// else |
// val = menu_choose2 (2, 5, target_pos, 1, 1); |
// |
// } |
// |
// if(dmode == 1) |
// { |
// if(Offset + 7 > size) |
// val = menu_choose2 (2, 6, target_pos, 1, 0); |
// else |
// val = menu_choose2 (2, 5, target_pos, 1, 1); |
// } |
// |
// if(val == 254) |
// { |
// Offset++; |
// dmode = 1; |
// target_pos = 5; |
// } |
// else if(val == 253) |
// { |
// Offset--; |
// dmode = 0; |
// target_pos = 2; |
// } |
// else if(val == 255) |
// { // Ende mit ESC, speichern |
// if (edit == 1) |
// { |
// WriteParameter(); |
// edit = 0; |
// return; |
// } |
// return; |
// } |
// else |
// break; |
// } |
val = menu_select(param_menuitems_FOLLOWME,size,target_pos); |
if (val==255) break; |
target_pos = val; |
if((val + offset) == 1) Config.FM_Refresh = Edit_generic(Config.FM_Refresh, 250, 60000, FOLLOWME_1, Show_uint3); |
if((val + offset) == 2) Config.FM_Speed = Edit_generic(Config.FM_Speed, 0, 100, FOLLOWME_2, Show_uint3); |
if((val + offset) == 3) Config.FM_Radius = Edit_generic(Config.FM_Radius, 1,20, FOLLOWME_3, Show_uint3); |
} |
} |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/setup/setup.h |
---|
0,0 → 1,70 |
/***************************************************************************** |
* Copyright (C) 2008 Thomas Kaiser, thomas@ft-fanpage.de * |
* Copyright (C) 2009 Peter "woggle" Mack, mac@denich.net * |
* Copyright (C) 2011 Christian "Cebra" Brandtner, brandtner@brandtner.net * |
* Copyright (C) 2011 Harald Bongartz * |
* * |
* This program is free software; you can redistribute it and/or modify * |
* it under the terms of the GNU General Public License as published by * |
* the Free Software Foundation; either version 2 of the License. * |
* * |
* This program is distributed in the hope that it will be useful, * |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
* GNU General Public License for more details. * |
* * |
* You should have received a copy of the GNU General Public License * |
* along with this program; if not, write to the * |
* Free Software Foundation, Inc., * |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
* * |
* * |
* Credits to: * |
* Holger Buss & Ingo Busker from mikrokopter.de for the MK project + SVN * |
* http://www.mikrokopter.de * |
* Gregor "killagreg" Stobrawa for his version of the MK code * |
* Thomas Kaiser "thkais" for the original project. See * |
* http://www.ft-fanpage.de/mikrokopter/ * |
* http://forum.mikrokopter.de/topic-4061-1.html * |
* Claas Anders "CaScAdE" Rathje for providing the font and his C-OSD code * |
* http://www.mylifesucks.de/oss/c-osd/ * |
* Harald Bongartz "HaraldB" for providing his Ideas and Code for usibility* |
*****************************************************************************/ |
#ifndef _setup_H |
#define _setup_H |
typedef enum //Varianten für die Anzeige der Werte im Setupmenü |
{ |
Show_uint3,Show_uint5,Show_uint10th,GPSMOUSE,Wi_Netmode,OnOff,YesNo,Orientation,NormRev,Kontrast,Baudrate,Language,Sticktype, |
} EditMode; |
void PKT_Setup (void); |
void Display_Setup (void); |
void Wi_Use (void); |
void Wi_Setup (void); |
void BT_Use (void); |
void BT_Setup (void); |
void Show_Error_HW12(void); |
void Accu_Setup (void); |
void BT_SelectDevice (void); |
void GPS_Setup (void); |
void OSD_Setup (void); |
void FollowMe_Setup (void); |
uint8_t Edit_Language(uint8_t Value, uint8_t min, uint8_t max,uint8_t Text); |
uint16_t Edit_generic(uint16_t Value, uint16_t min, uint16_t max,uint8_t Text, uint8_t what); |
extern uint8_t bt_name_len; |
extern uint8_t length_tmp; |
extern uint8_t Old_Baudrate; //Merkzelle für alte Baudrate |
extern uint8_t edit; |
extern uint8_t CheckGPS; |
#endif |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/sound/.directory |
---|
0,0 → 1,3 |
[Dolphin] |
Timestamp=2013,1,22,0,36,37 |
ViewMode=1 |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/sound/pwmsine8bit.c |
---|
0,0 → 1,278 |
//file pwmsine8bit.c |
//generate 8 bit sinewave using wavetable lookup |
//12khz sample rate, 62500 hz pwm on pd5 oc1a |
//for ere co embmega32 16Mhz 38400 |
//May 3 07 Bob G initial edit 8 bit |
//May 5 07 Bob G add traffic tones |
//Jan 18 08 Bob G compile with 7.15 |
//#include <stdio.h> |
//#include <stdlib.h> |
#include <ctype.h> |
#include <math.h> //sin |
#include <avr/io.h> |
#include <avr/interrupt.h> |
#include <avr/pgmspace.h> |
#include <util/delay.h> |
#include <string.h> |
#include <stdint.h> |
#include "../timer/timer.h" |
//#include "../bluetooth/fifo.h" |
#define INTR_OFF() asm("CLI") |
#define INTR_ON() asm("SEI") |
//------vars in bss------- |
volatile unsigned char sindat[256]; //8 bit sine table |
//unsigned int addat[8]; //internal 10 bit |
unsigned int idesfreq; |
unsigned char iattenfac; //0-255 |
unsigned char dispon; |
unsigned char freqincipart,freqincfpart; |
unsigned char waveptipart,waveptfpart; |
unsigned char tics; |
unsigned char generate; |
float basefreq; |
float freqratio; |
float sampfreq; //12khz |
float samppd; //83.33usec |
float fdesfreq; |
float attendb; //0-50 |
float attenfac; //.999-0 |
const float pi=3.141592654; |
#define MSB(w) ((char*) &w)[1] |
#define LSB(w) ((char*) &w)[0] |
#define TONE_BUFFER_SIZE 64 |
#define TONE_BUFFER_MASK ( TONE_BUFFER_SIZE - 1) |
static volatile unsigned char ToneBuf[TONE_BUFFER_SIZE]; |
static volatile unsigned char ToneBufHead; |
static volatile unsigned char ToneBufTail; |
//------------------------------- |
void cvtfreq2frac(void){ |
//calc freq ratio, separate into integer and fractional parts |
fdesfreq=idesfreq; |
freqratio=fdesfreq/basefreq; //calc freq ratio from basefreq |
freqincipart=(int)freqratio; //calc integer part |
freqincfpart=(freqratio-freqincipart)*256; //calc fractional part |
// cprintf("ipart %02x fpart %02x\n",freqincipart,freqincfpart); |
} |
//------------------------------- |
void cvtdb2fac(void){ |
//cvt db to attenuation factor |
attenfac=pow(10.0,-attendb/20.0); //10^0=1 |
iattenfac=(unsigned char)(attenfac*255.0); |
// cprintf("attenfac %#7.5f\n",attenfac); |
// cprintf("iattenfac %02x\n",iattenfac); |
} |
//------------------------- |
void initsindat(void){ |
//init 8 bit signed sin table 0-ff in ram 36dB s/n 46Hz basefreq |
unsigned int n; |
for(n=0; n < 256; n++){ |
sindat[n]=(signed char)127.0*sin(2.0*pi*n/256.0); //256 sin points |
} |
} |
//------------------------- |
void initvars(void){ |
//init vars |
// sampfreq=12000.0; //hz |
sampfreq=19530.0; //hz |
// printf("samp freq %#7.1f hz\n\r",sampfreq); |
// printf("samp freq %#7.1f hz\n\r",1234567.1); |
samppd=1.0/sampfreq; //83.33usec |
// printf("samppd %#7.1f usec \n\r",samppd*1e6); |
basefreq=sampfreq/256.0; //46.875hz |
// printf("basefreq %#7.5f hz\n\r",basefreq); |
idesfreq=400; |
cvtfreq2frac(); |
cvtdb2fac(); //0db =.9999= 0xff |
} |
//--------------------- |
void tone1(int hz) |
//tone at hz for ms |
{ |
uint8_t volume = 0; |
// TCNT2=0; |
// sound_timer = ms/5; |
// soundpause_timer = soundpause/5; |
idesfreq=hz; |
cvtfreq2frac(); |
attendb=volume; |
cvtdb2fac(); |
if (hz ==0) generate=0; |
else { generate = 1; |
// TIMSK2 |= _BV(TOIE2); // Interrupt freigeben |
} |
} |
//------------------------------- |
void tone_handler(void) // wird aus Timerinterrupt aufgerufen |
{ |
uint16_t f_Hz=0; |
uint16_t dur_ms=0; |
char volume=0; |
char tmp_high = 0; |
char tmp_low = 0; |
unsigned char tmptail; |
if ( ToneBufHead != ToneBufTail) { |
/* calculate and store new buffer index */ |
tmptail = (ToneBufTail + 1) & TONE_BUFFER_MASK; |
ToneBufTail = tmptail; |
/* get one byte from buffer */ |
tmp_low = ToneBuf[tmptail]; /* f_Hz low */ |
}else{ |
return; |
} |
if ( ToneBufHead != ToneBufTail) { |
/* calculate and store new buffer index */ |
tmptail = (ToneBufTail + 1) & TONE_BUFFER_MASK; |
ToneBufTail = tmptail; |
/* get one byte from buffer */ |
tmp_high = ToneBuf[tmptail]; /* f_Hz high */ |
}else{ |
return; |
} |
f_Hz = (((uint16_t) tmp_high) << 8) | tmp_low; |
if ( ToneBufHead != ToneBufTail) { |
/* calculate and store new buffer index */ |
tmptail = (ToneBufTail + 1) & TONE_BUFFER_MASK; |
ToneBufTail = tmptail; |
/* get one byte from buffer*/ |
volume = ToneBuf[tmptail]; /* volume */ |
}else{ |
return; |
} |
if ( ToneBufHead != ToneBufTail) { |
/* calculate and store new buffer index */ |
tmptail = (ToneBufTail + 1) & TONE_BUFFER_MASK; |
ToneBufTail = tmptail; |
/* get one byte from buffer */ |
tmp_low = ToneBuf[tmptail]; /* low Duratuion */ |
}else{ |
return; |
} |
if ( ToneBufHead != ToneBufTail) { |
/* calculate and store new buffer index */ |
tmptail = (ToneBufTail + 1) & TONE_BUFFER_MASK; |
ToneBufTail = tmptail; |
/* get one byte from buffer*/ |
tmp_high = ToneBuf[tmptail]; /* high Duration */ |
}else{ |
return; |
} |
dur_ms = (((uint16_t) tmp_high) << 8) | tmp_low; |
sound_timer = dur_ms/10; |
// TCNT2=0; |
idesfreq= f_Hz; |
cvtfreq2frac(); |
attendb= volume; |
cvtdb2fac(); |
if (f_Hz ==0) generate=0; |
else { generate = 1; |
// TIMSK2 |= _BV(TOIE2); // Interrupt freigeben |
} |
// printf("tone_handler f_Hz: %i dur_ms: %i volume: %i\n\r", f_Hz,dur_ms,volume); |
} |
void tone_putc(unsigned char data) |
{ |
unsigned char tmphead; |
tmphead = (ToneBufHead + 1) & TONE_BUFFER_MASK; |
while ( tmphead == ToneBufTail ){ |
;/* wait for free space in buffer */ |
} |
ToneBuf[tmphead] = data; |
ToneBufHead = tmphead; |
}/* tone_putc */ |
void playTone(uint16_t f_Hz, uint16_t dur_ms, uint8_t volume) |
{ |
// printf("Playtone f_Hz: %i dur_ms: %i volume: %i\n\r", f_Hz,dur_ms,volume); |
tone_putc(LSB(f_Hz)); |
tone_putc( MSB(f_Hz)); |
tone_putc( volume); |
tone_putc(LSB(dur_ms)); |
tone_putc(MSB(dur_ms)); |
} |
//----------------- |
void InitSound(void){//main program |
ToneBufHead = 0; |
ToneBufTail = 0; |
initvars(); |
initsindat(); |
Timer2_Init(); |
Timer3_Init(); |
} |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/sound/pwmsine8bit.h |
---|
0,0 → 1,22 |
/* |
* pwmsine8bit.h |
* |
* Created on: 01.09.2012 |
* Author: cebra |
*/ |
#ifndef PWMSINE8BIT_H_ |
#define PWMSINE8BIT_H_ |
extern unsigned char freqincipart,freqincfpart; |
extern unsigned char waveptipart,waveptfpart; |
extern unsigned char iattenfac; //0-255 |
extern unsigned char generate; |
extern volatile unsigned char sindat[256]; //8 bit sine table |
void InitSound(void); |
void tone(int hz,uint8_t volume, uint16_t ms, uint16_t soundpause); |
void tone1(int hz); |
void playTone(uint16_t f_Hz, uint16_t dur_ms, uint8_t volume); |
void tone_handler(void); |
#endif /* PWMSINE8BIT_H_ */ |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/stick/stick.c |
---|
0,0 → 1,507 |
/***************************************************************************** |
* Copyright (C) 2008 Thomas Kaiser, thomas@ft-fanpage.de * |
* Copyright (C) 2009 Peter "woggle" Mack, mac@denich.net * |
* Copyright (C) 2011 Christian "Cebra" Brandtner, brandtner@brandtner.net * |
* Copyright (C) 2011 Harald Bongartz * |
* Copyright (C) 2012 Martin Runkel * |
* * |
* This program is free software; you can redistribute it and/or modify * |
* it under the terms of the GNU General Public License as published by * |
* the Free Software Foundation; either version 2 of the License. * |
* * |
* This program is distributed in the hope that it will be useful, * |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
* GNU General Public License for more details. * |
* * |
* You should have received a copy of the GNU General Public License * |
* along with this program; if not, write to the * |
* Free Software Foundation, Inc., * |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
* * |
* * |
* Credits to: * |
* Holger Buss & Ingo Busker from mikrokopter.de for the MK project + SVN * |
* http://www.mikrokopter.de * |
* Gregor "killagreg" Stobrawa for his version of the MK code * |
* Thomas Kaiser "thkais" for the original project. See * |
* http://www.ft-fanpage.de/mikrokopter/ * |
* http://forum.mikrokopter.de/topic-4061-1.html * |
* Claas Anders "CaScAdE" Rathje for providing the font and his C-OSD code * |
* http://www.mylifesucks.de/oss/c-osd/ * |
* Harald Bongartz "HaraldB" for providing his Ideas and Code for usibility* |
*****************************************************************************/ |
#include "../cpu.h" |
#include <avr/io.h> |
#include <avr/interrupt.h> |
#include <avr/pgmspace.h> |
#include <string.h> |
#include <stdlib.h> |
#include "../lcd/lcd.h" |
#include "../timer/timer.h" |
#include "../tracking/servo.h" |
#include "../messages.h" |
#include "../lipo/lipo.h" |
#include "stick.h" |
#include "stick_setup.h" |
#include "../eeprom/eeprom.h" |
#include "../setup/setup.h" |
#define SERVO_CORRECT 3.125 |
#include <util/delay.h> |
#include <inttypes.h> |
#include <stdlib.h> |
#include "../main.h" |
#include "../uart/uart1.h" |
#include "../uart/usart.h" |
#define LIMIT_MIN_MAX(value, min, max) {if(value <= min) value = min; else if(value >= max) value = max;} |
int16_t Pos_Stick[12]; // 1,5mS |
int16_t Pos_alt[5]; // |
uint8_t BalkenPos = 0; |
uint8_t Stick_Display = 0; |
//uint8_t serialChannelRichtung = 0; |
//uint8_t serialChannelNeutral = 0; |
//uint8_t serialChannelConfig = 2; |
//-------------------------------------------------------------- |
// |
void joystick (void) |
{ |
// uint8_t chg = 0; |
// uint8_t Pos_Stick = 150; // 1,5mS |
// uint8_t Pos_alt = 150; // |
//int16_t Pos_Stick[12]; // 1,5mS |
uint8_t chg = 0; |
//uint8_t BalkenPos = 0; |
uint8_t Stick_Nr = 0; |
//uint8_t Stick_Display = 0; |
uint8_t i = 0; |
memset (Pos_Stick, 150, 3); // füllt 3+1 Byte vom Pos_Stick[12] mit 150 |
//int16_t Pos_alt[5]; // |
int16_t Poti_Summe[5]; // |
memset (Poti_Summe, 0, 5); // füllt 3+1 Byte mit 0 |
int16_t Poti_Neutral[5]; // |
// ADC- init |
//if (Config.Lipomessung == true) |
//{ |
//} |
//for (uint8_t i = 0; i < 4; i++) |
if (Config.stick_typ[0] == 0) // Poti |
{ |
PORTA &= ~(1<<PORTA0); |
DDRA &= ~(1<<DDA0); |
} |
else // Taster |
{ |
PORTA |= (1<<PORTA0); |
DDRA |= (1<<DDA0); |
} |
if (Config.Lipomessung == false) |
{ |
if (Config.stick_typ[1] == 0) // Poti |
{ |
PORTA &= ~(1<<PORTA1); |
DDRA &= ~(1<<DDA1); |
} |
else // Taster |
{ |
PORTA |= (1<<PORTA1); |
DDRA |= (1<<DDA1); |
} |
} |
if (Config.stick_typ[2] == 0) |
{ |
PORTA &= ~(1<<PORTA2); |
DDRA &= ~(1<<DDA2); |
} |
else |
{ |
PORTA |= (1<<PORTA2); |
DDRA |= (1<<DDA2); |
} |
if (Config.stick_typ[3] == 0) |
{ |
PORTA &= ~(1<<PORTA3); |
DDRA &= ~(1<<DDA3); |
} |
else |
{ |
PORTA |= (1<<PORTA3); |
DDRA |= (1<<DDA3); |
} |
//if (Config.stick_dir[i] == 0) serialChannelRichtung &= ~(1<<i); else serialChannelRichtung |= (1<<i); |
//if (Config.stick_neutral[i] == 0) serialChannelNeutral &= ~(1<<i); else serialChannelNeutral |= (1<<i); |
//if (Config.Lipomessung == true) |
//serialChannelConfig |
// Ermittlung der Neutralposition |
for (uint8_t i = 0; i < 4; i++) |
{ |
ADMUX = (1<<REFS0)|(0<<MUX0); // Multiplexer selection Register: AVCC with external capacitor at AREF pin , ADC1 |
ADMUX = (ADMUX & ~(0x1F)) | (i & 0x1F); // ADC[i] verwenden |
timer = 50; |
while (timer > 0); |
ADCSRA = (1<<ADEN)|(1<<ADSC)|(1<<ADPS2)|(1<<ADPS1)|(1<<ADPS0); // ADC Enable, ADC Start, Prescaler 128 |
while (ADCSRA & (1<<ADSC)); // wenn ADC fertig |
Poti_Neutral[i] = ((ADCW>>2)&0xff); |
LIMIT_MIN_MAX (Poti_Neutral[i],108,148); |
ADMUX = (ADMUX & ~(0x1F)) | (i & 0x1F); // ADC[i] verwenden |
// Stick_Nr 1,2,3 = Potis, Stick_Nr 1= Lipo |
ADCSRA |= (1<<ADSC); // ADC Start |
while (ADCSRA & (1<<ADSC)); // wenn ADC fertig |
Poti_Neutral[i] = ((ADCW>>2)&0xff); |
LIMIT_MIN_MAX (Poti_Neutral[i],108,148); |
} |
Stick_Nr = 0; |
ADMUX = (ADMUX & ~(0x1F)) | (Stick_Nr & 0x1F); // ADC[i] verwenden |
ADCSRA |= (1<<ADSC); // ADC Start |
/* |
Stick_Nr = 0; |
ADMUX = (1<<REFS0)|(0<<MUX0); // Multiplexer selection Register: AVCC with external capacitor at AREF pin , ADC1 |
ADMUX = (ADMUX & ~(0x1F)) | (Stick_Nr & 0x1F); // ADC[Stick_Nr] verwenden |
timer = 50; |
while (timer > 0); |
ADCSRA = (1<<ADEN)|(1<<ADSC)|(1<<ADPS2)|(1<<ADPS1)|(1<<ADPS0); // ADC Enable, ADC Start, Prescaler 128 |
// Stick-Neutralposition bestimmen |
while (ADCSRA & (1<<ADSC)); // wenn ADC fertig |
Poti_Neutral[Stick_Nr] = ((ADCW>>2)&0xff); |
LIMIT_MIN_MAX (Poti_Neutral[Stick_Nr],108,148); |
Stick_Nr = 2 ; |
ADMUX = (ADMUX & ~(0x1F)) | (Stick_Nr & 0x1F); // ADC[i] verwenden |
// Stick_Nr 1,2,3 = Potis, Stick_Nr 1= Lipo |
ADCSRA |= (1<<ADSC); // ADC Start |
while (ADCSRA & (1<<ADSC)); // wenn ADC fertig |
Poti_Neutral[Stick_Nr] = ((ADCW>>2)&0xff); |
LIMIT_MIN_MAX (Poti_Neutral[Stick_Nr],108,148); |
Stick_Nr = 0; |
ADMUX = (ADMUX & ~(0x1F)) | (Stick_Nr & 0x1F); // ADC[i] verwenden |
// Stick_Nr 1,2,3 = Potis, Stick_Nr 1= Lipo |
ADCSRA |= (1<<ADSC); // ADC Start |
*/ |
//OCR1A = 150 * SERVO_CORRECT; // Servomitte |
lcd_cls (); |
// Kopfzeile und Rahmen zeichnen |
lcd_printp (PSTR(" serielle Potis 1-5 "), 2); |
//lcd_printp_at (7, 5, PSTR("%"), 0); |
//lcd_printp_at (16, 5, PSTR("mS"), 0); |
lcd_puts_at(0, 7, strGet(KEYLINE3), 0); |
lcd_printp_at (18, 7, PSTR("\x19O\x18"), 0); |
for (i=0 ; i< 5 ; i++) |
{ |
BalkenPos = 12 + (i*8) ; |
lcd_rect(3,BalkenPos, 120, 6, 1); // +-150% Rahmen |
lcd_line(23,BalkenPos,23,(BalkenPos+6),1); // -100% |
lcd_line(43,BalkenPos,43,(BalkenPos+6),1); // -50% |
lcd_frect(62,BalkenPos, 2, 6, 1); // 0% |
lcd_line(83,BalkenPos,83,(BalkenPos+6),1); // +50% |
lcd_line(103,BalkenPos,103,(BalkenPos+6),1); // +100% |
} |
// Reset auf Mittelstellung |
Pos_Stick[0] = 150; |
Poti_Summe[0] = 0; |
Pos_Stick[2] = 150; |
Poti_Summe[2] = 0; |
Pos_Stick[4] = 150; |
Poti_Summe[4] = 0; |
chg = 255; |
do |
{ |
if (!(ADCSRA & (1<<ADSC))) // wenn ADC fertig |
{ |
//Pos_Stick[Stick_Nr] = 150 + 128 - ((ADCW>>2)&0xff); |
//if (serialChannelRichtung & (1<<Stick_Nr)) |
if (Config.stick_dir[Stick_Nr] > 0) |
Pos_Stick[Stick_Nr] = Poti_Neutral[Stick_Nr] - ((ADCW>>2)&0xff); |
else |
Pos_Stick[Stick_Nr] = ((ADCW>>2)&0xff) - Poti_Neutral[Stick_Nr]; |
LIMIT_MIN_MAX (Pos_Stick[Stick_Nr],-120,120); |
//if ((Stick_Nr==0) || (Stick_Nr==2)) // nur die Potis 1,2 sind nicht neutralisierend |
if (Config.stick_neutral[Stick_Nr]==0) // nicht neutralisierend |
{ |
Poti_Summe[Stick_Nr] += (Pos_Stick[Stick_Nr]/8) * abs(Pos_Stick[Stick_Nr]/8); |
LIMIT_MIN_MAX (Poti_Summe[Stick_Nr],-(120*128),(120*128)); |
Pos_Stick[Stick_Nr]= Poti_Summe[Stick_Nr] / 128; // nicht neutralisierend |
} |
Pos_Stick[Stick_Nr] += 150; |
//LIMIT_MIN_MAX (Pos_Stick[Stick_Nr],30,270); // war 75 , 225 |
LIMIT_MIN_MAX (Pos_Stick[Stick_Nr],Config.stick_min[Stick_Nr],Config.stick_max[Stick_Nr]); // war 30, 270 |
if (Pos_Stick[Stick_Nr] != Pos_alt[Stick_Nr]) // nur bei Änderung |
{ |
chg |= (1<<Stick_Nr) ; |
//Pos_alt=Pos_Stick ; // verschoben |
} |
Stick_Nr ++ ; |
//if (Stick_Nr==1) Stick_Nr=2; // Lipo überspringen |
if (Stick_Nr==3) // Taster |
{ |
if (Config.stick_dir[Stick_Nr] > 0) |
{ |
if (PINA & (1 << KEY_EXT)) Pos_Stick[Stick_Nr] = Config.stick_min[Stick_Nr]; |
else Pos_Stick[Stick_Nr] = Config.stick_max[Stick_Nr]; |
} |
else |
{ |
if (PINA & (1 << KEY_EXT)) Pos_Stick[Stick_Nr] = Config.stick_max[Stick_Nr]; |
else Pos_Stick[Stick_Nr] = Config.stick_min[Stick_Nr]; |
} |
if (Pos_Stick[Stick_Nr] != Pos_alt[Stick_Nr]) |
{ |
chg |= (1<<Stick_Nr) ; |
} |
Stick_Nr=0; |
} |
/* |
#ifndef ohne_Lipo // MartinR |
Stick_Nr = 1; // MartinR AD-Kanal 1 überspringen wegen Lipo Überwachung |
#endif |
*/ |
ADMUX = (ADMUX & ~(0x1F)) | (Stick_Nr & 0x1F); // ADC[i] verwenden |
// Stick_Nr 1,2,3 = Potis, Stick_Nr 0= Lipo |
ADCSRA |= (1<<ADSC); // ADC Start |
//serialPotis (); |
} |
if ((get_key_press (1 << KEY_PLUS) | get_key_long_rpt_sp ((1 << KEY_PLUS), 3))) |
//if (get_key_press (1 << KEY_PLUS)) |
//if (PINA & (1 << KEY_PLUS)) |
{ |
if (Config.stick_neutral[4]==0) // nicht neutralisierend |
{ |
if (Config.stick_dir[4] == 0) Pos_Stick[4] ++ ; else Pos_Stick[4] -- ; |
LIMIT_MIN_MAX (Pos_Stick[4],Config.stick_min[4],Config.stick_max[4]); // war 30, 270 |
} |
else |
{ |
if (Config.stick_dir[4] == 0) Pos_Stick[4] = Config.stick_max[4] ; else Pos_Stick[4] = Config.stick_min[4] ; |
} |
chg |= (1<<4) ; |
} |
else if ((get_key_press (1 << KEY_MINUS) | get_key_long_rpt_sp ((1 << KEY_MINUS), 3))) |
{ |
if (Config.stick_neutral[4]==0) // nicht neutralisierend |
{ |
if (Config.stick_dir[4] == 0) Pos_Stick[4] -- ; else Pos_Stick[4] ++ ; |
LIMIT_MIN_MAX (Pos_Stick[4],Config.stick_min[4],Config.stick_max[4]); // war 30, 270 |
//LIMIT_MIN_MAX (Pos_Stick[Stick_Nr],30,270); // war 75 , 225 |
} |
else |
{ |
if (Config.stick_dir[4] == 0) Pos_Stick[4] = Config.stick_min[4] ; else Pos_Stick[4] = Config.stick_max[4] ; |
} |
chg |= (1<<4) ; |
} |
if (Config.stick_neutral[4]!= 0 && Pos_Stick[4]!= 150 && (PINA &(1 << KEY_PLUS)) && (PINA &(1 << KEY_MINUS))) |
{ |
Pos_Stick[4] = 150 ; |
chg |= (1<<4) ; |
} |
if (get_key_press (1 << KEY_ENTER)) |
{ |
/* |
for (i=0 ; i< 4 ; i++) |
{ |
BalkenPos = 12 + (i*8) ; |
lcd_frect (4, (BalkenPos+1), 118, 4, 0); // Balken löschen |
lcd_frect(62, BalkenPos, 2, 6, 1); // 0% |
} |
*/ |
Pos_Stick[0] = 150; |
Poti_Summe[0] = 0; |
Pos_Stick[2] = 150; |
Poti_Summe[2] = 0; |
Pos_Stick[4] = 150; |
Poti_Summe[4] = 0; |
BeepTime = 200; |
BeepMuster = 0x0080; |
chg = 255; |
} |
if (chg) |
{ |
if (chg & (1<<0)); // Stick 1 |
{ |
BalkenPos = 12 + (0*8) ; |
Stick_Display = 0; |
Balken_Zeichnen () ; |
Pos_alt[Stick_Display]=Pos_Stick[Stick_Display]; |
} |
// Stick 2 = Lipo |
if (chg & (1<<1)); // Stick 2 |
{ |
BalkenPos = 12 + (1*8) ; |
Stick_Display = 1; |
//if (serialChannelConfig & (0<<1)) Balken_Zeichnen () ; // nur wenn keine Lipo-Spannung |
if (Config.Lipomessung == false) Balken_Zeichnen () ; // nur wenn keine Lipo-Spannung |
Pos_alt[Stick_Display]=Pos_Stick[Stick_Display]; |
} |
if (chg & (1<<2)); // Stick 3 |
{ |
BalkenPos = 12 + (2*8) ; |
Stick_Display = 2; |
Balken_Zeichnen () ; |
Pos_alt[Stick_Display]=Pos_Stick[Stick_Display]; |
} |
if (chg & (1<<3)); // Stick 4 = Taster |
{ |
BalkenPos = 12 + (3*8) ; |
Stick_Display = 3; |
Balken_Zeichnen () ; |
Pos_alt[Stick_Display]=Pos_Stick[Stick_Display]; |
} |
if (chg & (1<<4)); // Stick 5 = Taster vom PKT |
{ |
BalkenPos = 12 + (4*8) ; |
Stick_Display = 4; |
Balken_Zeichnen () ; |
//OCR1A = (((Pos_Stick[Stick_Display]-150)/1.6)+150) * SERVO_CORRECT; // Servostellung , 1.6=0.8*0.5 |
Pos_alt[Stick_Display]=Pos_Stick[Stick_Display]; |
} |
chg = 0; |
serialPotis (); |
} |
} |
while (!get_key_press (1 << KEY_ESC)); |
get_key_press(KEY_ALL); |
//#ifdef HWVERSION3_9 |
//#ifndef ohne_Lipo // MartinR |
if (Config.Lipomessung == true) // MartinR: geändert |
{ |
//DDRA &= ~(1<<DDA1); // Eingang: PKT Lipo Messung |
//PORTA &= ~(1<<PORTA1); |
ADC_Init(); // ADC für Lipomessung wieder aktivieren |
} |
//ADC_Init(); // ADC für Lipomessung wieder aktivieren |
//#endif |
//#endif |
} |
//-------------------------------------------------------------- |
// |
void serialPotis (void) |
{ |
uint8_t i = 0; |
memset (buffer, 0, 12); // füllt die 12+1 Byte vom buffer mit 0 |
for (i=0 ; i< 5 ; i++) |
{ |
buffer[i] = Pos_Stick[i]-150 ; |
} |
SendOutData('y', ADDRESS_FC, 1, buffer, 12); |
} |
//-------------------------------------------------------------- |
// |
void Balken_Zeichnen (void) |
{ |
// Balken löschen |
if ((Pos_Stick[Stick_Display] > Pos_alt[Stick_Display])&&(Pos_alt[Stick_Display] < 150)) // Balken links löschen |
lcd_frect ((63-((150 -Pos_alt[Stick_Display]) * 0.5)), (BalkenPos+1), (63-((150- Pos_Stick[Stick_Display]) * 0.5)), 4, 0); |
if ((Pos_Stick[Stick_Display] < Pos_alt[Stick_Display])&&(Pos_alt[Stick_Display] > 150)) // Balken rechts löschen |
lcd_frect ((63+((Pos_Stick[Stick_Display] - 150) * 0.5)), (BalkenPos+1), (63+((Pos_alt[Stick_Display] - 150) * 0.5)), 4, 0); |
// Balken zeichnen |
if (Pos_Stick[Stick_Display] >= 150) |
{ |
lcd_frect (63, (BalkenPos+1), ((Pos_Stick[Stick_Display] - 150) * 0.5), 4, 1); |
//write_ndigit_number_u (4, 5, ((Pos_Stick[Stick_Display] - 150) * 1.25), 3, 0, 0); // Pulse width in % |
lcd_frect(62, (BalkenPos), 2, 6, 1); // 0% |
} |
else |
{ |
lcd_frect (63 - ((150 - Pos_Stick[Stick_Display]) * 0.5), (BalkenPos+1), ((150 - Pos_Stick[Stick_Display]) * 0.5), 4, 1); |
//write_ndigit_number_u (4, 5, ((150 - Pos_Stick[Stick_Display]) * 1.25), 3, 0, 0); // Pulse width in % |
lcd_frect(62, (BalkenPos), 2, 6, 1); // 0% |
} |
// Raster zeichnen |
lcd_line(3, BalkenPos,3, (BalkenPos+6),1); // -150% |
lcd_line(23, BalkenPos,23, (BalkenPos+6),1); // -100% |
lcd_line(43, BalkenPos,43, (BalkenPos+6),1); // -50% |
lcd_line(83, BalkenPos,83, (BalkenPos+6),1); // +50% |
lcd_line(103,BalkenPos,103,(BalkenPos+6),1); // +100% |
lcd_line(123,BalkenPos,123,(BalkenPos+6),1); // +150% |
} |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/stick/stick.c_f |
---|
0,0 → 1,392 |
/***************************************************************************** |
* Copyright (C) 2008 Thomas Kaiser, thomas@ft-fanpage.de * |
* Copyright (C) 2009 Peter "woggle" Mack, mac@denich.net * |
* Copyright (C) 2011 Christian "Cebra" Brandtner, brandtner@brandtner.net * |
* Copyright (C) 2011 Harald Bongartz * |
* Copyright (C) 2012 Martin Runkel * |
* * |
* This program is free software; you can redistribute it and/or modify * |
* it under the terms of the GNU General Public License as published by * |
* the Free Software Foundation; either version 2 of the License. * |
* * |
* This program is distributed in the hope that it will be useful, * |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
* GNU General Public License for more details. * |
* * |
* You should have received a copy of the GNU General Public License * |
* along with this program; if not, write to the * |
* Free Software Foundation, Inc., * |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
* * |
* * |
* Credits to: * |
* Holger Buss & Ingo Busker from mikrokopter.de for the MK project + SVN * |
* http://www.mikrokopter.de * |
* Gregor "killagreg" Stobrawa for his version of the MK code * |
* Thomas Kaiser "thkais" for the original project. See * |
* http://www.ft-fanpage.de/mikrokopter/ * |
* http://forum.mikrokopter.de/topic-4061-1.html * |
* Claas Anders "CaScAdE" Rathje for providing the font and his C-OSD code * |
* http://www.mylifesucks.de/oss/c-osd/ * |
* Harald Bongartz "HaraldB" for providing his Ideas and Code for usibility* |
*****************************************************************************/ |
#include "../cpu.h" |
#include <avr/io.h> |
#include <avr/interrupt.h> |
#include <avr/pgmspace.h> |
#include <string.h> |
#include <stdlib.h> |
#include "../lcd/lcd.h" |
#include "../timer/timer.h" |
#include "../tracking/servo.h" |
#include "../messages.h" |
#include "../lipo/lipo.h" |
#include "stick.h" |
#define SERVO_CORRECT 3.125 |
#include <util/delay.h> |
#include <inttypes.h> |
#include <stdlib.h> |
#include "../main.h" |
#include "../uart/uart1.h" |
#include "../uart/usart.h" |
#include "../eeprom/eeprom.h" |
#define LIMIT_MIN_MAX(value, min, max) {if(value <= min) value = min; else if(value >= max) value = max;} |
int16_t Pos_Stick[12]; // 1,5mS |
int16_t Pos_alt[5]; // |
uint8_t BalkenPos = 0; |
uint8_t Stick_Display = 0; |
uint8_t serialChannelRichtung = 0; |
uint8_t serialChannelConfig = 2; |
//-------------------------------------------------------------- |
// |
void joystick (void) |
{ |
// uint8_t chg = 0; |
// uint8_t Pos_Stick = 150; // 1,5mS |
// uint8_t Pos_alt = 150; // |
//int16_t Pos_Stick[12]; // 1,5mS |
uint8_t chg = 0; |
//uint8_t BalkenPos = 0; |
uint8_t Stick_Nr = 0; |
//uint8_t Stick_Display = 0; |
uint8_t i = 0; |
memset (Pos_Stick, 150, 3); // füllt 3+1 Byte vom Pos_Stick[12] mit 150 |
//int16_t Pos_alt[5]; // |
int16_t Poti_Summe[5]; // |
memset (Poti_Summe, 0, 5); // füllt 3+1 Byte mit 0 |
int16_t Poti_Neutral[5]; // |
// ADC- init |
Stick_Nr = 0; |
ADMUX = (1<<REFS0)|(0<<MUX0); // Multiplexer selection Register: AVCC with external capacitor at AREF pin , ADC1 |
ADMUX = (ADMUX & ~(0x1F)) | (Stick_Nr & 0x1F); // ADC[Stick_Nr] verwenden |
timer = 50; |
while (timer > 0); |
ADCSRA = (1<<ADEN)|(1<<ADSC)|(1<<ADPS2)|(1<<ADPS1)|(1<<ADPS0); // ADC Enable, ADC Start, Prescaler 128 |
// Stick-Neutralposition bestimmen |
while (ADCSRA & (1<<ADSC)); // wenn ADC fertig |
Poti_Neutral[Stick_Nr] = ((ADCW>>2)&0xff); |
//CB LIMIT_MIN_MAX (Poti_Neutral[Stick_Nr],108,148); |
LIMIT_MIN_MAX (Poti_Neutral[Stick_Nr],stick_min[Stick_Nr],stick_max[Stick_Nr]); |
Stick_Nr = 2 ; |
ADMUX = (ADMUX & ~(0x1F)) | (Stick_Nr & 0x1F); // ADC[i] verwenden |
// Stick_Nr 1,2,3 = Potis, Stick_Nr 1= Lipo |
ADCSRA |= (1<<ADSC); // ADC Start |
while (ADCSRA & (1<<ADSC)); // wenn ADC fertig |
Poti_Neutral[Stick_Nr] = ((ADCW>>2)&0xff); |
//CB LIMIT_MIN_MAX (Poti_Neutral[Stick_Nr],108,148); |
LIMIT_MIN_MAX (Poti_Neutral[Stick_Nr],stick_min[Stick_Nr],stick_max[Stick_Nr]); |
Stick_Nr = 0; |
ADMUX = (ADMUX & ~(0x1F)) | (Stick_Nr & 0x1F); // ADC[i] verwenden |
// Stick_Nr 1,2,3 = Potis, Stick_Nr 1= Lipo |
ADCSRA |= (1<<ADSC); // ADC Start |
//OCR1A = 150 * SERVO_CORRECT; // Servomitte |
lcd_cls (); |
// Kopfzeile und Rahmen zeichnen |
lcd_printp (PSTR(" serielle Potis 1-5 "), 2); |
//lcd_printp_at (7, 5, PSTR("%"), 0); |
//lcd_printp_at (16, 5, PSTR("mS"), 0); |
lcd_puts_at(0, 7, strGet(KEYLINE3), 0); |
lcd_printp_at (18, 7, PSTR("\x19O\x18"), 0); |
for (i=0 ; i< 5 ; i++) |
{ |
BalkenPos = 12 + (i*8) ; |
lcd_rect(3,BalkenPos, 120, 6, 1); // +-150% Rahmen |
lcd_line(23,BalkenPos,23,(BalkenPos+6),1); // -100% |
lcd_line(43,BalkenPos,43,(BalkenPos+6),1); // -50% |
lcd_frect(62,BalkenPos, 2, 6, 1); // 0% |
lcd_line(83,BalkenPos,83,(BalkenPos+6),1); // +50% |
lcd_line(103,BalkenPos,103,(BalkenPos+6),1); // +100% |
} |
// Reset auf Mittelstellung |
Pos_Stick[0] = 150; |
Poti_Summe[0] = 0; |
Pos_Stick[2] = 150; |
Poti_Summe[2] = 0; |
Pos_Stick[4] = 150; |
Poti_Summe[4] = 0; |
chg = 255; |
do |
{ |
if (!(ADCSRA & (1<<ADSC))) // wenn ADC fertig |
{ |
//Pos_Stick[Stick_Nr] = 150 + 128 - ((ADCW>>2)&0xff); |
//CB if (serialChannelRichtung & (1<<Stick_Nr)) |
if (stick_dir[Stick_Nr] & (1<<Stick_Nr)) |
Pos_Stick[Stick_Nr] = Poti_Neutral[Stick_Nr] - ((ADCW>>2)&0xff); |
else |
Pos_Stick[Stick_Nr] = ((ADCW>>2)&0xff) - Poti_Neutral[Stick_Nr]; |
// LIMIT_MIN_MAX (Pos_Stick[Stick_Nr],-120,120); |
LIMIT_MIN_MAX (Pos_Stick[Stick_Nr],stick_min[Stick_Nr],stick_max[Stick_Nr]); |
if ((Stick_Nr==0) || (Stick_Nr==2)) // nur die Potis 1,2 sind nicht neutralisierend |
{ |
Poti_Summe[Stick_Nr] += (Pos_Stick[Stick_Nr]/8) * abs(Pos_Stick[Stick_Nr]/8); |
LIMIT_MIN_MAX (Poti_Summe[Stick_Nr],-(120*128),(120*128)); |
Pos_Stick[Stick_Nr]= Poti_Summe[Stick_Nr] / 128; // nicht neutralisierend |
} |
Pos_Stick[Stick_Nr] += 150; |
// LIMIT_MIN_MAX (Pos_Stick[Stick_Nr],30,270); // war 75 , 225 |
LIMIT_MIN_MAX (Pos_Stick[Stick_Nr],stick_min[Stick_Nr],stick_max[Stick_Nr]); // war 75 , 225 |
if (Pos_Stick[Stick_Nr] != Pos_alt[Stick_Nr]) // nur bei Änderung |
{ |
chg |= (1<<Stick_Nr) ; |
//Pos_alt=Pos_Stick ; // verschoben |
} |
Stick_Nr ++ ; |
//if (Stick_Nr==1) Stick_Nr=2; // Lipo überspringen |
//CB if (Stick_Nr==3) // Taster |
if (stick_typ[Stick_Nr]==1) // Taster |
{ |
// if (get_key_press (1 << KEY_EXT)) Pos_Stick[Stick_Nr] = 225; |
//CB if (serialChannelRichtung & (1<<Stick_Nr)) |
if (stick_dir[Stick_Nr] & (1<<Stick_Nr)) |
{ |
if (PINA & (1 << KEY_EXT)) Pos_Stick[Stick_Nr] = 30; |
else Pos_Stick[Stick_Nr] = 270; |
} |
else |
{ |
if (PINA & (1 << KEY_EXT)) Pos_Stick[Stick_Nr] = 270; |
else Pos_Stick[Stick_Nr] = 30; |
} |
if (Pos_Stick[Stick_Nr] != Pos_alt[Stick_Nr]) |
{ |
chg |= (1<<Stick_Nr) ; |
} |
Stick_Nr=0; |
} |
/* |
#ifndef ohne_Lipo // MartinR |
Stick_Nr = 1; // MartinR AD-Kanal 1 überspringen wegen Lipo Überwachung |
#endif |
*/ |
ADMUX = (ADMUX & ~(0x1F)) | (Stick_Nr & 0x1F); // ADC[i] verwenden |
// Stick_Nr 1,2,3 = Potis, Stick_Nr 0= Lipo |
ADCSRA |= (1<<ADSC); // ADC Start |
//serialPotis (); |
} |
if ((get_key_press (1 << KEY_PLUS) || get_key_long_rpt_sp ((1 << KEY_PLUS), 3)) && (Pos_Stick[4] < 271)) |
{ |
Pos_Stick[4] ++ ; |
//LIMIT_MIN_MAX (Pos_Stick[Stick_Nr],30,270); // war 75 , 225 |
chg |= (1<<4) ; |
} |
else if ((get_key_press (1 << KEY_MINUS) || get_key_long_rpt_sp ((1 << KEY_MINUS), 3)) && (Pos_Stick[4] > 29)) |
{ |
Pos_Stick[4] -- ; |
//LIMIT_MIN_MAX (Pos_Stick[Stick_Nr],30,270); // war 75 , 225 |
chg |= (1<<4) ; |
} |
else if (get_key_press (1 << KEY_ENTER)) |
{ |
/* |
for (i=0 ; i< 4 ; i++) |
{ |
BalkenPos = 12 + (i*8) ; |
lcd_frect (4, (BalkenPos+1), 118, 4, 0); // Balken löschen |
lcd_frect(62, BalkenPos, 2, 6, 1); // 0% |
} |
*/ |
Pos_Stick[0] = 150; |
Poti_Summe[0] = 0; |
Pos_Stick[2] = 150; |
Poti_Summe[2] = 0; |
Pos_Stick[4] = 150; |
Poti_Summe[4] = 0; |
BeepTime = 200; |
BeepMuster = 0x0080; |
chg = 255; |
} |
if (chg) |
{ |
if (chg & (1<<0)); // Stick 1 |
{ |
BalkenPos = 12 + (0*8) ; |
Stick_Display = 0; |
Balken_Zeichnen () ; |
Pos_alt[Stick_Display]=Pos_Stick[Stick_Display]; |
} |
// Stick 2 = Lipo |
if (chg & (1<<1)); // Stick 2 |
{ |
BalkenPos = 12 + (1*8) ; |
Stick_Display = 1; |
if (serialChannelConfig & (0<<1)) Balken_Zeichnen () ; // nur wenn keine Lipo-Spannung |
Pos_alt[Stick_Display]=Pos_Stick[Stick_Display]; |
} |
if (chg & (1<<2)); // Stick 3 |
{ |
BalkenPos = 12 + (2*8) ; |
Stick_Display = 2; |
Balken_Zeichnen () ; |
Pos_alt[Stick_Display]=Pos_Stick[Stick_Display]; |
} |
if (chg & (1<<3)); // Stick 4 = Taster |
{ |
BalkenPos = 12 + (3*8) ; |
Stick_Display = 3; |
Balken_Zeichnen () ; |
Pos_alt[Stick_Display]=Pos_Stick[Stick_Display]; |
} |
if (chg & (1<<4)); // Stick 5 = Taster vom PKT |
{ |
BalkenPos = 12 + (4*8) ; |
Stick_Display = 4; |
Balken_Zeichnen () ; |
//OCR1A = (((Pos_Stick[Stick_Display]-150)/1.6)+150) * SERVO_CORRECT; // Servostellung , 1.6=0.8*0.5 |
Pos_alt[Stick_Display]=Pos_Stick[Stick_Display]; |
} |
chg = 0; |
serialPotis (); |
} |
} |
while (!get_key_press (1 << KEY_ESC)); |
get_key_press(KEY_ALL); |
#ifdef HWVERSION3_9 |
#ifndef ohne_Lipo // MartinR |
ADC_Init(); // ADC für Lipomessung wieder aktivieren |
#endif |
#endif |
} |
//-------------------------------------------------------------- |
// |
void serialPotis (void) |
{ |
uint8_t i = 0; |
memset (buffer, 0, 12); // füllt die 12+1 Byte vom buffer mit 0 |
for (i=0 ; i< 5 ; i++) |
{ |
buffer[i] = Pos_Stick[i]-150 ; |
} |
SendOutData('y', ADDRESS_FC, 1, buffer, 12); |
} |
//-------------------------------------------------------------- |
// |
void Balken_Zeichnen (void) |
{ |
// Balken löschen |
if ((Pos_Stick[Stick_Display] > Pos_alt[Stick_Display])&&(Pos_alt[Stick_Display] < 150)) // Balken links löschen |
lcd_frect ((63-((150 -Pos_alt[Stick_Display]) * 0.5)), (BalkenPos+1), (63-((150- Pos_Stick[Stick_Display]) * 0.5)), 4, 0); |
if ((Pos_Stick[Stick_Display] < Pos_alt[Stick_Display])&&(Pos_alt[Stick_Display] > 150)) // Balken rechts löschen |
lcd_frect ((63+((Pos_Stick[Stick_Display] - 150) * 0.5)), (BalkenPos+1), (63+((Pos_alt[Stick_Display] - 150) * 0.5)), 4, 0); |
// Balken zeichnen |
if (Pos_Stick[Stick_Display] >= 150) |
{ |
lcd_frect (63, (BalkenPos+1), ((Pos_Stick[Stick_Display] - 150) * 0.5), 4, 1); |
//write_ndigit_number_u (4, 5, ((Pos_Stick[Stick_Display] - 150) * 1.25), 3, 0, 0); // Pulse width in % |
lcd_frect(62, (BalkenPos), 2, 6, 1); // 0% |
} |
else |
{ |
lcd_frect (63 - ((150 - Pos_Stick[Stick_Display]) * 0.5), (BalkenPos+1), ((150 - Pos_Stick[Stick_Display]) * 0.5), 4, 1); |
//write_ndigit_number_u (4, 5, ((150 - Pos_Stick[Stick_Display]) * 1.25), 3, 0, 0); // Pulse width in % |
lcd_frect(62, (BalkenPos), 2, 6, 1); // 0% |
} |
// Raster zeichnen |
lcd_line(3, BalkenPos,3, (BalkenPos+6),1); // -150% |
lcd_line(23, BalkenPos,23, (BalkenPos+6),1); // -100% |
lcd_line(43, BalkenPos,43, (BalkenPos+6),1); // -50% |
lcd_line(83, BalkenPos,83, (BalkenPos+6),1); // +50% |
lcd_line(103,BalkenPos,103,(BalkenPos+6),1); // +100% |
lcd_line(123,BalkenPos,123,(BalkenPos+6),1); // +150% |
} |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/stick/stick.h |
---|
0,0 → 1,42 |
/***************************************************************************** |
* Copyright (C) 2008 Thomas Kaiser, thomas@ft-fanpage.de * |
* Copyright (C) 2009 Peter "woggle" Mack, mac@denich.net * |
* Copyright (C) 2011 Christian "Cebra" Brandtner, brandtner@brandtner.net * |
* Copyright (C) 2011 Harald Bongartz * |
* * |
* This program is free software; you can redistribute it and/or modify * |
* it under the terms of the GNU General Public License as published by * |
* the Free Software Foundation; either version 2 of the License. * |
* * |
* This program is distributed in the hope that it will be useful, * |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
* GNU General Public License for more details. * |
* * |
* You should have received a copy of the GNU General Public License * |
* along with this program; if not, write to the * |
* Free Software Foundation, Inc., * |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
* * |
* * |
* Credits to: * |
* Holger Buss & Ingo Busker from mikrokopter.de for the MK project + SVN * |
* http://www.mikrokopter.de * |
* Gregor "killagreg" Stobrawa for his version of the MK code * |
* Thomas Kaiser "thkais" for the original project. See * |
* http://www.ft-fanpage.de/mikrokopter/ * |
* http://forum.mikrokopter.de/topic-4061-1.html * |
* Claas Anders "CaScAdE" Rathje for providing the font and his C-OSD code * |
* http://www.mylifesucks.de/oss/c-osd/ * |
* Harald Bongartz "HaraldB" for providing his Ideas and Code for usibility* |
*****************************************************************************/ |
#ifndef _STICK_H |
#define _STICK_H |
void joystick (void); |
void serialPotis (void); |
void Balken_Zeichnen (void); |
#endif |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/stick/stick.h_f |
---|
0,0 → 1,42 |
/***************************************************************************** |
* Copyright (C) 2008 Thomas Kaiser, thomas@ft-fanpage.de * |
* Copyright (C) 2009 Peter "woggle" Mack, mac@denich.net * |
* Copyright (C) 2011 Christian "Cebra" Brandtner, brandtner@brandtner.net * |
* Copyright (C) 2011 Harald Bongartz * |
* * |
* This program is free software; you can redistribute it and/or modify * |
* it under the terms of the GNU General Public License as published by * |
* the Free Software Foundation; either version 2 of the License. * |
* * |
* This program is distributed in the hope that it will be useful, * |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
* GNU General Public License for more details. * |
* * |
* You should have received a copy of the GNU General Public License * |
* along with this program; if not, write to the * |
* Free Software Foundation, Inc., * |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
* * |
* * |
* Credits to: * |
* Holger Buss & Ingo Busker from mikrokopter.de for the MK project + SVN * |
* http://www.mikrokopter.de * |
* Gregor "killagreg" Stobrawa for his version of the MK code * |
* Thomas Kaiser "thkais" for the original project. See * |
* http://www.ft-fanpage.de/mikrokopter/ * |
* http://forum.mikrokopter.de/topic-4061-1.html * |
* Claas Anders "CaScAdE" Rathje for providing the font and his C-OSD code * |
* http://www.mylifesucks.de/oss/c-osd/ * |
* Harald Bongartz "HaraldB" for providing his Ideas and Code for usibility* |
*****************************************************************************/ |
#ifndef _STICK_H |
#define _STICK_H |
void joystick (void); |
void serialPotis (void); |
void Balken_Zeichnen (void); |
#endif |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/stick/stick_setup.c |
---|
0,0 → 1,311 |
/****************************************************************/ |
/* Setup für die Sticks */ |
/* 2013 Cebra */ |
/****************************************************************/ |
#include <stdio.h> |
#include <stdlib.h> |
#include <string.h> |
#include <math.h> |
#include "../cpu.h" |
#include <util/delay.h> |
#include <avr/pgmspace.h> |
#include <avr/interrupt.h> |
#include "../main.h" |
#include "../timer/timer.h" |
#include "stick_setup.h" |
#include "../lcd/lcd.h" |
#include "../timer/timer.h" |
#include "../menu.h" |
#include "../messages.h" |
#include "../mk-data-structs.h" |
#include "../eeprom/eeprom.h" |
#include "../setup/setup.h" |
//-------------------------------------------------------------- |
#define ITEMS_STICKS 7 |
const prog_char stick_menuitems[ITEMS_STICKS][NUM_LANG][18]= // Zeilen,Zeichen+1 |
{ |
{"Übersicht ","summary ","summary "}, |
{"Stick 1 \x1d","stick 1 \x1d","stick 1 \x1d"}, |
{"Stick 2 \x1d","stick 2 \x1d","stick 2 \x1d"}, |
{"Stick 3 \x1d","stick 3 \x1d","stick 3 \x1d"}, |
{"Stick 4 \x1d","stick 4 \x1d","stick 4 \x1d"}, |
{"Stick 5 \x1d","stick 5 \x1d","stick 5 \x1d"}, |
{"PKT Lipomessung ","PKT Lipo measure.","PKT Lipo measure."}, |
}; |
//-------------------------------------------------------------- |
#define ITEMS_STICK 5 |
const prog_char sticks_menuitems[ITEMS_STICK][NUM_LANG][18]= // Zeilen,Zeichen+1 |
{ |
{"Minimal Wert ","minimal value ","minimal value "}, |
{"Maximal Wert ","maximal value ","maximal value "}, |
{"Type ","type ","type "}, |
{"Richtung ","direction ","direction "}, |
{"Neutralisiered","neutralizing ","neutralizing "}, |
}; |
//-------------------------------------------------------------- |
void Joysticks_Uebersicht(void) |
{ |
lcd_cls (); |
lcd_printpns_at(0, 0, PSTR(" Joystick Setup "), 2); |
lcd_printpns_at(0, 1, PSTR("S Min Max Typ Dir N"), 0); |
for (uint8_t i = 0; i < 5; i++) { |
write_ndigit_number_u (0, 2+i,i+1, 1, 0,0); |
write_ndigit_number_u (2, 2+i,Config.stick_min[i], 3, 0,0); |
write_ndigit_number_u (6, 2+i,Config.stick_max[i], 3, 0,0); |
if (Config.stick_typ[i] == 0) lcd_printpns_at(10, 2+i, PSTR("Poti"), 0); else lcd_printpns_at(10, 2+i, PSTR("Tast"), 0); |
//if (Config.stick_typ[i] == 0) // MartinR: geändert |
//{ |
if (Config.stick_dir[i] == 0) lcd_printpns_at(15, 2+i, PSTR("Norm"), 0); else lcd_printpns_at(15, 2+i, PSTR("Rev"), 0); |
if (Config.stick_neutral[i] == 0) lcd_printpns_at(20, 2+i, PSTR("N"), 0); else lcd_printpns_at(20, 2+i, PSTR("Y"), 0); |
//} |
if (i == 1) if (Config.Lipomessung == true) lcd_printpns_at(3, 2+i, PSTR("PKT Lipomessung "), 0); |
} |
lcd_printp_at (18, 7, PSTR("OK"), 0); |
do{} |
while (!(get_key_press (1 << KEY_ENTER))); |
} |
//-------------------------------------------------------------- |
void Joysticks_Setup(void) |
{ |
size = ITEMS_STICKS; |
// uint8_t ii = 0; |
// uint8_t Offset = 0; |
// uint8_t dmode = 0; |
uint8_t target_pos = 1; |
// uint8_t val = 0; |
edit =0; |
while(1) |
{ |
size = ITEMS_STICKS; |
lcd_cls (); |
lcd_printpns_at(0, 0, PSTR(" Joystick Setup "), 2); |
// lcd_printp_at (0, 7, PSTR(KEY_LINE_1), 0); |
lcd_puts_at(0, 7, strGet(KEYLINE1), 0); |
// while(2) |
// { |
// ii = 0; |
// if(Offset > 0) |
// { |
// lcd_printp_at(1,1, PSTR("\x12"), 0); |
// } |
// for(ii = 0;ii < 6 ; ii++) |
// { |
// if((ii+Offset) < size) |
// { |
// lcd_printp_at(3,ii+1,stick_menuitems[ii+Offset][Config.DisplayLanguage], 0); |
// } |
// if((ii == 5)&&(ii+Offset < (size-1))) |
// { |
// lcd_printp_at(1,6, PSTR("\x13"), 0); |
// } |
// } |
// if(dmode == 0) |
// { |
// if(Offset == 0) |
// { |
// if(size > 6) |
// { |
// val = menu_choose2 (1, 5, target_pos,0,1); |
// } |
// else |
// { |
// val = menu_choose2 (1, size, target_pos,0,0); |
// } |
// } |
// else |
// { |
// val = menu_choose2 (2, 5, target_pos,1,1); |
// } |
// } |
// if(dmode == 1) |
// { |
// if(Offset+7 > size) |
// { |
// val = menu_choose2 (2, 6, target_pos,1,0); |
// } |
// else |
// { |
// val = menu_choose2 (2, 5, target_pos,1,1); |
// } |
// } |
// if(val == 254) |
// { |
// Offset++; |
// dmode = 1; |
// target_pos = 5; |
// } |
// else if(val == 253) |
// { |
// Offset--; |
// dmode = 0; |
// target_pos = 2; |
// } |
// else if(val == 255) |
// { |
// if (edit == 1) |
// { |
// WriteParameter(); |
// edit = 0; |
// return; |
// } |
// return; |
// } |
// else |
// { |
// break; |
// } |
// } |
val = menu_select(stick_menuitems,size,target_pos); |
if (val==255) break; |
target_pos = val; |
if((val + offset)== 1 ) Joysticks_Uebersicht(); |
if((val + offset)== 2 ) stick_menu(0); //Stick 1 |
if((val + offset)== 3 ) { |
if (Config.Lipomessung == true) { |
lcd_cls (); |
lcd_puts_at(0, 3, strGet(LIPO_MESSUNG), 2); |
_delay_ms(1000); |
} |
else stick_menu(1); //Stick 2 |
} |
if((val + offset)== 4 ) stick_menu(2); //Stick 3 |
if((val + offset)== 5 ) stick_menu(3); //Stick 4 |
if((val + offset)== 6 ) stick_menu(4); //Stick 5 |
if((val + offset)== 7 ) Config.Lipomessung = Edit_generic(Config.Lipomessung,0,1,LIPO_MESSUNG,YesNo); |
} |
} |
//-------------------------------------------------------------- |
void stick_menu(uint8_t stick) |
{ |
// uint8_t ii = 0; |
// uint8_t Offset = 0; |
// uint8_t dmode = 0; |
uint8_t target_pos = 1; |
// uint8_t val = 0; |
edit =0; |
while(1) |
{ |
size = ITEMS_STICK; |
lcd_cls (); |
lcd_printpns_at(0, 0, PSTR("Joystick "), 2); |
write_ndigit_number_u (9, 0,stick+1, 1, 0,2); |
// lcd_printp_at (0, 7, PSTR(KEY_LINE_1), 0); |
lcd_puts_at(0, 7, strGet(KEYLINE1), 0); |
// while(2) |
// { |
// ii = 0; |
// if(Offset > 0) |
// { |
// lcd_printp_at(1,1, PSTR("\x12"), 0); |
// } |
// for(ii = 0;ii < 6 ; ii++) |
// { |
// if((ii+Offset) < size) |
// { |
// lcd_printp_at(3,ii+1,sticks_menuitems[ii+Offset][Config.DisplayLanguage], 0); |
// } |
// if((ii == 5)&&(ii+Offset < (size-1))) |
// { |
// lcd_printp_at(1,6, PSTR("\x13"), 0); |
// } |
// } |
// if(dmode == 0) |
// { |
// if(Offset == 0) |
// { |
// if(size > 6) |
// { |
// val = menu_choose2 (1, 5, target_pos,0,1); |
// } |
// else |
// { |
// val = menu_choose2 (1, size, target_pos,0,0); |
// } |
// } |
// else |
// { |
// val = menu_choose2 (2, 5, target_pos,1,1); |
// } |
// } |
// if(dmode == 1) |
// { |
// if(Offset+7 > size) |
// { |
// val = menu_choose2 (2, 6, target_pos,1,0); |
// } |
// else |
// { |
// val = menu_choose2 (2, 5, target_pos,1,1); |
// } |
// } |
// if(val == 254) |
// { |
// Offset++; |
// dmode = 1; |
// target_pos = 5; |
// } |
// else if(val == 253) |
// { |
// Offset--; |
// dmode = 0; |
// target_pos = 2; |
// } |
// else if(val == 255) |
// { |
// if (edit == 1) |
// { |
// WriteParameter(); |
// edit = 0; |
// return; |
// } |
// return; |
// } |
// else |
// { |
// break; |
// } |
// } |
val = menu_select(sticks_menuitems,size,target_pos); |
if (val==255) break; |
target_pos = val; |
if((val + offset) == 1 ) Config.stick_min[stick]= Edit_generic(Config.stick_min[stick],0,300,STICK_MIN,Show_uint3); |
if((val + offset) == 2 ) Config.stick_max[stick]= Edit_generic(Config.stick_max[stick],0,300,STICK_MAX,Show_uint3); |
if((val + offset) == 3 ) Config.stick_typ[stick]= Edit_generic(Config.stick_typ[stick],0,1,STICK_TYPE,Sticktype); |
if((val + offset) == 4 ) Config.stick_dir[stick]= Edit_generic(Config.stick_dir[stick],0,1,STICK_DIR,NormRev); |
if((val + offset) == 5 ) Config.stick_neutral[stick]= Edit_generic(Config.stick_neutral[stick],0,1,STICK_NEUTRAL,YesNo); |
} |
} |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/stick/stick_setup.h |
---|
0,0 → 1,7 |
#ifndef _STICK_SETUP_H_ |
#define _STICK_SETUP_ |
void Joysticks_Setup(void); |
void stick_menu(uint8_t stick); |
#endif |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/timer/timer.c |
---|
0,0 → 1,676 |
/***************************************************************************** |
* Copyright (C) 2008 Thomas Kaiser, thomas@ft-fanpage.de * |
* Copyright (C) 2009 Peter "woggle" Mack, mac@denich.net * |
* based on the key handling by Peter Dannegger * |
* see www.mikrocontroller.net * |
* Copyright (C) 2011 Christian "Cebra" Brandtner, brandtner@brandtner.net * |
* Copyright (C) 2011 Harald Bongartz * |
* * |
* This program is free software; you can redistribute it and/or modify * |
* it under the terms of the GNU General Public License as published by * |
* the Free Software Foundation; either version 2 of the License. * |
* * |
* This program is distributed in the hope that it will be useful, * |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
* GNU General Public License for more details. * |
* * |
* You should have received a copy of the GNU General Public License * |
* along with this program; if not, write to the * |
* Free Software Foundation, Inc., * |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
* * |
* * |
* Credits to: * |
* Holger Buss & Ingo Busker from mikrokopter.de for the MK project + SVN * |
* http://www.mikrokopter.de * |
* Gregor "killagreg" Stobrawa for his version of the MK code * |
* Thomas Kaiser "thkais" for the original project. See * |
* http://www.ft-fanpage.de/mikrokopter/ * |
* http://forum.mikrokopter.de/topic-4061-1.html * |
* Claas Anders "CaScAdE" Rathje for providing the font and his C-OSD code * |
* http://www.mylifesucks.de/oss/c-osd/ * |
* Harald Bongartz "HaraldB" for providing his Ideas and Code for usibility* |
*****************************************************************************/ |
//############################################################################ |
//# HISTORY timer.c |
//# |
//# 09.03.2013 OG |
//# - add: timer2 (auch in timer.h) |
//############################################################################ |
#include "../cpu.h" |
#include <avr/io.h> |
#include <avr/interrupt.h> |
#include <avr/pgmspace.h> |
#include <string.h> |
#include <util/delay.h> |
#include <inttypes.h> |
#include "../main.h" |
#include "../timer/timer.h" |
#include "../eeprom/eeprom.h" |
#include "../lcd/lcd.h" |
#include "../uart/uart1.h" |
#include "../bluetooth/bluetooth.h" |
#include "../setup/setup.h" |
#include"../tracking/tracking.h" |
#include "../sound/pwmsine8bit.h" |
#if defined HWVERSION1_2W || defined HWVERSION1_2 |
#include "HAL_HW1_2.h" |
#endif |
#if defined HWVERSION1_3W || defined HWVERSION1_3 |
#include "HAL_HW1_3.h" |
#endif |
#ifdef HWVERSION3_9 |
#include "../HAL_HW3_9.h" |
#endif |
volatile uint16_t timer; |
volatile uint16_t timer2; |
volatile uint16_t abo_timer; |
volatile uint16_t sound_timer; |
volatile uint16_t soundpause_timer; |
volatile static unsigned int tim_main; |
uint8_t key_state = 0; // debounced and inverted key state: |
// bit = 1: key pressed |
uint8_t key_press = 0; // key press detect |
uint8_t key_long = 0; // key long press |
uint8_t key_rpt = 0; // key repeat |
uint8_t key_lrpt = 0; // key long press and repeat |
uint8_t key_rpts = 0; // key long press and speed repeat |
uint8_t repeat_speed = 0; |
uint16_t DisplayTime = 0; // Leuchtdauer |
volatile uint16_t IdleTimer = 0; // InaktivitÀtsTimer |
//uint8_t servo = 0; |
volatile uint16_t WarnCount = 0; // Zähler der LIPO Warnzeit |
volatile uint16_t WarnToggle = 0; // Togglezähler zum blinken |
volatile uint16_t WarnTime = 10; // Länge der LIPO Warnzeit 10 Sek. |
volatile uint16_t PoffTime = 30; // Länge der Wartezeit vor Abschalten 30 Sek. |
volatile uint8_t Display_on;// Flag Display on/off |
unsigned int BeepTime = 0; |
unsigned int BeepMuster = 0xffff; |
unsigned int BeepPrio = 0; |
volatile unsigned int CountMilliseconds = 0; |
// Size of Buffer for Converting unsigned int Value to ASCII |
#define STRING_BUFFER_SIZE 5 |
// Buffer for Converting unsigned int Value to ASCII |
char String_Buffer[STRING_BUFFER_SIZE]; |
//-------------------------------------------------------------- |
// |
void Timer0_Init (void) // System (100Hz) |
{ |
timer = 0; |
TCCR0A = (1 << WGM01); |
TCCR0B = (1 << CS02) | (1 << CS00); |
OCR0A = (F_CPU / (100L * 1024L)) ; |
TIMSK0 |= (1 << OCIE0A); // enable interrupt for OCR |
} |
//-------------------------------------------------------------- |
// |
//void Timer1_Init (void) // Timer 1-A |
//{ |
// // löschen |
// TCCR1A = 0; |
// TCCR1B = 0; |
// TIMSK1 = 0; |
// |
// // setzen |
// TCCR1A |= (1 << COM1A1) | (1 << WGM11); |
// TCCR1B |= (1 << CS11) | (1 << CS10) | (1 << WGM13) | (1 << WGM12); |
// |
// ICR1 = (F_CPU / 64) * 20 / 1000; |
// |
// OCR1A = 470; // ca. Servomitte |
//} |
//-------------------------------------------------------------- |
ISR(TIMER2_COMPA_vect) |
{ |
PORTD |= (1 << PD7); |
} |
ISR(TIMER2_COMPB_vect) |
{ |
PORTD &= ~(1 << PD7); |
} |
//-------------------------------------------------------------- |
////***************************************************************************** |
void Timer2_Init (void) |
{ |
if (Config.HWSound == 1) |
{ /*Sound PWM*/ |
TCCR2A = 0x00; //stop |
ASSR = 0x00; //set async mode |
TCNT2 = 0x00; //setup |
OCR2A = 0xff; |
//Fast PWM 0xFF BOTTOM MAX |
//Set OC2A on Compare Match |
//clkT2S/8 (From prescaler) |
TCCR2A |= (1 << WGM20) | (1 << WGM21) |(1 << COM2A1) | (1 << COM2A0); |
TCCR2B |= (1 << CS20); |
} |
else |
{ /* Displayhelligkeit*/ |
DDRD |= (1 << DDD7); // PD7 output |
TCCR2A |= (1 << WGM21) | (1 << WGM20) | (1 << COM2A1); // non invers |
TCCR2B |= (1 << CS20); // Prescaler 1/1 |
TIMSK2 |= (1 << OCIE2A) | (1 << OCIE2B); |
OCR2A = 255; |
} |
} |
//***************************************************************************** |
//-------------------------------------------------------------- |
void Timer3_Init (void) // Sound, Timer CTC |
{ |
TCCR3A = 0x00; //stop |
TCNT3H = 0xF8; //set count |
TCNT3L = 0x00; //set count |
OCR3AH = 0x07; //set compare |
OCR3AL = 0xFF; //set compare |
TCCR3A |= (1 << WGM31); |
TCCR3B |= (1 << CS30); |
TIMSK3 |= (1 << OCIE3A); //timer interrupt sources 2=t0 compare |
} |
ISR(TIMER3_COMPA_vect) // Sound |
{ |
//void timer0_comp_isr(void){ |
//was 8 KHz 125usec sampling rate |
//now 12 KHz 83usec sampling rate |
unsigned char oldfpart; |
signed char fullsamp; |
signed int tmp; |
TCNT3=0; |
// tics++; //8 bit... atomic |
if(generate){ |
DDRD |= (1<<DDD7); // Port aus Ausgang |
oldfpart=waveptfpart; //remember fractional part |
waveptfpart+=freqincfpart; //add frac part of freq inc to wave pointer |
if(waveptfpart < oldfpart){ //did it walk off the end? |
waveptipart++; //yes, bump integer part |
} |
waveptipart+=freqincipart; //add int part of freq increment to wave pointer |
fullsamp=sindat[waveptipart]; //get 8 bit sin sample from table (signed) |
tmp=fullsamp*iattenfac; //cvt 7 bit x 8 = 15 bit |
OCR2A=(tmp >> 8)+128; //cvt 15 bit signed to 8 bit unsigned |
} |
else |
DDRD &= ~(1 << DDD7); //Port auf Eingang, sperrt das Rauschen |
} |
//-------------------------------------------------------------- |
ISR(TIMER0_COMPA_vect) // Timer-Interrupt (100 Hz) |
{ |
static uint8_t ct0 = 0; |
static uint8_t ct1 = 0; |
static uint8_t k_time_l = 0; |
static uint8_t k_time_r = 0; |
static uint8_t k_time_lr = 0; |
static uint8_t k_time_rs = 0; |
uint8_t i; |
static unsigned char cnt_1ms = 1,cnt = 0; |
unsigned char beeper_ein = 0; |
// unsigned char pieper_ein = 0; |
// Key handling by Peter Dannegger |
// see www.mikrocontroller.net |
i = key_state ^ ~KEY_PIN; // key changed ? |
ct0 = ~(ct0 & i); // reset or count ct0 |
ct1 = ct0 ^ (ct1 & i); // reset or count ct1 |
i &= (ct0 & ct1); // count until roll over ? |
key_state ^= i; // then toggle debounced state |
key_press |= (key_state & i); // 0->1: key press detect |
// if (PKT_IdleBeep == 1) |
// { |
// IdleTimer ++; // nix zu tun? Timer hochzÀhlen |
// if (IdleTimer == 12000) // Warnhinweis |
// { |
// set_beep ( 200, 0x0080, BeepNormal); |
// IdleTimer = 0; |
// } |
// } |
if (!cnt--) |
{ |
cnt = 9; |
CountMilliseconds++; |
cnt_1ms++; |
} |
if (i!=0) |
{ // Displaylicht einschalten, und bzw. TimeoutzÀhlerreset wenn Taste gedrÌckt wurde |
if (((Config.HWBeeper==1)&&(PCB_Version == PKT39m))||((Config.HWBeeper==0)&&(PCB_Version == PKT39x))) // entweder Beeper oder Display ein/aus |
{ |
if (Display_on == 0) |
set_D_LIGHT(); |
Display_on = 1; // Flag Display on |
DisplayTime = 0; // Timer Reset |
IdleTimer = 0; // Idletimeout Reset |
} |
} |
if (Config.DisplayTimeout > 0) |
{ |
if (((Config.HWBeeper==1)&&(PCB_Version == PKT39m))||((Config.HWBeeper==0)&&(PCB_Version == PKT39x))) // entweder Beeper oder Display ein/aus |
{ |
if (Display_on == 1) |
{ |
DisplayTime++; |
if ((DisplayTime / 100) == Config.DisplayTimeout) // ISR läuft mit 100Hz |
{ // Displaylicht ausschalten |
clr_D_LIGHT(); |
Display_on = 0; // Flag Display off |
} |
} |
} |
} |
//-------------------------------------------------------------- |
#ifdef HWVERSION3_9 |
// LipoCheck(); // Lipo prüfen |
#endif |
//-------------------------------------------------------------- |
if (Config.HWBeeper==1) |
{ |
if (BeepTime) |
{ |
if (BeepTime > 10) |
BeepTime -= 10; |
else |
{ |
BeepTime = 0; |
} |
if (BeepTime & BeepMuster) |
beeper_ein = 1; |
else beeper_ein = 0; |
} |
else |
{ |
beeper_ein = 0; |
BeepMuster = 0xffff; |
BeepPrio = BeepNormal; |
} |
if (beeper_ein==1) |
set_BEEP(); |
else |
clr_BEEP(); |
} |
//Tonausgabe *********************************************************************************************** |
if (sound_timer > 0) // Ton spielen |
{ |
sound_timer --; |
} |
else |
{ |
// TIMSK2 &= ~_BV(TOIE2); // Interrupt sperren, verhindert Störgeräusche |
// TCCR2A = 0x00; //stop |
generate=0; // Sound aus |
tone_handler(); |
if (soundpause_timer > 0) |
{ |
soundpause_timer --; // Ton pause |
} |
} |
//*********************************************************************************************** |
//-------------------------------------------------------------- |
if ((key_state & LONG_MASK) == 0) // check long key function |
k_time_l = REPEAT_START; // start delay |
if (--k_time_l == 0) // long countdown |
key_long |= (key_state & LONG_MASK); |
//-------------------------------------------------------------- |
if ((key_state & REPEAT_MASK) == 0) // check repeat function |
k_time_r = 1; // kein delay |
if (--k_time_r == 0) |
{ |
k_time_r = REPEAT_NEXT; // repeat delay |
key_rpt |= (key_state & REPEAT_MASK); |
} |
//-------------------------------------------------------------- |
if ((key_state & LONG_REPEAT_MASK) == 0) // check repeat function |
k_time_lr = REPEAT_START; // start delay |
if (--k_time_lr == 0) |
{ |
k_time_lr = REPEAT_NEXT; // repeat delay |
key_lrpt |= (key_state & LONG_REPEAT_MASK); |
} |
//-------------------------------------------------------------- |
if ((key_state & LONG_REPEAT_SP_MASK) == 0) // check repeatX function |
k_time_rs = REPEAT_START; // start delay |
if (--k_time_rs == 0) // repeat countdown |
{ |
if (repeat_speed == 1) |
{ |
k_time_rs = REPEAT_SPEED_1; |
key_rpts |= (key_state & LONG_REPEAT_SP_MASK); |
} |
else if (repeat_speed == 2) |
{ |
k_time_rs = REPEAT_SPEED_2; |
key_rpts |= (key_state & LONG_REPEAT_SP_MASK); |
} |
else if (repeat_speed == 3) |
{ |
k_time_rs = REPEAT_SPEED_3; |
key_rpts |= (key_state & LONG_REPEAT_SP_MASK); |
} |
} |
if (timer > 0) |
timer --; |
if (timer2 > 0) |
timer2 --; |
if (abo_timer > 0) |
abo_timer --; |
//24.8.2012 |
// if (receiveNMEA==true) |
// { |
// if (bt_receiveNMEA()) Tracking_NMEA(); |
// else receiveNMEA = false; |
// |
// } |
} |
#ifdef HWVERSION3_9 |
void LipoCheck (void) // Lowbatpin des Spannungswandlers prüfen |
// LBO des LT1308 wechselt zum Ende der Batterielaufzeit häufig seinen Zustand in der Übergangsphase zum LowBat |
// Die Akkuspannung schwankt auch abhängig vom momentanen Stromverbrauch |
{ |
if (WarnToggle == 1) // Beim ersten Auftreten Warnung ausgeben, Rythmus 5/10 Sekunden |
{ |
set_beep ( 1000, 0x0020, BeepNormal); |
lcd_printp_at (0, 0, PSTR(" LIPO !!Warnung!! "), 2); |
} |
if (WarnToggle == WarnTime * 100) |
WarnToggle = 0; // erstmal bis hier warnen |
if (WarnToggle > 0) |
WarnToggle++; // weiter hochzählen |
if (PINC & (1 << LowBat)) // Kurzzeitige Unterspannung bearbeiten und Warnung ausgeben |
{ |
WarnCount = 0; |
// if (WarnCount > 0) |
// WarnCount--; // Bei LIPO OK erstmal runterzählen, LT1308 überlegt sich noch genauer ob nun ok oder nicht |
} |
if (!(PINC & (1 << LowBat)) ) // LT1308 hat Unterspannung erkannt |
{ |
WarnCount++; // solange LBO low ist Zähler hochzählen |
if (WarnCount == 10 && WarnToggle == 0) // mit "10" etwas unempfindlicher gegen kurze Impulse machen |
WarnToggle = 1; // Warnhinweis starten |
} |
if ((WarnCount) == PoffTime * 100) |
clr_V_On(); // Spannung abschalten |
} |
#endif |
//-------------------------------------------------------------- |
unsigned int SetDelay (unsigned int t) |
{ |
return(CountMilliseconds + t + 1); |
} |
//-------------------------------------------------------------- |
char CheckDelay(unsigned int t) |
{ |
return(((t - CountMilliseconds) & 0x8000) >> 9); |
} |
//-------------------------------------------------------------- |
void Delay_ms(unsigned int w) |
{ |
unsigned int akt; |
akt = SetDelay(w); |
while (!CheckDelay(akt)); |
} |
//-------------------------------------------------------------- |
// |
uint8_t get_key_press (uint8_t key_mask) |
{ |
uint8_t sreg = SREG; |
// disable all interrupts |
cli(); |
key_mask &= key_press; // read key(s) |
key_press ^= key_mask; // clear key(s) |
SREG = sreg; // restore status register |
return key_mask; |
} |
//-------------------------------------------------------------- |
// |
uint8_t get_key_short (uint8_t key_mask) |
{ |
uint8_t ret; |
uint8_t sreg = SREG; |
// disable all interrupts |
cli(); |
ret = get_key_press (~key_state & key_mask); |
SREG = sreg; // restore status register |
return ret; |
} |
//-------------------------------------------------------------- |
// |
uint8_t get_key_long (uint8_t key_mask) |
{ |
uint8_t sreg = SREG; |
// disable all interrupts |
cli(); |
key_mask &= key_long; // read key(s) |
key_long ^= key_mask; // clear key(s) |
SREG = sreg; // restore status register |
return get_key_press (get_key_rpt (key_mask)); |
} |
//-------------------------------------------------------------- |
// |
uint8_t get_key_rpt (uint8_t key_mask) |
{ |
uint8_t sreg = SREG; |
// disable all interrupts |
cli(); |
key_mask &= key_rpt; // read key(s) |
key_rpt ^= key_mask; // clear key(s) |
SREG = sreg; // restore status register |
return key_mask; |
} |
//-------------------------------------------------------------- |
// |
uint8_t get_key_long_rpt (uint8_t key_mask) |
{ |
uint8_t sreg = SREG; |
// disable all interrupts |
cli(); |
key_mask &= key_lrpt; // read key(s) |
key_lrpt ^= key_mask; // clear key(s) |
SREG = sreg; // restore status register |
return get_key_rpt (~key_press^key_mask); |
} |
//-------------------------------------------------------------- |
// |
uint8_t get_key_long_rpt_sp (uint8_t key_mask, uint8_t key_speed) |
{ |
uint8_t sreg = SREG; |
// disable all interrupts |
cli(); |
key_mask &= key_rpts; // read key(s) |
key_rpts ^= key_mask; // clear key(s) |
repeat_speed = key_speed; |
SREG = sreg; // restore status register |
return key_mask; |
} |
void set_beep ( uint16_t Time, uint16_t Muster, uint8_t Prio) |
{ |
if (Config.HWBeeper==1) |
{ |
if (Prio == BeepNormal) |
{ |
if (BeepPrio == BeepNormal) // nur setzen wenn keine hohe Prio schon aktiv ist |
{ |
BeepTime = Time; |
BeepMuster = Muster; |
} |
} |
if (Prio == BeepSevere) |
{ |
if (!BeepPrio == BeepSevere) |
{ |
BeepPrio = BeepSevere; // hohe Prio setzen |
BeepTime = Time; |
BeepMuster = Muster; |
} |
} |
if (Prio == BeepOff) |
{ |
BeepPrio = BeepNormal; // Beep hohe Prio aus |
BeepTime = 0; |
BeepMuster = 0; |
} |
} |
else |
{ |
if (Prio == BeepNormal) |
{ |
if (BeepPrio == BeepNormal) // nur setzen wenn keine hohe Prio schon aktiv ist |
{ |
playTone(900,Time/10,0); |
} |
} |
if (Prio == BeepSevere) |
{ |
if (!BeepPrio == BeepSevere) |
{ |
playTone(1200,Time/10,0); |
playTone(1100,Time/10,0); |
} |
} |
if (Prio == BeepOff) |
{ |
playTone(0,0,0); |
} |
} |
} |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/timer/timer.h |
---|
0,0 → 1,96 |
/***************************************************************************** |
* Copyright (C) 2008 Thomas Kaiser, thomas@ft-fanpage.de * |
* Copyright (C) 2009 Peter "woggle" Mack, mac@denich.net * |
* based on the key handling by Peter Dannegger * |
* see www.mikrocontroller.net * |
* Copyright (C) 2011 Christian "Cebra" Brandtner, brandtner@brandtner.net * |
* Copyright (C) 2011 Harald Bongartz * |
* * |
* This program is free software; you can redistribute it and/or modify * |
* it under the terms of the GNU General Public License as published by * |
* the Free Software Foundation; either version 2 of the License. * |
* * |
* This program is distributed in the hope that it will be useful, * |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
* GNU General Public License for more details. * |
* * |
* You should have received a copy of the GNU General Public License * |
* along with this program; if not, write to the * |
* Free Software Foundation, Inc., * |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
* * |
* * |
* Credits to: * |
* Holger Buss & Ingo Busker from mikrokopter.de for the MK project + SVN * |
* http://www.mikrokopter.de * |
* Gregor "killagreg" Stobrawa for his version of the MK code * |
* Thomas Kaiser "thkais" for the original project. See * |
* http://www.ft-fanpage.de/mikrokopter/ * |
* http://forum.mikrokopter.de/topic-4061-1.html * |
* Claas Anders "CaScAdE" Rathje for providing the font and his C-OSD code * |
* http://www.mylifesucks.de/oss/c-osd/ * |
* Harald Bongartz "HaraldB" for providing his Ideas and Code for usibility* |
*****************************************************************************/ |
#ifndef _TIMER_H |
#define _TIMER_H |
#include "../cpu.h" |
#include "../main.h" |
#define KEY_ALL ((1 << KEY_PLUS) | (1 << KEY_MINUS) | (1 << KEY_ENTER) | (1 << KEY_ESC)) |
#define LONG_MASK ((1 << KEY_PLUS) | (1 << KEY_MINUS) | (1 << KEY_ENTER) | (1 << KEY_ESC)) |
#define REPEAT_MASK ((1 << KEY_PLUS) | (1 << KEY_MINUS) | (1 << KEY_ENTER) | (1 << KEY_ESC)) |
#define LONG_REPEAT_MASK ((1 << KEY_PLUS) | (1 << KEY_MINUS) | (1 << KEY_ENTER) | (1 << KEY_ESC)) |
#define LONG_REPEAT_SP_MASK ((1 << KEY_PLUS) | (1 << KEY_MINUS) | (1 << KEY_ENTER) | (1 << KEY_ESC)) |
#define REPEAT_START 70 // after 700ms |
#define REPEAT_NEXT 15 // every 150ms |
#define REPEAT_SPEED_1 20 // every 200ms |
#define REPEAT_SPEED_2 8 // every 80ms |
#define REPEAT_SPEED_3 1 // every 10ms |
#define BeepNormal 0 // Normal Beep |
#define BeepSevere 1 // schwerer Fehler, Beep nicht unterbrechbar |
#define BeepOff 2 // Beep aus |
#define ABO_TIMEOUT 300 // 3 sec |
extern volatile uint8_t Display_on; |
extern volatile uint16_t IdleTimer; |
extern volatile uint16_t timer; |
extern volatile uint16_t timer2; |
extern volatile uint16_t abo_timer; |
extern volatile uint16_t sound_timer; |
extern volatile uint16_t soundpause_timer; |
//extern volatile uint16_t WarnCount; |
//extern volatile unsigned int BeepTime; |
extern unsigned int BeepTime; |
extern unsigned int BeepMuster; |
void Timer0_Init (void); // Systeminterrupt |
void Timer1_Init (void); // Servotester |
void Timer2_Init (void); // Displayhelligkeit |
void Timer3_Init (void); // Überwachung |
uint8_t get_key_press (uint8_t key_mask); // sofort beim drücken |
uint8_t get_key_short (uint8_t key_mask); // erst beim loslassen |
uint8_t get_key_long (uint8_t key_mask); // verzögert |
uint8_t get_key_rpt (uint8_t key_mask); // mit verzögerung |
uint8_t get_key_long_rpt (uint8_t key_mask); // |
uint8_t get_key_long_rpt_sp (uint8_t key_mask, uint8_t key_speed); // mit verzögerung und 3 versch. geschw. |
void set_beep ( uint16_t Time, uint16_t Muster, uint8_t Prio); |
extern volatile unsigned int CountMilliseconds; |
void Delay_ms(unsigned int); |
unsigned int SetDelay (unsigned int t); |
char CheckDelay (unsigned int t); |
void LipoCheck (void); // Lowbatpin des Spannungswandlers prüfen |
#endif |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/tools.c |
---|
0,0 → 1,356 |
/***************************************************************************** |
* Copyright (C) 2008 Thomas Kaiser, thomas@ft-fanpage.de * |
* Copyright (C) 2009 Peter "woggle" Mack, mac@denich.net * |
* Copyright (C) 2011 Christian "Cebra" Brandtner, brandtner@brandtner.net * |
* Copyright (C) 2011 Harald Bongartz * |
* * |
* This program is free software; you can redistribute it and/or modify * |
* it under the terms of the GNU General Public License as published by * |
* the Free Software Foundation; either version 2 of the License. * |
* * |
* This program is distributed in the hope that it will be useful, * |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
* GNU General Public License for more details. * |
* * |
* You should have received a copy of the GNU General Public License * |
* along with this program; if not, write to the * |
* Free Software Foundation, Inc., * |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
* * |
* * |
* Credits to: * |
* Holger Buss & Ingo Busker from mikrokopter.de for the MK project + SVN * |
* http://www.mikrokopter.de * |
* Gregor "killagreg" Stobrawa for his version of the MK code * |
* Thomas Kaiser "thkais" for the original project. See * |
* http://www.ft-fanpage.de/mikrokopter/ * |
* http://forum.mikrokopter.de/topic-4061-1.html * |
* Claas Anders "CaScAdE" Rathje for providing the font and his C-OSD code * |
* http://www.mylifesucks.de/oss/c-osd/ * |
* Harald Bongartz "HaraldB" for providing his Ideas and Code for usibility* |
*****************************************************************************/ |
#include "cpu.h" |
#include <avr/io.h> |
#include <avr/interrupt.h> |
#include <avr/pgmspace.h> |
#include <string.h> |
#include <stdlib.h> |
#include <stdbool.h> |
#include <util/delay.h> |
#include "main.h" |
#include "setup/setup.h" |
#include "lcd/lcd.h" |
#include "menu.h" |
#include "tracking/servo.h" |
#include "motortest/motortest.h" |
#include "eeprom/eeprom.h" |
#include "timer/timer.h" |
#include "connect.h" |
#ifdef HWVERSION3_9 |
#include "HAL_HW3_9.h" |
#endif |
#ifdef HWVERSION1_3 |
#include "HAL_HW1_3.h" |
#endif |
//#include "voltmeter.h" |
#include "lipo/lipo.h" |
#include "messages.h" |
#include "menu.h" |
//-------------------------------------------------------------- |
#define ITEMS_TOOLS 6 |
const prog_char tools_menuitems_pkt[ITEMS_TOOLS][NUM_LANG][18]= // zeilen,zeichen+1 |
// German, English, French, Netherlands |
{ |
{"Motor Tester ","Motor Tester ","Motor Tester "}, |
{"Servo Tester ","Servo Tester ","Servo Tester "}, |
{"PC BT > Kopter ","PC BT > Kopter ","PC BT > Kopter "}, |
{"PC USB > Kopter ","PC USB > Kopter ","PC USB > Kopter "}, |
{"PKT Setup \x1d","PKT Setup \x1d","PKT Setup \x1d"}, |
{"PKT Version ","PKT Version ","PKT Version "}, |
}; |
//-------------------------------------------------------------- |
void PKT_Tools (void) |
{ |
// ii = 0; |
// offset = 0; |
// size = 0; |
// size = ITEMS_PKT ; |
// dmode = 0; |
target_pos = 1; |
// val = 0; |
// uint8_t ii = 0; |
// uint8_t offset = 0; |
// uint8_t size = 0; |
// |
// uint8_t dmode = 0; |
// uint8_t target_pos = 1; |
// uint8_t val; |
while(1) |
{ |
size = ITEMS_TOOLS ; |
lcd_cls (); |
lcd_printp_at (0, 0, PSTR(" PKT-Tools "), 2); |
lcd_puts_at(0, 7, strGet(KEYLINE1), 0); |
// while(2) |
// { |
// ii = 0; |
// if(offset > 0) |
// { |
// lcd_printp_at(1,1, PSTR("\x12"), 0); |
// } |
// for(ii = 0;ii < 6 ; ii++) |
// { |
// if((ii+offset) < size) |
// { |
// lcd_printp_at(3,ii+1,tools_menuitems_pkt[ii+offset][Config.DisplayLanguage], 0); |
// } |
// if((ii == 5)&&(ii+offset < (size-1))) |
// { |
// lcd_printp_at(1,6, PSTR("\x13"), 0); |
// } |
// } |
// if(dmode == 0) |
// { |
// if(offset == 0) |
// { |
// if(size > 6) |
// { |
// val = menu_choose2 (1, 5, target_pos,0,1); |
// } |
// else |
// { |
// val = menu_choose2 (1, size, target_pos,0,0); |
// } |
// } |
// else |
// { |
// val = menu_choose2 (2, 5, target_pos,1,1); |
// } |
// } |
// if(dmode == 1) |
// { |
// if(offset+7 > size) |
// { |
// val = menu_choose2 (2, 6, target_pos,1,0); |
// } |
// else |
// { |
// val = menu_choose2 (2, 5, target_pos,1,1); |
// } |
// } |
// if(val == 254) |
// { |
// offset++; |
// dmode = 1; |
// target_pos = 5; |
// } |
// else if(val == 253) |
// { |
// offset--; |
// dmode = 0; |
// target_pos = 2; |
// } |
// else if(val == 255) |
// { |
// return; |
// } |
// else |
// { |
// break; |
// } |
// |
// } |
val = menu_select(tools_menuitems_pkt,size,target_pos); |
if (val==255) break; |
target_pos = val; |
if((val+offset) == 1 ) |
motor_test(FC_Mode); |
if((val+offset) == 2 ) |
servo_test(); |
#ifdef HWVERSION3_9 |
if(Config.U02SV2 == 0) |
{ |
if((val+offset) == 3 ) |
Port_BT2Wi(); |
if((val+offset) == 4 ) |
Port_USB2Wi(); |
} |
else if(Config.U02SV2 == 1) |
{ |
if((val+offset) == 3 ) |
Port_BT2FC(); |
if((val+offset) == 4 ) |
Port_USB2FC(); |
} |
#else |
if((val+offset) == 3 ) |
Show_Error_HW(); |
if((val+offset) == 4 ) |
Show_Error_HW(); |
#endif |
if((val+offset) == 5) |
PKT_Setup(); |
if((val+offset) == 6) |
Show_Version(); |
} |
} |
//-------------------------------------------------------------- |
// |
void PC_Fast_Connect (void) |
{ |
uint8_t value = 1; |
while(1) |
{ |
lcd_cls(); |
// lcd_printp_at (0, 0, PSTR(" PC-Quick-Verbindung "), 2); |
lcd_puts_at(0, 8, strGet(TOOLS1), 2); |
lcd_printp_at (3, 3, PSTR("PC BT > Kopter"), 0); |
lcd_printp_at (3, 4, PSTR("PC USB > Kopter"), 0); |
// lcd_printp_at (0, 7, PSTR(KEY_LINE_1), 0); |
lcd_puts_at(0, 7, strGet(KEYLINE1), 0); |
// lcd_puts_at(0, 7, strGet(KEYLINE1), 0); |
while(2) |
{ |
if(value == 1) |
{ |
lcd_printp_at (1, 3, PSTR("\x1d"), 0); |
lcd_printp_at (1, 4, PSTR(" "), 0); |
} |
else |
{ |
lcd_printp_at (1, 3, PSTR(" "), 0); |
lcd_printp_at (1, 4, PSTR("\x1d"), 0); |
} |
if(get_key_press (1 << KEY_MINUS)) |
value = 1; |
if(get_key_press (1 << KEY_PLUS)) |
value = 2; |
if(get_key_short (1 << KEY_ENTER)) |
{ |
#ifdef HWVERSION3_9 |
if(Config.U02SV2 == 0) |
{ |
if(value == 1) |
Port_BT2Wi(); |
if(value == 2) |
Port_USB2Wi(); |
} |
else if(Config.U02SV2 == 1) |
{ |
if(value == 1) |
Port_BT2FC(); |
if(value == 2) |
Port_USB2FC(); |
} |
#else |
if(value == 1) |
Show_Error_HW(); |
if(value == 2) |
Show_Error_HW(); |
#endif |
break; |
} |
if(get_key_press (1 << KEY_ESC)) |
{ |
get_key_press(KEY_ALL); |
return; |
} |
} |
} |
} |
//void Test_HB (void) // bleibt für Tests |
//{ |
//#ifdef HWVERSION3_9 |
//// ADC_Init(); |
//// |
//// uint16_t volt_avg = 0; |
////// uint64_t volt_tmp = 0; |
//// uint16_t Balken = 0; |
// |
// |
// lcd_cls(); |
// lcd_printp_at(12, 7, PSTR("Ende"), 0); |
// |
//// lcd_rect(104, 0, 23, 8, 1); // Rahmen |
// |
// do |
// { |
//// |
//// |
// if(samples>4095) |
// { |
//// write_ndigit_number_u(0, 4, accumulator, 5, 0); |
// oversampled(); |
// volt_avg = Vin; |
// } |
//// // write_ndigit_number_u(0, 3, samples, 5, 0); |
//// |
////// write_ndigit_number_u(0, 1, Vin, 5, 0); |
//// _delay_ms(50); |
// |
// show_Lipo(); |
// |
// write_ndigit_number_u_100th(5, 5, volt_avg, 0, 0); |
// lcd_printp_at(10, 5, PSTR("Volt"), 0); |
//// |
//// |
//// |
// write_ndigit_number_u(0, 6, Config.Lipo_UOffset, 5, 0,0); |
//// write_ndigit_number_u(15, 6, WarnCount, 4, 0); |
////// write_ndigit_number_u(10, 5, Vcorr, 4, 0); |
// |
// |
// if (get_key_press (1 << KEY_PLUS) | get_key_long_rpt_sp ((1 << KEY_PLUS), 3)) |
// { |
// Config.Lipo_UOffset = Config.Lipo_UOffset +10; |
// } |
// |
// if (get_key_press (1 << KEY_MINUS) | get_key_long_rpt_sp ((1 << KEY_MINUS),3)) |
// { |
// Config.Lipo_UOffset = Config.Lipo_UOffset -10; |
// } |
//// |
// } |
// |
// |
// while(!get_key_press (1 << KEY_ESC)); |
// get_key_press(KEY_ALL); |
// return; |
//#endif |
//} |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/tools.h |
---|
0,0 → 1,41 |
/***************************************************************************** |
* Copyright (C) 2008 Thomas Kaiser, thomas@ft-fanpage.de * |
* Copyright (C) 2009 Peter "woggle" Mack, mac@denich.net * |
* Copyright (C) 2011 Christian "Cebra" Brandtner, brandtner@brandtner.net * |
* Copyright (C) 2011 Harald Bongartz * |
* * |
* This program is free software; you can redistribute it and/or modify * |
* it under the terms of the GNU General Public License as published by * |
* the Free Software Foundation; either version 2 of the License. * |
* * |
* This program is distributed in the hope that it will be useful, * |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
* GNU General Public License for more details. * |
* * |
* You should have received a copy of the GNU General Public License * |
* along with this program; if not, write to the * |
* Free Software Foundation, Inc., * |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
* * |
* * |
* Credits to: * |
* Holger Buss & Ingo Busker from mikrokopter.de for the MK project + SVN * |
* http://www.mikrokopter.de * |
* Gregor "killagreg" Stobrawa for his version of the MK code * |
* Thomas Kaiser "thkais" for the original project. See * |
* http://www.ft-fanpage.de/mikrokopter/ * |
* http://forum.mikrokopter.de/topic-4061-1.html * |
* Claas Anders "CaScAdE" Rathje for providing the font and his C-OSD code * |
* http://www.mylifesucks.de/oss/c-osd/ * |
* Harald Bongartz "HaraldB" for providing his Ideas and Code for usibility* |
*****************************************************************************/ |
#ifndef _tools_H |
#define _tools_H |
void PKT_Tools (void); |
void Test_HB (void); // TestTool für Softwareentwicklung |
#endif |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/tracking/.directory |
---|
0,0 → 1,3 |
[Dolphin] |
Timestamp=2013,1,9,0,38,51 |
ViewMode=1 |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/tracking/filedetails.pdf |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/tracking/mymath.c |
---|
0,0 → 1,187 |
/****************************************************************/ |
/* */ |
/* NG-Video 5,8GHz */ |
/* */ |
/* Copyright (C) 2011 - gebad */ |
/* */ |
/* This code is distributed under the GNU Public License */ |
/* which can be found at http://www.gnu.org/licenses/gpl.txt */ |
/* */ |
/****************************************************************/ |
#include <stdio.h> |
#include <stdlib.h> |
#include <math.h> |
#include <avr/pgmspace.h> |
#include "mymath.h" |
// http://www.mikrocontroller.net/articles/AVR_Arithmetik#avr-gcc_Implementierung_.2832_Bit.29 |
unsigned int sqrt32(uint32_t q) |
{ uint16_t r, mask; |
uint16_t i = 8*sizeof (r) -1; |
r = mask = 1 << i; |
for (; i > 0; i--) { |
mask >>= 1; |
if (q < (uint32_t) r*r) |
r -= mask; |
else |
r += mask; |
} |
if (q < (uint32_t) r*r) |
r -= 1; |
return r; |
} |
// aus Orginal MK source code |
// sinus with argument in degree at an angular resolution of 1 degree and a discretisation of 13 bit. |
const uint16_t sinlookup[91] = {0, 143, 286, 429, 571, 714, 856, 998, 1140, 1282, 1423, 1563, 1703, \ |
1843, 1982, 2120, 2258, 2395, 2531, 2667, 2802, 2936, 3069, 3201, 3332, \ |
3462, 3591, 3719, 3846, 3972, 4096, 4219, 4341, 4462, 4581, 4699, 4815, \ |
4930, 5043, 5155, 5266, 5374, 5482, 5587, 5691, 5793, 5893, 5991, 6088, \ |
6183, 6275, 6366, 6455, 6542, 6627, 6710, 6791, 6870, 6947, 7022, 7094, \ |
7165, 7233, 7299, 7363, 7424, 7484, 7541, 7595, 7648, 7698, 7746, 7791, \ |
7834, 7875, 7913, 7949, 7982, 8013, 8041, 8068, 8091, 8112, 8131, 8147, \ |
8161, 8172, 8181, 8187, 8191, 8192}; |
//double c_cos_8192(int16_t angle) |
int16_t c_cos_8192(int16_t angle) |
{ |
int8_t m,n; |
int16_t sinus; |
angle = 90 - angle; |
// avoid negative angles |
if (angle < 0) |
{ |
m = -1; |
angle = -angle; |
} |
else m = +1; |
// fold angle to interval 0 to 359 |
angle %= 360; |
// check quadrant |
if (angle <= 90) n = 1; // first quadrant |
else if ((angle > 90) && (angle <= 180)) {angle = 180 - angle; n = 1;} // second quadrant |
else if ((angle > 180) && (angle <= 270)) {angle = angle - 180; n = -1;} // third quadrant |
else {angle = 360 - angle; n = -1;} //fourth quadrant |
// get lookup value |
sinus = sinlookup[angle]; |
// calculate sinus value |
return (sinus * m * n); |
} |
/* ---------------------------------------------------------------------------------------------- |
atan2.S |
Author: Reiner Patommel |
atan2.S uses CORDIC, an algorithm which was developed in 1956 by Jack Volder. |
CORDIC can be used to calculate trigonometric, hyperbolic and linear |
functions and is until today implemented in most pocket calculators. |
The algorithm makes only use of simple integer arithmetic. |
The CORDIC equations in vectoring mode for trigonometric functions are: |
Xi+1 = Xi - Si * (Yi * 1 / 2^i) |
Yi+1 = Yi + Si * (Xi * 1 / 2^i) |
Zi+1 = Zi - Si * atan(1 / 2^i) |
where Si = +1 if Yi < 0 else Si = -1 |
The rotation angles are limited to -PI/2 and PI/2 i.e. |
-90 degrees ... +90 degrees |
For the calculation of atan2(x,y) we need a small pre-calculated table of |
angles or radians with the values Tn = atan(1/2^i). |
We rotate the vector(Xo,Yo) in steps to the x-axis i.e. we drive Y to 0 and |
accumulate the rotated angles or radians in Z. The direction of the rotation |
will be positive or negative depending on the sign of Y after the previous |
rotation and the rotation angle will decrease from step to step. (The first |
step is 45 degrees, the last step is 0.002036 degrees for n = 15). |
After n rotations the variables will have the following values: |
Yn = ideally 0 |
Xn = c*sqrt(Xo^2+Yo^2) (magnitude of the vector) |
Zn = Zo+atan(Yo/Xo) (accumulated rotation angles or radians) |
c, the cordic gain, is the product Pn of sqrt(1+2^(-2i)) and amounts to |
approx. 1.64676 for n = 15. |
In order to represent X, Y and Z as integers we introduce a scaling factor Q |
which is chosen as follows: |
1. We normalize Xo and Yo (starting values) to be less than or equal to 1*Q and |
set Zo = 0 i.e. Xomax = 1*Q, Yomax = 1*Q, Zo = 0. |
2. With Xo = 1*Q and Yo = 1*Q, Xn will be Xnmax = Q*c*sqrt(2) = 2.329*Q |
3. In order to boost accuracy we only cover the rotation angles between 0 and PI/2 |
i.e. X and Z are always > 0 and therefore can be unsigned. |
(We do the quadrant correction afterwards based on the initial signs of x and y) |
4. If X is an unsigned int, Xnmax = 65536, and Q = 65536/2.329 = 28140. |
i.e. |
Xnmax = 65536 --> unsigned int |
Ynmax = +/- 28140 --> signed int |
Znmax = PI/2 * 28140 = 44202 --> unsigned int |
The systematic error is 90/44202 = 0.002036 degrees or 0.0000355 rad. |
Below is atan2 and atan in C: */ |
#define getAtanVal(x) (uint16_t)pgm_read_word(&atantab[x]) |
uint16_t atantab[T] PROGMEM = {22101,13047,6894,3499,1756,879,440,220,110,55,27,14,7,3,2,1}; |
int16_t my_atan2(int32_t y, int32_t x) |
{ unsigned char i; |
uint32_t xQ; |
int32_t yQ; |
uint32_t angle = 0; |
uint32_t tmp; |
double x1, y1; |
x1 = abs(x); |
y1 = abs(y); |
if (y1 == 0) { |
if (x < 0) |
return (180); |
else |
return 0; |
} |
if (x1 < y1) { |
x1 /= y1; |
y1 = 1; |
} |
else { |
y1 /= x1; |
x1 = 1; |
} |
xQ = SCALED(x1); |
yQ = SCALED(y1); |
for (i = 0; i < T-1; i++) { |
tmp = xQ >> i; |
if (yQ < 0) { |
xQ -= yQ >> i; |
yQ += tmp; |
angle -= getAtanVal(i); |
} |
else { |
xQ += yQ >> i; |
yQ -= tmp; |
angle += getAtanVal(i); |
} |
} |
angle = RAD_TO_DEG * angle/Q; |
if (x <= 0) |
angle = 180 - angle; |
if (y <= 0) |
return(-angle); |
return(angle); |
} |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/tracking/mymath.h |
---|
0,0 → 1,15 |
#ifndef _MYMATH_H_ |
#define _MYMATH_H_ |
#include <avr/io.h> |
#define T 16 |
#define Q 28140 |
#define SCALED(X) ((int32_t)((X) * Q)) |
#define RAD_TO_DEG 57.2957795 // radians to degrees = 180 / PI |
uint16_t sqrt32(uint32_t qzahl); |
int16_t c_cos_8192(int16_t angle); |
int16_t my_atan2(int32_t y, int32_t x); |
#endif |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/tracking/ng_servo.c |
---|
0,0 → 1,223 |
/********************************************************************/ |
/* */ |
/* NG-Video 5,8GHz */ |
/* */ |
/* Copyright (C) 2011 - gebad */ |
/* */ |
/* This code is distributed under the GNU Public License */ |
/* which can be found at http://www.gnu.org/licenses/gpl.txt */ |
/* */ |
/* using */ |
/*! \file servo.c \brief Interrupt-driven RC Servo function library.*/ |
/* */ |
/*File Name : 'servo.c' */ |
/*Title : Interrupt-driven RC Servo function library */ |
/*Author : Pascal Stang - Copyright (C) 2002 */ |
/*Created : 7/31/2002 */ |
/*Revised : 8/02/2002 */ |
/*Version : 1.0 */ |
/*Target MCU : Atmel AVR Series */ |
/*Editor Tabs : 2 */ |
/* */ |
/*This code is distributed under the GNU Public License */ |
/* which can be found at http://www.gnu.org/licenses/gpl.txt */ |
/* */ |
/********************************************************************/ |
#include <avr/interrupt.h> |
#include <avr/io.h> |
#include "../tracking/ng_servo.h" |
#include "../tracking/tracking.h" |
#include "../HAL_HW3_9.h" |
#include "../eeprom/eeprom.h" |
//#include "config.h" |
// Global variables |
uint16_t ServoPosTics; |
uint16_t ServoPeriodTics; |
// servo channel registers |
ServoChannelType ServoChannels[SERVO_NUM_CHANNELS]; |
const ServoConst_t ServoConst[2] = {{SERVO_MAX, SERVO_MIN, SERVO_STEPS, SERVO_PRESCALER}, |
{SERVO_MAX * 4, SERVO_MIN * 4, (SERVO_STEPS + 1) * 4 - 1, SERVO_PRESCALER / 4}}; |
// Servo limits (depend on hardware) |
const servo_limit_t servo_limit[2][3] = {{{SERVO_I0_RIGHT_MIN, SERVO_I0_RIGHT_MAX}, |
{SERVO_I0_LEFT_MIN, SERVO_I0_LEFT_MAX}, |
{SERVO_I0_MIDDLE_MIN, SERVO_I0_MIDDLE_MAX}}, |
{{SERVO_I1_RIGHT_MIN, SERVO_I1_RIGHT_MAX}, |
{SERVO_I1_LEFT_MIN, SERVO_I1_LEFT_MAX}, |
{SERVO_I1_MIDDLE_MIN, SERVO_I1_MIDDLE_MAX}}}; |
// Servopositionen normiert für 950µs, 2,05ms und 1,5ms ==> Ergebnis Schritte. Da Zeit in µs ist F_CPU*e-1 |
const steps_pw_t steps_pw[2] = {{(uint64_t)950*F_CPU*1e-6/SERVO_PRESCALER + 0.5, (uint64_t)2050*F_CPU*1e-6/SERVO_PRESCALER + 0.5,(uint64_t)1500*F_CPU*1e-6/SERVO_PRESCALER + 0.5}, |
{(uint64_t)950*4*F_CPU*1e-6/SERVO_PRESCALER + 0.5, (uint64_t)2050*4*F_CPU*1e-6/SERVO_PRESCALER + 0.5, (uint64_t)1500*4*F_CPU*1e-6/SERVO_PRESCALER + 0.5}}; |
// anzufahrende Servopositionen 0=MIN, 1=MID, 2=MAX |
const uint8_t PosIdx[POSIDX_MAX] = {1, 0, 1, 2 }; |
// functions |
void servo_test(void) |
{ |
//Dummy |
} |
//! initializes software PWM system 16-bit Timer |
// normaler Weise wird ein Serv-PWM Signal aller 20ms wiederholt |
// Werte: rev, min, max, mid vorher über servoSet...() initialisieren und einmal servoSetPosition(...) ausführen!!! |
void servoInit(uint8_t servo_period) |
{ uint16_t OCValue; // set initial interrupt time |
// disble Timer/Counter1, Output Compare A Match Interrupt |
TIMSK1 &= ~(1<<OCIE1A); |
// set the prescaler for timer1 |
if (Config.sIdxSteps == STEPS_255) { |
TCCR1B &= ~((1<<CS11) | (1<<CS10)); |
TCCR1B |= (1<<CS12); // prescaler 256, Servo-Schritte 185 bei 180 grd Winkel |
} |
else { |
TCCR1B &= ~(1<<CS12); |
TCCR1B |= (1<<CS11) | (1<<CS10); // prescaler 64, Servo-Schritte 740 bei 180 grd Winkel |
} |
// attach the software PWM service routine to timer1 output compare A |
// timerAttach(TIMER1OUTCOMPAREA_INT, servoService); |
// enable channels |
for(uint8_t channel=0; channel < SERVO_NUM_CHANNELS; channel++) { |
// set default pins assignments SERVO2 Pin 4; SERVO1 Pin 5 |
ServoChannels[channel].pin = (1 << (SERVO2 + channel)); |
} |
ServoPosTics = 0; // set PosTics |
// set PeriodTics |
ServoPeriodTics = F_CPU / ServoConst[Config.sIdxSteps].prescaler * servo_period * 1e-3; |
// read in current value of output compare register OCR1A |
OCValue = OCR1AL; // read low byte of OCR1A |
OCValue += (OCR1AH << 8); // read high byte of OCR1A |
OCValue += ServoPeriodTics; // increment OCR1A value by nextTics |
// set future output compare time to this new value |
OCR1AH = OCValue >> 8; // write high byte |
OCR1AL = OCValue & 0x00FF; // write low byte |
TIMSK1 |= (1<<OCIE1A); // enable the timer1 output compare A interrupt |
coldstart = 1; |
} |
void servoSetDefaultPos(void) |
{ |
servoSetPosition(SERVO_PAN, ServoSteps()); // Ausgangsstellung SERVO_PAN |
servoSetPosition(SERVO_TILT,ServoSteps()); // Ausgangsstellung SERVO_TILT |
} |
uint16_t pw_us(uint16_t Steps) |
{ |
return(Steps * ServoConst[Config.sIdxSteps].prescaler/(F_CPU * 1e-6) + 0.5); // Zeit pro Schritt (Wert * e-1) in µs |
} |
uint16_t ServoSteps(void) |
{ |
return(ServoConst[Config.sIdxSteps].steps); |
} |
void servoSet_rev(uint8_t channel, uint8_t val) |
{ |
ServoChannels[channel].rev = val & 0x01; |
} |
void servoSet_min(uint8_t channel, uint16_t min) |
{ |
ServoChannels[channel].min = ServoConst[Config.sIdxSteps].min + min; |
} |
void servoSet_max(uint8_t channel, uint16_t max) |
{ |
ServoChannels[channel].max = ServoConst[Config.sIdxSteps].max - max; |
} |
void servoSet_mid(uint8_t channel, uint16_t mid) |
{ |
ServoChannels[channel].mid = mid; |
// Faktor 16, bzw. 16/2 um mit einer Nachkommastelle zu Rechnen |
ServoChannels[channel].mid_scaled = (8 * (ServoChannels[channel].max - ServoChannels[channel].min) + \ |
(16 * mid - 8 * ServoConst[Config.sIdxSteps].steps))/16 + ServoChannels[channel].min; |
} |
//! turns off software PWM system |
void servoOff(void) |
{ |
// disable the timer1 output compare A interrupt |
TIMSK1 &= ~(1<<OCIE1A); |
} |
//! set servo position on channel (raw unscaled format) |
void servoSetPositionRaw(uint8_t channel, uint16_t position) |
{ |
// bind to limits |
if (position < ServoChannels[channel].min) position = ServoChannels[channel].min; |
if (position > ServoChannels[channel].max) position = ServoChannels[channel].max; |
// set position |
ServoChannels[channel].duty = position; |
} |
//! set servo position on channel |
// input should be between 0 and ServoSteps() (entspricht Maximalausschlag) |
void servoSetPosition(uint8_t channel, uint16_t position) |
{ uint16_t pos_scaled; |
// calculate scaled position |
if (ServoChannels[channel].rev != 0) position = ServoConst[Config.sIdxSteps].steps - position; |
if (position < ServoConst[Config.sIdxSteps].steps/2) |
//bei Position < Servomittelstellung Position*(Mitte - Min)/(Servoschritte/2) |
pos_scaled = ServoChannels[channel].min + ((int32_t)position*2*(ServoChannels[channel].mid_scaled-ServoChannels[channel].min))/ \ |
ServoConst[Config.sIdxSteps].steps; |
else |
//bei Position >= Servomittelstellung |
pos_scaled = ServoChannels[channel].mid_scaled + (uint32_t)(position - ServoConst[Config.sIdxSteps].steps / 2) \ |
* 2 * (ServoChannels[channel].max-ServoChannels[channel].mid_scaled)/ServoConst[Config.sIdxSteps].steps; |
// set position |
servoSetPositionRaw(channel, pos_scaled); |
} |
// Umrechnung Winkel in Servoschritte |
void servoSetAngle(uint8_t servo_nr, int16_t angle) |
{ |
servoSetPosition(servo_nr, (uint16_t)((uint32_t)angle * ServoConst[Config.sIdxSteps].steps / 180)); |
} |
//Interruptroutine |
ISR(TIMER1_COMPA_vect) |
{ static uint8_t ServoChannel; |
uint16_t nextTics; |
uint16_t OCValue; // schedule next interrupt |
if(ServoChannel < SERVO_NUM_CHANNELS) { |
PORTD &= ~ServoChannels[ServoChannel].pin; // turn off current channel |
} |
ServoChannel++; // next channel |
if(ServoChannel != SERVO_NUM_CHANNELS) { |
// loop to channel 0 if needed |
if(ServoChannel > SERVO_NUM_CHANNELS) ServoChannel = 0; |
// turn on new channel |
PORTD |= ServoChannels[ServoChannel].pin; |
// schedule turn off time |
nextTics = ServoChannels[ServoChannel].duty; |
} |
else { |
// ***we could save time by precalculating this |
// schedule end-of-period |
nextTics = ServoPeriodTics-ServoPosTics; |
} |
// read in current value of output compare register OCR1A |
OCValue = OCR1AL; // read low byte of OCR1A |
OCValue += (OCR1AH <<8); // read high byte of OCR1A |
OCValue += nextTics; // increment OCR1A value by nextTics |
// set future output compare time to this new value |
OCR1AH = OCValue >> 8; // write high byte |
OCR1AL = OCValue & 0x00FF; // write low byte |
ServoPosTics += nextTics; // set our new tic position |
if(ServoPosTics >= ServoPeriodTics) ServoPosTics = 0; |
} |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/tracking/ng_servo.h |
---|
0,0 → 1,190 |
/*********************************************************************/ |
/* */ |
/* NG-Video 5,8GHz */ |
/* */ |
/* Copyright (C) 2011 - gebad */ |
/* */ |
/* This code is distributed under the GNU Public License */ |
/* which can be found at http://www.gnu.org/licenses/gpl.txt */ |
/* */ |
/* using */ |
/*! \file servo.c \brief Interrupt-driven RC Servo function library. */ |
/* */ |
/*File Name : 'servo.c' */ |
/*Title : Interrupt-driven RC Servo function library */ |
/*Author : Pascal Stang - Copyright (C) 2002 */ |
/*Created : 7/31/2002 */ |
/*Revised : 8/02/2002 */ |
/*Version : 1.0 */ |
/*Target MCU : Atmel AVR Series */ |
/*Editor Tabs : 4 */ |
/* */ |
/*ingroup driver_sw */ |
/*defgroup servo Interrupt-driven RC Servo Function Library (servo.c)*/ |
/*code #include "servo.h" \endcode */ |
/*par Overview */ |
/* */ |
/*This code is distributed under the GNU Public License */ |
/*which can be found at http://www.gnu.org/licenses/gpl.txt */ |
/* */ |
/*********************************************************************/ |
#ifndef SERVO_H |
#define SERVO_H |
/* Servo */ |
#define SERVO_PAN 0 |
#define SERVO_TILT 1 |
#define SERVO_NUM_CHANNELS 2 // Anzahl der angeschlossen Servos max. 2!!! |
/* Servokalibrierungen derzeit zu SERVO_STEPS = 255 skaliert */ |
//prescaler 256 |
#define SERVO_I0_RIGHT 45 // default Wert, ca. 0,9ms |
#define SERVO_I0_RIGHT_MIN 0 // Servokalibrierung Grenze der linken Position |
#define SERVO_I0_RIGHT_MAX 100 // SERVO_MIN + SERVO_RIGHT |
#define SERVO_I0_LEFT 45 // default Wert, ca. 2,1ms |
#define SERVO_I0_LEFT_MIN 0 // Servokalibrierung Grenze der rechten Position |
#define SERVO_I0_LEFT_MAX 100 // SERVO_MAX - SERVO_LEFT |
#define SERVO_I0_MIDDLE SERVO_STEPS/2 |
#define SERVO_I0_MIDDLE_MIN SERVO_STEPS/2 - 25 |
#define SERVO_I0_MIDDLE_MAX SERVO_STEPS/2 + 25 |
//prescaler 64 |
#define SERVO_I1_RIGHT 180 // default Wert, ca. 0,9ms |
#define SERVO_I1_RIGHT_MIN 0 // Servokalibrierung Grenze der linken Position |
#define SERVO_I1_RIGHT_MAX 400 // SERVO_MIN + SERVO_RIGHT |
#define SERVO_I1_LEFT 180 // default Wert, ca. 2,1ms |
#define SERVO_I1_LEFT_MIN 0 // Servokalibrierung Grenze der rechten Position |
#define SERVO_I1_LEFT_MAX 400 // SERVO_MAX - SERVO_LEFT |
//#define SERVO_I1_MIDDLE ((SERVO_STEPS + 1) * 4 - 1)/2 |
#define SERVO_I1_MIDDLE_MIN ((SERVO_STEPS + 1) * 4 - 1)/2 - 100 |
#define SERVO_I1_MIDDLE_MAX ((SERVO_STEPS + 1) * 4 - 1)/2 + 100 |
#define SERVO_REV 0 // kein Reverse |
/* Test Servo */ |
#define SERVO_PERIODE 20 // default Angabe in ms |
#define SERVO_PERIODE_MIN 10 // 10ms |
#define SERVO_PERIODE_MAX 30 // 30ms |
#define SINGLE_STEP 0 // Einzelschritt aus |
#define SINGLE_STEP_MIN 0 |
#define SINGLE_STEP_MAX 20 // bei prescaler 256, sonst * 4 (von links nach rechts in 9 Abschnitte) |
// zwischen den Schritten muss Pause > der Servoperiode sein, sonst keine Aktualisierung |
#define REPEAT 1 |
#define REPEAT_MIN 1 |
#define REPEAT_MAX 100 |
#define PAUSE 10 |
#define PAUSE_MIN 4 // mindestens 400ms, da mechanischer Servo-Lauf zur Position berücksichtigt werden muss |
#define PAUSE_MAX 20 // Pause pro Links-, Mittel- und Rechtsposition 10*100ms |
#define PAUSE_STEP 0 |
#define PAUSE_STEP_MIN 0 // Pause bei jeden Servoschritt in ms |
#define PAUSE_STEP_MAX 200 |
// The numbers below good for parallax servos at an F_CPU of 20.000MHz. |
// Da einige Servo's auch eien Winkel von 180 grd zulassen, Wertebereich |
// entgegen den sonst üblichen. Einschränkung mit default Kalibrierung |
// auf 0,9ms (45) bis 2,1ms(45) gesetzt. Je nach Servo, entspricht einen |
// Winkel von etwa 180grd |
// Periode default 20ms |
#define SERVO_MAX 211 // 2,7 ms bei prescaler 256, bei prescaler 64 SERVO_MAX * 4 |
#define SERVO_MIN 26 // 0,33ms bei prescaler 256, bei prescaler 64 SERVO_MIN * 4 |
#define SERVO_STEPS 255 // Servo-Schritte von links nach rechts, Anschlagkalibrierung spielt keine Rolle |
#define SERVO_PRESCALER 256 // bei prescaler 256, bei prescaler 64 SERVO_PRESCALER / 4 |
#define STEPS_255 0 // Servo-Schritte von links nach rechts, Anschlagkalibrierung spielt keine Rolle |
#define STEPS_1023 1 // Servo-Schritte von links nach rechts, Anschlagkalibrierung spielt keine Rolle |
typedef struct //Servo-Konstante je nach Prescaler |
{ |
uint16_t max; |
uint16_t min; |
uint16_t steps; |
uint16_t prescaler; |
}ServoConst_t; |
typedef struct //struct_ServoChannel |
{ |
uint8_t pin; // hardware I/O port and pin for this channel |
uint16_t duty; // PWM duty setting which corresponds to servo position |
uint8_t rev; // Parameter, wie on/off; reverse; range |
uint16_t min; // SERVO_MIN + Parameter min |
uint16_t max; // SERVO_MAX - Parameter max |
uint16_t mid_scaled; // skalierte Servomitte |
int16_t mid; // Servomitte = SERVO_STEPS/2 +/- x Schritte; bei Pescaler 256 wird nur uint8_t benötigt aber bei 64 |
}ServoChannelType; |
//uint8_t sIdxSteps; // 0 für 255 und 1 für 1023 Schritte; Prescaler 256 oder 64 |
// Define servo limits (depend on hardware) |
typedef struct { |
uint16_t min; |
uint16_t max; |
}servo_limit_t; |
extern const servo_limit_t servo_limit[2][3]; |
// Define servo positions (depend on hardware) |
typedef struct { |
uint16_t min; |
uint16_t max; |
uint16_t mid; |
}steps_pw_t; |
//typedef struct { |
// uint8_t rev; |
// uint16_t min; |
// uint16_t max; |
// uint16_t mid; |
//} servo_t; |
// Servopositionen für 950µs, 2,05ms und 1,5ms ==> Ergebnis Schritte. Da Zeit in µs ist F_CPU*e-1 |
extern const steps_pw_t steps_pw[2]; |
#define RIGHT 0 // Servopostionen, welche vom Einbau abhängig sind |
#define LEFT 1 |
#define MIDDLE 2 |
#define POSIDX_MAX 4 |
extern const uint8_t PosIdx[POSIDX_MAX]; // anzufahrende Servopositionen 0=MIN, 1=MID, 2=MAX |
// functions |
void servoSetDefaultPos(void); |
// initializes servo system |
// You must run this to begin servo control |
void servoInit(uint8_t servo_period); |
// turns off servo system |
// This stops controlling the servos and |
// returns control of the SERVOPORT to your code |
void servoOff(void); |
// set servo position on a given channel |
// servoSetPosition() commands the servo on <channel> to the position you |
// desire. The position input must lie between 0 and POSITION_MAX and |
// will be automatically scaled to raw positions between SERVO_MIN and |
// SERVO_MAX |
void servoSetPosition(uint8_t channel, uint16_t position); |
// set raw servo position on a given channel |
// Works like non-raw commands but position is not scaled. Position must |
// be between SERVO_MIN and SERVO_MAX |
void servoSetPositionRaw(uint8_t channel, uint16_t position); |
// set servo to a specific angle |
void servoSetAngle(uint8_t servo_nr, int16_t angle); |
// vor servoInit(), oder vor sei() ServoWerte mit servoSet...() initialisieren, einschließlich servoSetPosition(...)! |
void servoSet_rev(uint8_t channel, uint8_t val); |
void servoSet_min(uint8_t channel, uint16_t min); |
void servoSet_max(uint8_t channel, uint16_t max); |
void servoSet_mid(uint8_t channel, uint16_t mid); |
uint16_t pw_us(uint16_t Steps); // gibt Zeit in µs bei x Servoschritte |
uint16_t ServoSteps(void); // gibt "Konstante" derzeitiger Servoschritte zürück |
#endif /* SERVO_H */ |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/tracking/servo.c |
---|
0,0 → 1,153 |
/***************************************************************************** |
* Copyright (C) 2008 Thomas Kaiser, thomas@ft-fanpage.de * |
* Copyright (C) 2009 Peter "woggle" Mack, mac@denich.net * |
* Copyright (C) 2011 Christian "Cebra" Brandtner, brandtner@brandtner.net * |
* Copyright (C) 2011 Harald Bongartz * |
* * |
* This program is free software; you can redistribute it and/or modify * |
* it under the terms of the GNU General Public License as published by * |
* the Free Software Foundation; either version 2 of the License. * |
* * |
* This program is distributed in the hope that it will be useful, * |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
* GNU General Public License for more details. * |
* * |
* You should have received a copy of the GNU General Public License * |
* along with this program; if not, write to the * |
* Free Software Foundation, Inc., * |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
* * |
* * |
* Credits to: * |
* Holger Buss & Ingo Busker from mikrokopter.de for the MK project + SVN * |
* http://www.mikrokopter.de * |
* Gregor "killagreg" Stobrawa for his version of the MK code * |
* Thomas Kaiser "thkais" for the original project. See * |
* http://www.ft-fanpage.de/mikrokopter/ * |
* http://forum.mikrokopter.de/topic-4061-1.html * |
* Claas Anders "CaScAdE" Rathje for providing the font and his C-OSD code * |
* http://www.mylifesucks.de/oss/c-osd/ * |
* Harald Bongartz "HaraldB" for providing his Ideas and Code for usibility* |
*****************************************************************************/ |
#include "../cpu.h" |
#include <avr/io.h> |
#include <avr/interrupt.h> |
#include <avr/pgmspace.h> |
#include "../lcd/lcd.h" |
#include "../timer/timer.h" |
#include "../tracking/servo.h" |
#include "../messages.h" |
#define SERVO_CORRECT 3.125 |
//-------------------------------------------------------------- |
// |
void servo_test (void) |
{ |
#ifdef HWVERSION3_9 |
uint8_t chg = 0; |
uint8_t Pos = 150; // 1,5mS |
OCR1A = 150 * SERVO_CORRECT; // Servomitte |
lcd_cls (); |
lcd_printp (PSTR(" Servo Tester "), 2); |
lcd_printp_at (7, 5, PSTR("%"), 0); |
lcd_printp_at (16, 5, PSTR("mS"), 0); |
// lcd_printp_at (0, 7, PSTR(KEY_LINE_3), 0); |
lcd_puts_at(0, 7, strGet(KEYLINE3), 0); |
lcd_printp_at (18, 7, PSTR("\x19O\x18"), 0); |
lcd_rect(3, 23, 120, 8, 1); // +-150% Rahmen |
lcd_line(23,23,23,31,1); // -100% |
lcd_line(43,23,43,31,1); // -50% |
lcd_frect(61, 23, 3, 8, 1); // 0% |
lcd_line(83,23,83,31,1); // +50% |
lcd_line(103,23,103,31,1); // +100% |
write_ndigit_number_u (4, 5, 0, 3, 0,0); // Pulse width in % |
write_ndigit_number_u_100th(12, 5, 150, 3, 0); // Pulse width in ms |
do |
{ |
if ((get_key_press (1 << KEY_PLUS) || get_key_long_rpt_sp ((1 << KEY_PLUS), 3)) && (Pos < 225)) |
{ |
if (Pos < 150) |
lcd_frect ((63 - ((150 - Pos) * 0.8)), 24, 1, 6, 0); |
Pos++; |
if (Pos == 75 || Pos == 100 || Pos == 125 || Pos == 150 || Pos == 175 || Pos == 200 || Pos == 225) |
{ |
set_beep ( 200, 0x0080, BeepNormal); |
} |
if (Pos >= 225) |
Pos = 225; |
chg++; |
} |
else if ((get_key_press (1 << KEY_MINUS) || get_key_long_rpt_sp ((1 << KEY_MINUS), 3)) && (Pos > 75)) |
{ |
if (Pos > 150) |
lcd_frect ((((Pos - 150) * 0.8) + 63), 24, ((Pos - 150) * 0.8), 6, 0); |
Pos--; |
if (Pos == 75 || Pos == 100 || Pos == 125 || Pos == 150 || Pos == 175 || Pos == 200 || Pos == 225) |
{ |
set_beep ( 200, 0x0080, BeepNormal); |
} |
if (Pos <= 75) |
Pos = 75; |
chg++; |
} |
else if (get_key_press (1 << KEY_ENTER)) |
{ |
lcd_frect (4, 24, 118, 6, 0); // Balken löschen |
lcd_frect(61, 23, 3, 8, 1); // 0% |
Pos = 150; |
set_beep ( 200, 0x0080, BeepNormal); |
chg++; |
} |
if (chg) |
{ |
chg = 0; |
if (Pos >= 150) |
{ |
lcd_frect (63, 24, ((Pos - 150) * 0.8), 6, 1); |
write_ndigit_number_u (4, 5, ((Pos - 150) * 2), 3, 0,0); // Pulse width in % |
lcd_frect(62, 23, 2, 8, 1); // 0% |
} |
else |
{ |
lcd_frect (63 - ((150 - Pos) * 0.8), 24, ((150 - Pos) * 0.8), 6, 1); |
write_ndigit_number_u (4, 5, ((150 - Pos) * 2), 3, 0,0); // Pulse width in % |
lcd_frect(61, 23, 2, 8, 1); // 0% |
} |
write_ndigit_number_u_100th(12, 5, Pos, 3, 0); // Pulse width in ms |
lcd_line(3, 23,3, 31,1); // -150% |
lcd_line(23, 23,23, 31,1); // -100% |
lcd_line(43, 23,43, 31,1); // -50% |
lcd_line(83, 23,83, 31,1); // +50% |
lcd_line(103,23,103,31,1); // +100% |
lcd_line(123,23,123,31,1); // +150% |
OCR1A = Pos * SERVO_CORRECT; // Servostellung |
} |
} |
while (!get_key_press (1 << KEY_ESC)); |
get_key_press(KEY_ALL); |
#endif |
} |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/tracking/servo.h |
---|
0,0 → 1,40 |
/***************************************************************************** |
* Copyright (C) 2008 Thomas Kaiser, thomas@ft-fanpage.de * |
* Copyright (C) 2009 Peter "woggle" Mack, mac@denich.net * |
* Copyright (C) 2011 Christian "Cebra" Brandtner, brandtner@brandtner.net * |
* Copyright (C) 2011 Harald Bongartz * |
* * |
* This program is free software; you can redistribute it and/or modify * |
* it under the terms of the GNU General Public License as published by * |
* the Free Software Foundation; either version 2 of the License. * |
* * |
* This program is distributed in the hope that it will be useful, * |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
* GNU General Public License for more details. * |
* * |
* You should have received a copy of the GNU General Public License * |
* along with this program; if not, write to the * |
* Free Software Foundation, Inc., * |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
* * |
* * |
* Credits to: * |
* Holger Buss & Ingo Busker from mikrokopter.de for the MK project + SVN * |
* http://www.mikrokopter.de * |
* Gregor "killagreg" Stobrawa for his version of the MK code * |
* Thomas Kaiser "thkais" for the original project. See * |
* http://www.ft-fanpage.de/mikrokopter/ * |
* http://forum.mikrokopter.de/topic-4061-1.html * |
* Claas Anders "CaScAdE" Rathje for providing the font and his C-OSD code * |
* http://www.mylifesucks.de/oss/c-osd/ * |
* Harald Bongartz "HaraldB" for providing his Ideas and Code for usibility* |
*****************************************************************************/ |
#ifndef _SERVO_H |
#define _SERVO_H |
void servo_test (void); |
#endif |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/tracking/servo_setup.c |
---|
0,0 → 1,1780 |
/****************************************************************/ |
/* */ |
/* NG-Video 5,8GHz */ |
/* */ |
/* Copyright (C) 2011 - gebad */ |
/* */ |
/* This code is distributed under the GNU Public License */ |
/* which can be found at http://www.gnu.org/licenses/gpl.txt */ |
/* */ |
/****************************************************************/ |
#include <stdio.h> |
#include <stdlib.h> |
#include <string.h> |
#include <math.h> |
#include "../cpu.h" |
#include <util/delay.h> |
#include <avr/pgmspace.h> |
#include <avr/interrupt.h> |
#include "../main.h" |
#include "../timer/timer.h" |
#include "servo_setup.h" |
#include "tracking.h" |
#include "../lcd/lcd.h" |
#include "../timer/timer.h" |
#include "../menu.h" |
#include "../messages.h" |
#include "../mk-data-structs.h" |
#include "mymath.h" |
#include "../uart/usart.h" |
#include "../osd/osd.h" |
#include "../eeprom/eeprom.h" |
#include "../setup/setup.h" |
#include "tools.h" |
//#include "ng_usart.h" |
//#include "ng_config.h" |
//#include "servo.h" |
//#include "tools.h" |
//#include "mk.h" |
//#include "keys.h" |
//#include "mymath.h" |
// |
//GPS_Pos_t last5pos[7]; |
//uint8_t error1 = 0; |
//NaviData_t *naviData; |
//HomePos_t MK_pos; // Home position of station |
//GPS_Pos_t currentPos; // Current position of flying object |
//int8_t satsInUse; // Number of satelites currently in use |
//uint8_t tracking = TRACKING_MIN; |
//uint8_t track_hyst = TRACKING_HYSTERESE; |
//uint8_t track_tx = 0; |
//geo_t geo; |
//int16_t anglePan, angleTilt; // Servo Winkel |
//uint8_t coldstart = 1; |
uint8_t servo_nr; // zwischen Servo 1 und 2 wird nur mit global servo_nr unterschieden |
//uint8_t FCStatusFlags; |
//-------------------------------------------------------------- |
#define ITEMS_SERVO 4 |
const prog_char servo_menuitems[ITEMS_SERVO][NUM_LANG][18]= // Zeilen,Zeichen+1 |
{ |
{"Servoschritte ","servo steps ","servo steps "}, |
{"Servo 1 \x1d","servo 1 \x1d","servo 1 \x1d"}, |
{"Servo 2 \x1d","servo 2 \x1d","servo 2 \x1d"}, |
{"Servotest \x1d","servotest \x1d","servotest \x1d"}, |
}; |
//-------------------------------------------------------------- |
#define ITEMS_SERVOTEST 4 |
const prog_char servotest_menuitems[ITEMS_SERVOTEST][NUM_LANG][18]= // Zeilen,Zeichen+1 |
{ |
{"Test Pulslänge ","test puls width","test puls width "}, |
{"Test fortlaufend\x1d","test cont. \x1d","test cont. \x1d"}, |
{"Servo ","servo ","servo "}, |
{"Periode ","frame ","frame "}, |
}; |
//-------------------------------------------------------------- |
#define ITEMS_SERVOTEST_CONT 5 |
const prog_char servotest_cont_menuitems[ITEMS_SERVOTEST_CONT][NUM_LANG][18]= // Zeilen,Zeichen+1 |
{ {"Start Test ","start test ","start test "}, |
{"Einzelschritt ","single step ","single step "}, |
{"Anzahl Test ","number of test ","number of test "}, |
{"Pause Endposition","pause end pos ","pasue end pos "}, |
{"Pause pro Inc. ","pause proc inc. ","pause proc inc. "}, |
}; |
//-------------------------------------------------------------- |
#define ITEMS_SERVOADJUST 4 |
const prog_char servo_adjust_menuitems[ITEMS_SERVOADJUST][NUM_LANG][18]= // Zeilen,Zeichen+1 |
{ |
{"Reverse ","reverse ","reverse "}, |
{"Links ","left ","left "}, |
{"Rechts ","right ","rigth "}, |
{"Mitte ","middle ","middle "}, |
}; |
///************************************************************************************/ |
///* */ |
///* Ändern der Werte mit Tasten +,- und Anzeige */ |
///* z.B. für U-Offset, Batterie leer Eingabe ... */ |
///* */ |
///* Parameter: */ |
///* uint16_t val :zu ändernter Wert */ |
///* uint16_t min_val, max_val :min, max Grenze Wert ändern darf */ |
///* uint8_t posX, posY :Darstellung Wert xPos, YPos auf LCD */ |
///* Displ_Fnct_t Displ_Fnct :Index um variable Display Funktion aufzurufen */ |
///* uint8_t cycle :0 begrenzt Anzeige bei man_val, bzw. max_val */ |
///* :1 springt nach max_val auf min_val und umgedreht */ |
///* uint8_t vrepeat :beschleunigte Repeat-Funktion aus/ein */ |
///* uint16_t Change_Value_plmi(...) :Rückgabe geänderter Wert */ |
///* */ |
///************************************************************************************/ |
void Servo_tmp_Original(uint8_t track) |
{ |
servoSetDefaultPos(); |
// tracking = track; // ursprünglicher Wert Tracking aus, RSSI oder GPS |
// NoTracking_ServosOff(); // Servos sind nur zum Tracking oder bei Kalibrierung eingeschaltet |
// Jump_Menu(pmenu); |
} |
uint8_t Servo_tmp_on(uint8_t servo_period) |
{ |
// uint8_t tmp_tracking = tracking; |
// tracking = 0; // Servopositionierung durch tracking abschalten |
// if (tracking == TRACKING_MIN) servoInit(servo_period); // falls aus, Servos einschalten |
servoInit(servo_period); |
// lcdGotoXY(0, 0); // lcd Cursor vorpositionieren |
// return(tmp_tracking); |
return (0); |
} |
void Displ_Off_On(uint16_t val) |
{ |
if (val == 0) lcd_puts_at(17, 2, strGet(OFF), 0); else lcd_puts_at(17, 2, strGet(ON), 0); |
} |
uint16_t Change_Value_plmi(uint16_t val, uint16_t min_val, uint16_t max_val, uint8_t posX, uint8_t posY,Displ_Fnct_t Displ_Fnct) |
{ |
uint16_t tmp_val; |
// >> Menueauswahl nach oben |
tmp_val = val; |
if (get_key_press (1 << KEY_PLUS) || get_key_long_rpt_sp ((1 << KEY_PLUS), 3)) |
{ |
if (val < max_val) { |
edit = 1; |
val++; |
} |
else |
{ |
val = min_val; |
} |
Displ_Fnct(val); // geänderten Wert darstellen, je nach Menüpunkt |
} |
// >> Menueauswahl nach unten |
if (get_key_press (1 << KEY_MINUS) || get_key_long_rpt_sp ((1 << KEY_MINUS), 3)) |
{ |
if (val > min_val) { |
val--; |
edit = 1; |
} |
else |
{ |
val = max_val; |
} |
Displ_Fnct(val); // geänderten Wert darstellen, je nach Menüpunkt |
} |
return(val); |
} |
// |
///************************************************************************************/ |
///* */ |
///* Ändern der Werte mit Tasten +,- repetierend; (long)Entertaste und Anzeige */ |
///* z.B. für U-Offset, Batterie leer Eingabe ... */ |
///* */ |
///* Parameter: */ |
///* uint16_t *val :zu ändernter Wert */ |
///* uint16_t min_val, max_val :min, max Grenze Wert ändern darf */ |
///* uint8_t fl_pos :Bit 7 beschleunigte Repeat-Funktion aus/ein */ |
///* Bit 6 zyklische Werteänderung aus/ein */ |
///* Bit 4-5 z.Z. ohne Funktion */ |
///* Bit 0-3 Wert xPos auf LCD */ |
///* Displ_Fnct_t Displ_Fnct :Index um variable Display Funktion aufzurufen */ |
///* uint8_t Change_Value(...) :Rückgabe geändert ergibt TRUE */ |
///* */ |
///************************************************************************************/ |
//// Bei Bedarf könnte einfach innerhalp fl_pos auch noch pos_y (Bit 4-5) übergeben werden |
uint8_t Change_Value(uint16_t *val, uint16_t min_val, uint16_t max_val,Displ_Fnct_t Displ_Fnct) |
{ uint16_t tmp_val; |
tmp_val = *val; |
Displ_Fnct(tmp_val); // initiale Wertdarstellung, je nach Menüpunkt |
while(!get_key_press(1<<KEY_ENTER) && !get_key_press(1<<KEY_ESC)) |
*val = Change_Value_plmi(*val, min_val, max_val, 16,2, Displ_Fnct); |
if (*val == tmp_val) { |
edit = 0; |
// lcd_printp_at (0, 5, PSTR("Edit=0"), 0); |
// _delay_ms(500); |
//// return (*val); |
} |
// |
else |
{ |
edit = 1; |
// lcd_printp_at (0, 5, PSTR("Edit=1"), 0); |
// _delay_ms(500); |
} |
return (tmp_val != *val); |
} |
uint16_t calc_range(int16_t PosProzent, int16_t min, int16_t max, int16_t mid) |
{ uint16_t range; |
if (PosProzent < 0) { |
range = mid - min; |
// if (chrxs == CHRRS) { // falls Richtung geändert, anderen Zeichensatz laden |
// chrxs = CHRLS; |
//// lcdWriteCGRAM_Array(lcdSpecialChrLs, 5);// LCD-Char mit Rahmensymbole vom Graph |
// } |
} |
else { |
range = max - mid; |
// if (chrxs == CHRLS) { // falls Richtung geändert, anderen Zeichensatz laden |
//// lcdWriteCGRAM_Array(lcdSpecialChrRs, 5);// LCD-Char mit Rahmensymbole vom Graph |
// chrxs = CHRRS; |
// } |
} |
return(range); |
} |
/************************************************************************************/ |
/* zeigt einen max. 3-stelligen Integerwert auf Display an */ |
/* Parameter: */ |
/* uint16_t val :anzuzeigender Wert, */ |
/* uint16_t wegen Vereinheitlichung f. Funktionsaufrauf */ |
/* */ |
/************************************************************************************/ |
void Displ_Format_Int(uint16_t val) |
{ |
// lcdPuts(my_itoa(val, 3, 0, 0)); |
// lcdPuts(my_itoa(mid_val, 4, 0, 0)); |
lcd_puts_at(16,2,my_itoa(val, 3, 0, 0),0); |
} |
void Displ_PulseWidth(uint16_t val) |
{ int16_t PosProzent, range; |
uint16_t Pos_us; |
char me[3] = {"ms"}; |
servoSetPositionRaw(servo_nr, val); |
PosProzent = val - steps_pw[Config.sIdxSteps].mid; |
range = calc_range(PosProzent, steps_pw[Config.sIdxSteps].min, steps_pw[Config.sIdxSteps].max, steps_pw[Config.sIdxSteps].mid); |
// draw_bar(PosProzent, range, 2); // auf 3. Display-Zeile |
PosProzent = (int32_t)1000 * PosProzent / range; |
// lcdGotoXY(1, 1); |
Pos_us = pw_us(val); // Zeit in µs bei x Servoschritte |
if (Pos_us < 1000) { |
me[0] = 'u'; // soll 'µ' => programmierbarer Zeichensatz zu klein |
// lcdPuts(" "); |
Displ_Format_Int(Pos_us); |
} |
else { |
// lcdPuts(my_itoa(Pos_us, 5, 3, 3)); |
lcd_puts_at(14,2,my_itoa(Pos_us, 5, 3, 3),0); |
} |
// lcdPuts(me); |
// lcdGotoXY(8, 1); |
// lcdPuts(my_itoa(PosProzent, 6, 1, 1)); |
lcd_puts_at(14,2,my_itoa(PosProzent, 6, 1, 1),0); |
// lcdPutc('%'); |
} |
/************************************************************************************/ |
/* zeigt Pausenlänge der Links-, Mittel- und Rechtsposition auf Display an */ |
/* Parameter: */ |
/* uint16_t val : Zeit in 1ms * 100 */ |
/* */ |
/************************************************************************************/ |
void Displ_Pause(uint16_t val) |
{ |
if (val > 9) { |
// lcdPuts(my_itoa(val, 3, 1, 1)); |
lcd_puts_at(16,2,my_itoa(val, 3, 1, 1),0); |
// lcdPuts("s "); |
} |
else { |
Displ_Format_Int(val * 100); |
// lcdPuts("ms"); |
} |
} |
/************************************************************************************/ |
/* zeigt aus oder Integerwert auf Display an */ |
/* Parameter: */ |
/* uint16_t val : val = 0 ==> aus, sont Integerwert */ |
/* */ |
/************************************************************************************/ |
void Displ_Off_Format_Int(uint16_t val) |
{ |
if (val == 0) |
// lcdPutStrMid(Msg(MSG_OFF), ZLE_VAL); |
lcd_puts_at(17, 2, strGet(OFF), 0); |
else { |
// write_ndigit_number_u (16, 2, val, 5, 0,0); |
// lcdGotoXY(5,ZLE_VAL); |
Displ_Format_Int(val); |
// lcdPutc(' '); |
} |
} |
/************************************************************************************/ |
/* zeigt aus oder Pausenzeit zwischen 2 Servoschritte auf Display an */ |
/* Parameter: */ |
/* uint16_t val : val = 0 ==> aus, sont Integerwert */ |
/* */ |
/************************************************************************************/ |
void Displ_Pause_Step(uint16_t val) |
{ |
Displ_Off_Format_Int(val); |
if (val > 0) { |
// lcdGotoXY(8,ZLE_VAL); |
// lcdPuts("ms"); |
} |
} |
/************************************************************************************/ |
/* zeigt zu testende Servonummer zur Auswahl auf Display an */ |
/* Parameter: */ |
/* uint16_t val :0 = Servo 1 oder 1 = Servo 2, */ |
/* uint16_t wegen Vereinheitlichung f. Funktionsaufrauf */ |
/* */ |
/************************************************************************************/ |
void Displ_ServoNr(uint16_t val) |
{ |
// if (val == 0) lcdPuts(Msg(MSG_SERVO1)); else lcdPuts(Msg(MSG_SERVO2)); |
lcd_printp_at (0, 2, PSTR("Servo:"), 0); |
if (val == 0) lcd_printp_at (14, 2, PSTR("Servo 1"), 0); else lcd_printp_at (14, 2, PSTR("Servo 2"), 0); |
} |
/**************************/ |
/* */ |
/* Servos-Tests */ |
/* */ |
/**************************/ |
//void Menu_Servo_Test(void) |
//{ uint8_t scr_sub_menu[SCROLL_MAX_6] = {SCROLL_MAX_6 - 2, MSG_RETURN, MSG_PULSE_WIDTH, MSG_CONTINOUS, MSG_SERVO, MSG_FRAME}; |
// |
// Scroll_Menu(scr_sub_menu, m_pkt); // pmenu global |
// servo_nr = eeprom_read_byte(&ep_servo_nr); |
// Jump_Menu(pmenu); |
//} |
void Menu_Test_Frame(void) |
{ uint16_t tmp_val; |
// Displ_Title(MSG_FRAME); |
// lcdGotoXY(8, ZLE_VAL); |
lcd_cls (); |
lcd_puts_at(0, 0, strGet(SV_TEST3),2); |
lcd_puts_at(0, 7, strGet(KEYLINE2), 0); |
// lcdPuts("ms"); |
tmp_val = Config.servo_frame; |
if (Change_Value(&tmp_val, SERVO_PERIODE_MIN, SERVO_PERIODE_MAX,Displ_Format_Int)) { // pmenu global |
Config.servo_frame = tmp_val; |
// eeprom_write_byte(&ep_servo_frame, servo_frame); |
// Double_Beep(DBEEPWR, DBEEPWRP); |
} |
// Jump_Menu(pmenu); |
} |
void Menu_Test_ServoNr(void) |
{ uint16_t tmp_val; |
// Displ_Title(MSG_SERVO); |
lcd_cls (); |
lcd_puts_at(0, 0, strGet(SV_TEST2),2); |
lcd_puts_at(0, 7, strGet(KEYLINE2), 0); |
tmp_val = servo_nr; |
if (Change_Value(&tmp_val, 0, 1,Displ_ServoNr)) { // pmenu global; es gibt nur 0=Servo1, 1=Servo2 |
servo_nr = tmp_val; |
// eeprom_write_byte(&ep_servo_nr, servo_nr); |
// Double_Beep(DBEEPWR, DBEEPWRP); |
} |
// Jump_Menu(pmenu); |
} |
// Dieser Test im raw-Modus ohne Anschlagkalibrierung (normiert) z.B.: für Modelleinstellungen ohne Empfänger |
void Menu_Test_PulseWidth(void) |
{ uint8_t tmp_tracking; |
uint16_t tmp_val; |
lcd_cls (); |
lcd_puts_at(0, 0, strGet(SERVO_TEST1),2); |
lcd_puts_at(0, 7, strGet(KEYLINE2), 0); |
tmp_tracking = Servo_tmp_on(Config.servo_frame); |
// lcdWriteCGRAM_Array(lcdSpecialChrLs, 8); // LCD-Char mit Rahmensymbole vom Graph |
// chrxs = CHRLS; // verhindert wiederholtes Lesen bereits geladener LCD-Char |
// Displ_Title(MSG_PULSE_WIDTH); |
tmp_val = steps_pw[Config.sIdxSteps].mid; |
Change_Value(&tmp_val, steps_pw[Config.sIdxSteps].min, steps_pw[Config.sIdxSteps].max,Displ_PulseWidth); // pmenu global |
// lcdWriteCGRAM_Array(lcdSpecialChr, 7); // LCD-Char für Bargraph zurückschreiben |
cli(); |
servoInit(SERVO_PERIODE); |
sei(); |
Servo_tmp_Original(tmp_tracking); |
} |
//void Menu_Test_Continuous(void) |
//{ uint8_t scr_sub_menu[SCROLL_MAX_7] = {SCROLL_MAX_7 - 2, MSG_RETURN, MSG_START, MSG_SINGLE_STEP, MSG_REPEAT, MSG_PAUSE, MSG_PAUSE_STEP}; |
// |
// Scroll_Menu(scr_sub_menu, m_pkt); // pmenu global |
// Jump_Menu(pmenu); |
//} |
void Menu_Test_SingleStep(void) |
{uint16_t tmp_val; |
//TODO: |
// Displ_Title(MSG_SINGLE_STEP); |
lcd_cls (); |
tmp_val = Config.single_step; |
lcd_puts_at(0, 0, strGet(SV_SINGLESTEP),2); |
lcd_puts_at(0, 7, strGet(KEYLINE2), 0); |
if (Change_Value(&tmp_val, SINGLE_STEP_MIN, SINGLE_STEP_MAX, Displ_Off_Format_Int)) { // pmenu global |
Config.single_step = tmp_val; |
// eeprom_write_byte(&ep_single_step, single_step); |
// Double_Beep(DBEEPWR, DBEEPWRP); |
} |
// Jump_Menu(pmenu); |
} |
void Menu_Test_Repeat(void) |
{uint16_t tmp_val; |
//TODO: |
// Displ_Title(MSG_REPEAT); |
tmp_val = Config.repeat; |
lcd_cls (); |
lcd_puts_at(0, 0, strGet(SV_COUNTTEST),2); |
lcd_puts_at(0, 7, strGet(KEYLINE2), 0); |
if (Change_Value(&tmp_val, REPEAT_MIN, REPEAT_MAX,Displ_Format_Int)) { // pmenu global |
Config.repeat = tmp_val; |
// eeprom_write_byte(&ep_repeat, repeat); |
// Double_Beep(DBEEPWR, DBEEPWRP); |
} |
// Jump_Menu(pmenu); |
} |
void Menu_Test_Pause(void) |
{uint16_t tmp_val; |
//TODO: |
// Displ_Title(MSG_PAUSE); |
lcd_cls (); |
lcd_puts_at(0, 0, strGet(SV_PAUSEEND),2); |
lcd_puts_at(0, 7, strGet(KEYLINE2), 0); |
tmp_val = Config.pause; |
if (Change_Value(&tmp_val, PAUSE_MIN, PAUSE_MAX,Displ_Pause)) { // pmenu global |
Config.pause = tmp_val; |
// eeprom_write_byte(&ep_pause, pause); |
// Double_Beep(DBEEPWR, DBEEPWRP); |
} |
// Jump_Menu(pmenu); |
} |
void Menu_Test_Pause_Step(void) |
{uint16_t tmp_val; |
//TODO: |
// Displ_Title(MSG_PAUSE_STEP); |
lcd_cls (); |
lcd_puts_at(0, 0, strGet(SV_PAUSEINC),2); |
lcd_puts_at(0, 7, strGet(KEYLINE2), 0); |
tmp_val = Config.pause_step; |
if (Change_Value(&tmp_val, PAUSE_STEP_MIN, PAUSE_STEP_MAX,Displ_Pause_Step)) { // pmenu global |
Config.pause_step = tmp_val; |
// eeprom_write_byte(&ep_pause_step, pause_step); |
// Double_Beep(DBEEPWR, DBEEPWRP); |
} |
// Jump_Menu(pmenu); |
} |
int8_t calc_dir(uint8_t idx, int16_t *Position) |
{ uint8_t nextIdx; |
int8_t nextDir = 1; |
nextIdx = idx; |
if ((idx + 1) < POSIDX_MAX) |
nextIdx++; |
else |
nextIdx = 0; |
if (Position[PosIdx[idx]] > Position[PosIdx[nextIdx]]) nextDir = -1; |
return(nextDir); |
} |
void Displ_LoopCounter(uint8_t val) |
{ |
// lcdGotoXY(2,2); |
// lcdPuts(Msg(MSG_COUNTER)); |
// lcdPuts(my_itoa(val, 4, 0, 0)); |
lcd_puts_at(16,2,my_itoa(val, 4, 0, 0),0); |
} |
// Test über Scalierung der Servos mit Anschlagkalibrierung |
void Menu_Test_Start(void) |
{ uint8_t tmp_tracking, idx, rep; |
int8_t dir; |
int16_t sPos; |
int16_t Position[3]; |
int16_t range; |
tmp_tracking = Servo_tmp_on(Config.servo_frame); |
// lcdWriteCGRAM_Array(lcdSpecialChrLs, 8); // LCD-Char mit Rahmensymbole vom Graph |
// chrxs = CHRLS; // Flag, welche Kästchensymbole geladen |
// Displ_Title(MSG_CONTINOUS); |
lcd_cls (); |
lcd_puts_at(0, 0, strGet(SV_TESTCONT),2); |
lcd_puts_at(0, 7, strGet(KEYLINE2), 0); |
Displ_LoopCounter(Config.repeat); |
Position[0] = 0; // skalierte Servoposition aber unterschiedliche Schrittanzahl möglich |
Position[1] = ServoSteps()/2; |
Position[2] = ServoSteps(); |
// init Einzelschritt |
idx = 0; |
dir = calc_dir(idx, Position); |
sPos = Position[PosIdx[idx]]; |
idx++; |
rep = Config.repeat; |
// Test bis Ende der Wiederholungen oder irgendein Enter |
while(!get_key_press(1<<KEY_ENTER) && !get_key_press(1<<KEY_ESC)) { |
range = calc_range(sPos - Position[1], Position[0], Position[2], Position[1]); |
// draw_bar(sPos - Position[1], range, 1); // eingerahmter Balkengraph auf 2. Display-Zeile |
servoSetPosition(servo_nr, sPos); |
if ( sPos != Position[PosIdx[idx]]) { // Links-, Mittel- oder Rechtsposotion erreicht? |
sPos += (Config.single_step * dir); // variable Schrittweite subtrahieren oder addieren |
if (((dir < 0) && (sPos < Position[PosIdx[idx]])) || ((dir > 0) && (sPos > Position[PosIdx[idx]])) || !(Config.single_step)) |
sPos = Position[PosIdx[idx]]; // Überlauf bei variabler Schrittweite berücksichtigen oder Einzelschritt |
Delay_ms(Config.servo_frame + 1 + Config.pause_step);// Bei Schrittweite um 1 würden welche übersprungen, zusätzlich pro Servoschritt verzögert |
} |
else { |
dir = calc_dir(idx, Position); // Richtungsänderung |
if (idx < (POSIDX_MAX - 1)) { |
if (idx == 0) { |
rep--; // bei jeden vollen Durchlauf Wiederholzähler verringern |
Displ_LoopCounter(rep); |
} |
idx++; // Index für nächsten Positionswert ==> Array PosIdx[] bestimmt Anschlagreihenfolge |
} |
else |
idx = 0; |
delay_ms100x(Config.pause); // variable Pause bei Links-, Mittel- und Rechtsposotion Mindestzeit 400ms (Servolauf) |
} |
} |
// lcdClear(); |
// if (pmenu[0] == '\0') |
// Displ_Main_Disp(); |
// else |
// return_m_pkt(strlen(pmenu)); // um bei Rücksprung auf ursprünglichen Menüpunkt zeigen oder Displ_Main_Disp() |
// lcdWriteCGRAM_Array(lcdSpecialChr, 7); // LCD-Char für Bargraph zurückschreiben |
cli(); |
servoInit(SERVO_PERIODE); |
sei(); |
Servo_tmp_Original(tmp_tracking); |
} |
//-------------------------------------------------------------- |
void test_servo_menu(void) |
{ |
// uint8_t ii = 0; |
// uint8_t Offset = 0; |
// uint8_t dmode = 0; |
uint8_t target_pos = 1; |
// uint8_t val = 0; |
while(1) |
{ |
size = ITEMS_SERVOTEST; |
lcd_cls (); |
lcd_printpns_at(0, 0, PSTR("test_servo_menu "), 2); |
// lcd_printp_at (0, 7, PSTR(KEY_LINE_1), 0); |
lcd_puts_at(0, 7, strGet(KEYLINE1), 0); |
// while(2) |
// { |
// ii = 0; |
// if(Offset > 0) |
// { |
// lcd_printp_at(1,1, PSTR("\x12"), 0); |
// } |
// for(ii = 0;ii < 6 ; ii++) |
// { |
// if((ii+Offset) < size) |
// { |
// lcd_printp_at(3,ii+1,servotest_menuitems[ii+Offset][Config.DisplayLanguage], 0); |
// } |
// if((ii == 5)&&(ii+Offset < (size-1))) |
// { |
// lcd_printp_at(1,6, PSTR("\x13"), 0); |
// } |
// } |
// if(dmode == 0) |
// { |
// if(Offset == 0) |
// { |
// if(size > 6) |
// { |
// val = menu_choose2 (1, 5, target_pos,0,1); |
// } |
// else |
// { |
// val = menu_choose2 (1, size, target_pos,0,0); |
// } |
// } |
// else |
// { |
// val = menu_choose2 (2, 5, target_pos,1,1); |
// } |
// } |
// if(dmode == 1) |
// { |
// if(Offset+7 > size) |
// { |
// val = menu_choose2 (2, 6, target_pos,1,0); |
// } |
// else |
// { |
// val = menu_choose2 (2, 5, target_pos,1,1); |
// } |
// } |
// if(val == 254) |
// { |
// Offset++; |
// dmode = 1; |
// target_pos = 5; |
// } |
// else if(val == 253) |
// { |
// Offset--; |
// dmode = 0; |
// target_pos = 2; |
// } |
// else if(val == 255) |
// { |
// return; |
// } |
// else |
// { |
// break; |
// } |
// } |
val = menu_select(servotest_menuitems,size,target_pos); |
if (val==255) break; |
target_pos = val; |
// {"Test Pulslänge ","test puls width","test puls width "}, |
// {"Test fortlaufend\x1d","test cont. \x1d","test cont. \x1d"}, |
// {"Servo ","servo ","servo "}, |
// {"Periode ","frame ","frame "}, |
if(val == 1 ) |
Menu_Test_PulseWidth(); |
if(val == 2 ) |
servotest_cont_menu(); |
if(val == 3 ) |
Menu_Test_ServoNr(); |
if(val == 4 ) |
Menu_Test_Frame(); |
} |
} |
//-------------------------------------------------------------- |
//-------------------------------------------------------------- |
void servotest_cont_menu(void) |
{ |
// uint8_t ii = 0; |
// uint8_t Offset = 0; |
// uint8_t dmode = 0; |
uint8_t target_pos = 1; |
// uint8_t val = 0; |
while(1) |
{ |
size = ITEMS_SERVOTEST_CONT; |
lcd_cls (); |
lcd_printpns_at(0, 0, PSTR("Servotest cont."), 2); |
// lcd_printp_at (0, 7, PSTR(KEY_LINE_1), 0); |
lcd_puts_at(0, 7, strGet(KEYLINE1), 0); |
// while(2) |
// { |
// ii = 0; |
// if(Offset > 0) |
// { |
// lcd_printp_at(1,1, PSTR("\x12"), 0); |
// } |
// for(ii = 0;ii < 6 ; ii++) |
// { |
// if((ii+Offset) < size) |
// { |
// lcd_printp_at(3,ii+1,servotest_cont_menuitems[ii+Offset][Config.DisplayLanguage], 0); |
// } |
// if((ii == 5)&&(ii+Offset < (size-1))) |
// { |
// lcd_printp_at(1,6, PSTR("\x13"), 0); |
// } |
// } |
// if(dmode == 0) |
// { |
// if(Offset == 0) |
// { |
// if(size > 6) |
// { |
// val = menu_choose2 (1, 5, target_pos,0,1); |
// } |
// else |
// { |
// val = menu_choose2 (1, size, target_pos,0,0); |
// } |
// } |
// else |
// { |
// val = menu_choose2 (2, 5, target_pos,1,1); |
// } |
// } |
// if(dmode == 1) |
// { |
// if(Offset+7 > size) |
// { |
// val = menu_choose2 (2, 6, target_pos,1,0); |
// } |
// else |
// { |
// val = menu_choose2 (2, 5, target_pos,1,1); |
// } |
// } |
// if(val == 254) |
// { |
// Offset++; |
// dmode = 1; |
// target_pos = 5; |
// } |
// else if(val == 253) |
// { |
// Offset--; |
// dmode = 0; |
// target_pos = 2; |
// } |
// else if(val == 255) |
// { |
// if (edit == 1) |
// { |
//// WriteParameter(); |
// edit = 0; |
// return; |
// } |
// return; |
// } |
// else |
// { |
// break; |
// } |
// } |
val = menu_select(servotest_cont_menuitems,size,target_pos); |
if (val==255) break; |
target_pos = val; |
if(val == 1 ) |
Menu_Test_Start(); |
if(val == 2 ) |
Menu_Test_SingleStep(); |
if(val == 3) |
Menu_Test_Repeat(); |
if(val == 4 ) |
Menu_Test_Pause(); |
if(val == 5) |
Menu_Test_Pause_Step(); |
} |
} |
//-------------------------------------------------------------- |
void Servo_rev(void) |
{ uint16_t tmp_val; |
uint8_t tmp_tracking; |
lcd_puts_at(0, 2, strGet(SERVO_REVERSE),0); |
lcd_puts_at(0, 7, strGet(KEYLINE2), 0); |
tmp_tracking = Servo_tmp_on(SERVO_PERIODE); |
tmp_val = Config.servo[servo_nr].rev; |
if (Change_Value(&tmp_val , 0, 1, Displ_Off_On)) |
{ //reverse gibt es nur 0=off, 1=on |
Config.servo[servo_nr].rev = tmp_val ; |
servoSet_rev(servo_nr, tmp_val ); |
} |
Servo_tmp_Original(tmp_tracking); |
} |
void Menu_Servotext(void) |
{ |
lcd_cls (); |
if (servo_nr == 0) |
lcd_puts_at(0, 0, strGet(SERVO1_TEXT), 2); |
else |
lcd_puts_at(0, 0, strGet(SERVO2_TEXT), 2); |
} |
void Menu_Servo_rev(void) |
{ |
Menu_Servotext(); |
Servo_rev(); |
} |
/********************************************************************************/ |
/* zeigt Servo-Anschlagposition links auf Display an */ |
/* mit sofortiger Wirkung auf Servo */ |
/* Parameter: */ |
/* uint16_t val :anzuzeigender Wert, */ |
/* uint16_t wegen Vereinheitlichung f. Funktionsaufrauf */ |
/* */ |
/********************************************************************************/ |
void Displ_Servo_Min(uint16_t val) |
{ uint16_t steps = 0; |
// Displ_Format_Int(val); |
write_ndigit_number_s (16, 2, val, 5, 0,0); |
servoSet_min(servo_nr, val); // Wert setzen damit nachfolgend die |
if (Config.servo[servo_nr].rev) steps = ServoSteps(); |
servoSetPosition(servo_nr, steps); // Änderung direkt am Servo sichtbar ist |
} |
/************************************************************************************/ |
/* zeigt Servo-Anschlagposition rechts auf Display an */ |
/* mit sofortiger Wirkung auf Servo */ |
/* Parameter: */ |
/* uint16_t val :anzuzeigender Wert, */ |
/* uint16_t wegen Vereinheitlichung f. Funktionsaufrauf */ |
/* */ |
/************************************************************************************/ |
void Displ_Servo_Max(uint16_t val) |
{ uint16_t steps = ServoSteps(); |
// Displ_Format_Int(val); |
write_ndigit_number_u (16, 2, val, 5, 0,0); |
servoSet_max(servo_nr, val); // Wert setzen damit nachfolgend die |
if (Config.servo[servo_nr].rev) steps = 0; |
servoSetPosition(servo_nr, steps); // Änderung direkt am Servo sichtbar ist |
} |
/************************************************************************************/ |
/* zeigt Servo-Anschlagposition Mitte auf Display an */ |
/* mit sofortiger Wirkung auf Servo */ |
/* Parameter: */ |
/* uint16_t val :anzuzeigender Wert, */ |
/* uint16_t wegen Vereinheitlichung f. Funktionsaufrauf */ |
/* */ |
/************************************************************************************/ |
void Displ_Servo_Mid(uint16_t val) |
{ int16_t mid_val; |
mid_val = val - ServoSteps()/2; |
// lcdPuts(my_itoa(mid_val, 4, 0, 0)); |
lcd_puts_at(16,2,my_itoa(mid_val, 4, 0, 0),0); |
servoSet_mid(servo_nr, val); // Wert setzen damit nachfolgend die |
servoSetPosition(servo_nr, ServoSteps()/2); // Änderung direkt am Servo sichtbar ist |
} |
void Servo_left(void) |
{ uint16_t tmp_val; |
uint8_t tmp_tracking; |
lcd_puts_at(0, 2, strGet(SERVO_LEFT),0); |
lcd_puts_at(0, 7, strGet(KEYLINE2), 0); |
tmp_tracking = Servo_tmp_on(SERVO_PERIODE); |
servoSetPosition(servo_nr, ServoSteps()); // Linkssanschlag um Kalibrierung am Servo zu sehen |
tmp_val = Config.servo[servo_nr].max; |
// if (Change_Value(&tmp_val, servo_limit[sIdxSteps][LEFT].min, servo_limit[sIdxSteps][LEFT].max, 6|(1<<V_REPEAT), Displ_Servo_Max)) { // pmenu global |
if (Change_Value(&tmp_val , servo_limit[Config.sIdxSteps][LEFT].min, servo_limit[Config.sIdxSteps][LEFT].max, Displ_Servo_Max)) |
{ |
Config.servo[servo_nr].max = tmp_val; |
// eeprom_write_block(&servo[servo_nr],&ep_servo[servo_nr],sizeof(servo_t)); |
servoSet_mid(servo_nr, Config.servo[servo_nr].mid); // Mittelposition muss sich bei Ausschlagsänderung verschieben |
// Double_Beep(DBEEPWR, DBEEPWRP); |
} |
Servo_tmp_Original(tmp_tracking); |
} |
void Menu_Servo_left(void) |
{ |
// Displ_Title(MSG_CALIB1_LEFT); |
Menu_Servotext(); |
Servo_left(); |
} |
void Servo_right(void) |
{ uint16_t tmp_val; |
uint8_t tmp_tracking; |
lcd_puts_at(0, 2, strGet(SERVO_RIGTH),0); |
lcd_puts_at(0, 7, strGet(KEYLINE2), 0); |
tmp_tracking = Servo_tmp_on(SERVO_PERIODE); |
servoSetPosition(servo_nr, 0); // Rechtsanschlag um Kalibrierung am Servo zu sehen |
tmp_val = Config.servo[servo_nr].min; |
// if (Change_Value(&tmp_val, servo_limit[sIdxSteps][RIGHT].min, servo_limit[sIdxSteps][RIGHT].max, 6|(1<<V_REPEAT), Displ_Servo_Min)) { // pmenu global |
if (Change_Value(&tmp_val , servo_limit[Config.sIdxSteps][RIGHT].min, servo_limit[Config.sIdxSteps][RIGHT].max, Displ_Servo_Min)) |
{Config.servo[servo_nr].min = tmp_val; |
// eeprom_write_block(&servo[servo_nr],&ep_servo[servo_nr],sizeof(servo_t)); |
servoSet_mid(servo_nr, Config.servo[servo_nr].mid); // Mittelposition muss sich bei Ausschlagsänderung verschieben |
// Double_Beep(DBEEPWR, DBEEPWRP); |
} |
Servo_tmp_Original(tmp_tracking); |
} |
void Menu_Servo_rigth(void) |
{ |
Menu_Servotext(); |
Servo_right(); |
} |
void Servo_middle(void) |
{ uint16_t tmp_val; |
uint8_t tmp_tracking; |
lcd_puts_at(0, 2, strGet(SERVO_MID),0); |
lcd_puts_at(0, 7, strGet(KEYLINE2), 0); |
tmp_tracking = Servo_tmp_on(SERVO_PERIODE); |
servoSetPosition(servo_nr, ServoSteps()/2); // Mittelposition um Kalibrierung am Servo zu sehen |
tmp_val = Config.servo[servo_nr].mid; |
// if (Change_Value(&tmp_val, servo_limit[sIdxSteps][MIDDLE].min, servo_limit[sIdxSteps][MIDDLE].max, 5|(1<<V_REPEAT), Displ_Servo_Mid)) { // pmenu global |
if (Change_Value(&tmp_val , servo_limit[Config.sIdxSteps][MIDDLE].min, servo_limit[Config.sIdxSteps][MIDDLE].max, Displ_Servo_Mid)) |
{ Config.servo[servo_nr].mid = tmp_val; |
// eeprom_write_block(&servo[servo_nr], &ep_servo[servo_nr], sizeof(servo_t)); |
// Double_Beep(DBEEPWR, DBEEPWRP); |
} |
Servo_tmp_Original(tmp_tracking); |
} |
void Menu_Servo_mid(void) |
{ |
Menu_Servotext(); |
Servo_middle(); |
} |
void Servo_NewValues(uint8_t idx_presc) |
{ |
for (uint8_t i = 0; i < SERVO_NUM_CHANNELS; i++) { |
if (idx_presc == STEPS_255) { // Werte umrechnen für Prescaler = 256 |
Config.servo[i].min /= 4; |
Config.servo[i].max /= 4; |
Config.servo[i].mid /= 4; |
} |
else { // Werte umrechnen für Prescaler = 64 |
Config.servo[i].min *= 4; |
Config.servo[i].max *= 4; |
Config.servo[i].mid = (Config.servo[i].mid + 1) * 4 - 1; |
} |
servoSet_min(i, Config.servo[i].min); |
servoSet_max(i, Config.servo[i].max); |
servoSet_mid(i, Config.servo[i].mid); |
// eeprom_write_block(&servo[i],&ep_servo[i],sizeof(servo_t)); |
} |
// Vorberechnung von ServoChannels[channel].duty |
servoSetDefaultPos(); // Ausgangsstellung beider Servos |
} |
/************************************************************************************/ |
/* zeigt Servoschritte zur Auswahl auf Display an */ |
/* Parameter: */ |
/* uint16_t val :0 = 255 oder 1 = 1023, */ |
/* uint16_t wegen Vereinheitlichung f. Funktionsaufrauf */ |
/* */ |
/************************************************************************************/ |
void Displ_Servo_Steps(uint16_t val) |
{ |
if (val==0) |
lcd_puts_at(16,2,INTERNAT_STEPS_255,0 ); |
else |
lcd_puts_at(16,2,INTERNAT_STEPS_1023,0 ); |
} |
void Menu_Servo_Steps(void) |
{ uint16_t tmp_val; |
lcd_cls (); |
lcd_puts_at(0, 0, strGet(SERVOSTEPS), 2); |
lcd_puts_at(0, 2, strGet(SERVOSTEPS),0); |
lcd_puts_at(0, 7, strGet(KEYLINE2), 0); |
tmp_val = Config.sIdxSteps; |
if (Change_Value(&tmp_val, STEPS_255, STEPS_1023,Displ_Servo_Steps)) |
{ |
cli(); |
Config.sIdxSteps = tmp_val; |
Servo_NewValues(Config.sIdxSteps); // hier ist der neue Index anzugeben! |
servoInit(SERVO_PERIODE); |
sei(); |
} |
} |
void adjust_servo_menu(uint8_t servo) |
{ |
// uint8_t ii = 0; |
// uint8_t Offset = 0; |
// uint8_t dmode = 0; |
uint8_t target_pos = 1; |
// uint8_t val = 0; |
char ServoNr; |
servo_nr = servo; |
if (servo_nr == 0) ServoNr = '1'; else ServoNr = '2'; |
while(1) |
{ |
size = ITEMS_SERVOADJUST; |
lcd_cls (); |
lcd_printpns_at(0, 0, PSTR("adjust servo "), 2); |
lcd_putc (18, 0, ServoNr, 2); |
lcd_puts_at(0, 7, strGet(KEYLINE1), 0); |
// while(2) |
// { |
// ii = 0; |
// if(Offset > 0) |
// { |
// lcd_printp_at(1,1, PSTR("\x12"), 0); |
// } |
// for(ii = 0;ii < 6 ; ii++) |
// { |
// if((ii+Offset) < size) |
// { |
// lcd_printp_at(3,ii+1,servo_adjust_menuitems[ii+Offset][Config.DisplayLanguage], 0); |
// } |
// if((ii == 5)&&(ii+Offset < (size-1))) |
// { |
// lcd_printp_at(1,6, PSTR("\x13"), 0); |
// } |
// } |
// if(dmode == 0) |
// { |
// if(Offset == 0) |
// { |
// if(size > 6) |
// { |
// val = menu_choose2 (1, 5, target_pos,0,1); |
// } |
// else |
// { |
// val = menu_choose2 (1, size, target_pos,0,0); |
// } |
// } |
// else |
// { |
// val = menu_choose2 (2, 5, target_pos,1,1); |
// } |
// } |
// if(dmode == 1) |
// { |
// if(Offset+7 > size) |
// { |
// val = menu_choose2 (2, 6, target_pos,1,0); |
// } |
// else |
// { |
// val = menu_choose2 (2, 5, target_pos,1,1); |
// } |
// } |
// if(val == 254) |
// { |
// Offset++; |
// dmode = 1; |
// target_pos = 5; |
// } |
// else if(val == 253) |
// { |
// Offset--; |
// dmode = 0; |
// target_pos = 2; |
// } |
// else if(val == 255) |
// { |
// if (edit == 1) |
// { |
// |
//// WriteParameter(); |
// edit = 0; |
// return; |
// } |
// return; |
// } |
// else |
// { |
// break; |
// } |
// } |
val = menu_select(servo_adjust_menuitems,size,target_pos); |
if (val==255) break; |
target_pos = val; |
// {"Reverse ","reverse ","reverse "}, |
// {"Links ","left ","left "}, |
// {"Rechts ","right ","rigth "}, |
// {"Mitte ","middle ","middle "}, |
if(val == 1 ) |
{ |
Menu_Servo_rev(); |
} |
if(val == 2 ) |
{ |
Menu_Servo_left(); |
} |
if(val == 3 ) |
{ |
Menu_Servo_rigth(); |
} |
if(val == 4 ) |
{ |
Menu_Servo_mid(); |
} |
} |
} |
//-------------------------------------------------------------- |
void servo_menu(void) |
{ |
// uint8_t ii = 0; |
// uint8_t Offset = 0; |
// uint8_t dmode = 0; |
uint8_t target_pos = 1; |
// uint8_t val = 0; |
edit =0; |
while(1) |
{ |
size = ITEMS_SERVO; |
lcd_cls (); |
lcd_printpns_at(0, 0, PSTR("servo_menu"), 2); |
// lcd_printp_at (0, 7, PSTR(KEY_LINE_1), 0); |
lcd_puts_at(0, 7, strGet(KEYLINE1), 0); |
// while(2) |
// { |
// ii = 0; |
// if(Offset > 0) |
// { |
// lcd_printp_at(1,1, PSTR("\x12"), 0); |
// } |
// for(ii = 0;ii < 6 ; ii++) |
// { |
// if((ii+Offset) < size) |
// { |
// lcd_printp_at(3,ii+1,servo_menuitems[ii+Offset][Config.DisplayLanguage], 0); |
// } |
// if((ii == 5)&&(ii+Offset < (size-1))) |
// { |
// lcd_printp_at(1,6, PSTR("\x13"), 0); |
// } |
// } |
// if(dmode == 0) |
// { |
// if(Offset == 0) |
// { |
// if(size > 6) |
// { |
// val = menu_choose2 (1, 5, target_pos,0,1); |
// } |
// else |
// { |
// val = menu_choose2 (1, size, target_pos,0,0); |
// } |
// } |
// else |
// { |
// val = menu_choose2 (2, 5, target_pos,1,1); |
// } |
// } |
// if(dmode == 1) |
// { |
// if(Offset+7 > size) |
// { |
// val = menu_choose2 (2, 6, target_pos,1,0); |
// } |
// else |
// { |
// val = menu_choose2 (2, 5, target_pos,1,1); |
// } |
// } |
// if(val == 254) |
// { |
// Offset++; |
// dmode = 1; |
// target_pos = 5; |
// } |
// else if(val == 253) |
// { |
// Offset--; |
// dmode = 0; |
// target_pos = 2; |
// } |
// else if(val == 255) |
// { |
// if (edit == 1) |
// { |
//// WriteParameter(); |
// edit = 0; |
// return; |
// } |
// return; |
// } |
// else |
// { |
// break; |
// } |
// } |
val = menu_select(servo_menuitems,size,target_pos); |
if (val==255) break; |
target_pos = val; |
// Edit_generic(uint8_t Value, uint8_t min, uint8_t max,uint8_t Text, uint8_t what |
// if(val == 1 ) sIdxSteps=Edit_generic (sIdxSteps, STEPS_255, STEPS_1023,SERVOSTEPS,0); |
if(val == 1 ) Menu_Servo_Steps(); |
if(val == 2 ) |
adjust_servo_menu(0); |
if(val == 3 ) |
adjust_servo_menu(1); |
if(val == 4 ) |
test_servo_menu(); |
} |
} |
//-------------------------------------------------------------- |
//-------------------------------------------------------------- |
//void start_tracking(void) |
//{ |
// #define TIMEOUT 200 // 2 sec |
// |
// uint16_t old_anglePan = 0; |
// uint16_t old_angleTilt = 0; |
// |
// //uint16_t old_hh = 0; |
// uint8_t flag; |
// uint8_t tmp_dat; |
// |
// lcd_cls (); |
// //lcd_printpns_at(0, 0, PSTR("start_tracking "), 2); |
// |
// //lcd_printpns_at(0, 1, PSTR("ab jetzt Tracking"), 0); |
// |
// lcd_ecircle(22, 35, 16, 1); |
// lcd_ecircle(88, 35, 16, 1); |
// lcd_putc (10, 1, 0x1e, 0); // degree symbol |
// lcd_putc (20, 1, 0x1e, 0); // degree symbol |
//// lcd_printp_at (0, 7, PSTR(KEY_LINE_1), 0); |
// lcd_puts_at(0, 7, strGet(KEYLINE1), 0); |
// SwitchToNC(); |
// |
// mode = 'O'; |
// |
// // disable debug... |
// // RS232_request_mk_data (0, 'd', 0); |
// tmp_dat = 0; |
// SendOutData ('d', ADDRESS_ANY, 1, &tmp_dat, 1); |
// |
// // request OSD Data from NC every 100ms |
// // RS232_request_mk_data (1, 'o', 100); |
// tmp_dat = 10; |
// SendOutData ('o', ADDRESS_NC, 1, &tmp_dat, 1); |
// |
// if (rxd_buffer_locked) |
// { |
// timer = TIMEOUT; |
// Decode64 (); |
// naviData = (NaviData_t *) pRxData; |
// |
// if(error1 == 1) |
// lcd_cls(); |
// } |
// |
// GPS_Pos_t currpos; |
// currpos.Latitude = naviData->CurrentPosition.Latitude; |
// currpos.Longitude = naviData->CurrentPosition.Longitude; |
// |
// flag = 0; |
// timer = TIMEOUT; |
// abo_timer = ABO_TIMEOUT; |
// |
// coldstart = 1; |
// |
// do |
// { |
// if (rxd_buffer_locked) |
// { |
// timer = TIMEOUT; |
// Decode64 (); |
// naviData = (NaviData_t *) pRxData; |
// |
// |
////CB uint8_t FCStatusFlag = naviData->FCFlags; |
// uint8_t FCStatusFlag = naviData->FCStatusFlags; |
// //write_ndigit_number_u (0, 0, FCStatusFlag); |
// |
// Tracking_GPS(); |
// |
// //uint16_t heading_home = (naviData->HomePositionDeviation.Bearing + 360 - naviData->CompassHeading) % 360; |
// |
// // alte Linien löschen |
// //lcd_ecirc_line (22, 35, 15, old_hh, 0); |
// //old_hh = heading_home; |
// lcd_ecirc_line (22, 35, 15, old_anglePan, 0); |
// old_anglePan = anglePan; |
// lcd_ecirc_line (88, 35, 15, old_angleTilt, 0); |
// old_angleTilt = angleTilt; |
// |
// lcd_ecirc_line (22, 35, 15, anglePan, 1); |
// write_ndigit_number_u (7, 1, anglePan, 3, 0,0); |
// lcd_ecirc_line (88, 35, 15, angleTilt, 1); |
// write_ndigit_number_u (17, 1, angleTilt, 3, 0,0); |
// |
// rxd_buffer_locked = FALSE; |
// |
// if (!abo_timer) |
// { // renew abo every 3 sec |
// // request OSD Data from NC every 100ms |
// // RS232_request_mk_data (1, 'o', 100); |
// tmp_dat = 10; |
// SendOutData ('o', ADDRESS_NC, 1, &tmp_dat, 1); |
// |
// abo_timer = ABO_TIMEOUT; |
// } |
// } |
// |
// if (!timer) |
// { |
// OSD_Timeout(flag); |
// flag = 0; |
// } |
// } |
// while(!get_key_press (1 << KEY_ESC)); |
// |
// //lcd_cls(); |
// //return; |
//} |
//-------------------------------------------------------------- |
// |
//void conect2at_unit(void) |
//{ |
// lcd_cls (); |
// lcd_printpns_at(0, 0, PSTR("conect2at_unit "), 2); |
// |
// lcd_printpns_at(0, 3, PSTR("work in progress ;)"), 2); |
// |
//// lcd_printp_at (0, 7, PSTR(KEY_LINE_1), 0); |
// lcd_puts_at(0, 7, strGet(KEYLINE1), 0); |
// |
// while(!get_key_press (1 << KEY_ESC)); |
// |
// lcd_cls(); |
// return; |
//} |
// |
////-------------------------------------------------------------- |
// |
//void conect2gps_ser (void) |
//{ |
// lcd_cls (); |
// lcd_printpns_at(0, 0, PSTR("conect2gps_ser "), 2); |
// |
// lcd_printpns_at(0, 3, PSTR("work in progress ;)"), 2); |
// |
//// lcd_printp_at (0, 7, PSTR(KEY_LINE_1), 0); |
// lcd_puts_at(0, 7, strGet(KEYLINE1), 0); |
// while(!get_key_press (1 << KEY_ESC)); |
// |
// lcd_cls(); |
// return; |
//} |
// |
////-------------------------------------------------------------- |
// |
//void conect2gps_bt (void) |
//{ |
// lcd_cls (); |
// lcd_printpns_at(0, 0, PSTR("conect2gps_bt "), 2); |
// |
// lcd_printpns_at(0, 3, PSTR("work in progress ;)"), 2); |
// |
//// lcd_printp_at (0, 7, PSTR(KEY_LINE_1), 0); |
// lcd_puts_at(0, 7, strGet(KEYLINE1), 0); |
// while(!get_key_press (1 << KEY_ESC)); |
// |
// lcd_cls(); |
// return; |
//} |
//-------------------------------------------------------------- |
//void conect2gps_menu(void) |
//{ |
// uint8_t ii = 0; |
// uint8_t Offset = 0; |
// uint8_t size = ITEMS_CONECT_GPS; |
// uint8_t dmode = 0; |
// uint8_t target_pos = 1; |
// uint8_t val = 0; |
// |
// while(1) |
// { |
// lcd_cls (); |
// lcd_printpns_at(0, 0, PSTR("conect2gps_menu "), 2); |
//// lcd_printp_at (0, 7, PSTR(KEY_LINE_1), 0); |
// lcd_puts_at(0, 7, strGet(KEYLINE1), 0); |
// while(2) |
// { |
// ii = 0; |
// if(Offset > 0) |
// { |
// lcd_printp_at(1,1, PSTR("\x12"), 0); |
// } |
// for(ii = 0;ii < 6 ; ii++) |
// { |
// if((ii+Offset) < size) |
// { |
// lcd_printp_at(3,ii+1,conect_gps_menuitems[ii+Offset], 0); |
// } |
// if((ii == 5)&&(ii+Offset < (size-1))) |
// { |
// lcd_printp_at(1,6, PSTR("\x13"), 0); |
// } |
// } |
// if(dmode == 0) |
// { |
// if(Offset == 0) |
// { |
// if(size > 6) |
// { |
// val = menu_choose2 (1, 5, target_pos,0,1); |
// } |
// else |
// { |
// val = menu_choose2 (1, size, target_pos,0,0); |
// } |
// } |
// else |
// { |
// val = menu_choose2 (2, 5, target_pos,1,1); |
// } |
// } |
// if(dmode == 1) |
// { |
// if(Offset+7 > size) |
// { |
// val = menu_choose2 (2, 6, target_pos,1,0); |
// } |
// else |
// { |
// val = menu_choose2 (2, 5, target_pos,1,1); |
// } |
// } |
// if(val == 254) |
// { |
// Offset++; |
// dmode = 1; |
// target_pos = 5; |
// } |
// else if(val == 253) |
// { |
// Offset--; |
// dmode = 0; |
// target_pos = 2; |
// } |
// else if(val == 255) |
// { |
// return; |
// } |
// else |
// { |
// break; |
// } |
// } |
// target_pos = val; |
// |
// if((val+Offset) == 1 ) |
// conect2gps_ser(); |
// if((val+Offset) == 2 ) |
// conect2gps_bt(); |
// } |
//} |
//-------------------------------------------------------------- |
//void tracking_menu(void) |
//{ |
// uint8_t ii = 0; |
// uint8_t Offset = 0; |
// uint8_t size = ITEMS_AT; |
// uint8_t dmode = 0; |
// uint8_t target_pos = 1; |
// uint8_t val = 0; |
// |
// while(1) |
// { |
// lcd_cls (); |
// lcd_printpns_at(1, 0, PSTR("Tracking Men\x06 V.01 "), 2); |
//// lcd_printp_at (0, 7, PSTR(KEY_LINE_1), 0); |
// lcd_puts_at(0, 7, strGet(KEYLINE1), 0); |
// while(2) |
// { |
// ii = 0; |
// if(Offset > 0) |
// { |
// lcd_printp_at(1,1, PSTR("\x12"), 0); |
// } |
// for(ii = 0;ii < 6 ; ii++) |
// { |
// if((ii+Offset) < size) |
// { |
// lcd_printp_at(3,ii+1,at_menuitems[ii+Offset], 0); |
// } |
// if((ii == 5)&&(ii+Offset < (size-1))) |
// { |
// lcd_printp_at(1,6, PSTR("\x13"), 0); |
// } |
// } |
// if(dmode == 0) |
// { |
// if(Offset == 0) |
// { |
// if(size > 6) |
// { |
// val = menu_choose2 (1, 5, target_pos,0,1); |
// } |
// else |
// { |
// val = menu_choose2 (1, size, target_pos,0,0); |
// } |
// } |
// else |
// { |
// val = menu_choose2 (2, 5, target_pos,1,1); |
// } |
// } |
// if(dmode == 1) |
// { |
// if(Offset+7 > size) |
// { |
// val = menu_choose2 (2, 6, target_pos,1,0); |
// } |
// else |
// { |
// val = menu_choose2 (2, 5, target_pos,1,1); |
// } |
// } |
// if(val == 254) |
// { |
// Offset++; |
// dmode = 1; |
// target_pos = 5; |
// } |
// else if(val == 253) |
// { |
// Offset--; |
// dmode = 0; |
// target_pos = 2; |
// } |
// else if(val == 255) |
// { |
// return; |
// } |
// else |
// { |
// break; |
// } |
// } |
// target_pos = val; |
// |
// if((val+Offset) == 1 ) |
// test_servo_menu(); |
// if((val+Offset) == 2 ) |
// adjust_servo_menu(); |
// if((val+Offset) == 3 ) |
// show_angle(); |
// if((val+Offset) == 4 ) |
////TODO: start_tracking(); |
// if((val+Offset) == 5 ) |
// conect2at_unit(); |
// if((val+Offset) == 6 ) |
// conect2gps_menu(); |
// } |
//} |
//-------------------------------------------------------------- |
// kapeschi Ant.Treking Funktionen |
//-------------------------------------------------------------- |
// Berechnung von Distanz und Winkel aus GPS-Daten home(MK eingeschaltet) |
// zur aktuellen Position(nach Motorstart) |
//geo_t calc_geo(HomePos_t *home, GPS_Pos_t *pos) |
//{ int32_t lat1, lon1, lat2, lon2; |
// int32_t d1, dlat; |
// geo_t geo; |
// |
// lon1 = MK_pos.Home_Lon; |
// lat1 = MK_pos.Home_Lat; |
// lon2 = pos->Longitude; |
// lat2 = pos->Latitude; |
// |
// // Formel verwendet von http://www.kompf.de/gps/distcalc.html |
// // 111.3 km = Abstand zweier Breitenkreise und/oder zweier Längenkreise am Äquator |
// // es wird jedoch in dm Meter weiter gerechnet |
// // (tlon1 - tlon2)/10) sonst uint32_t-Überlauf bei cos(0) gleich 1 |
// d1 = (1359 * (int32_t)(c_cos_8192((lat1 + lat2) / 20000000)) * ((lon1 - lon2)/10))/ 10000000; |
// dlat = 1113 * (lat1 - lat2) / 10000; |
// geo.bearing = (my_atan2(d1, dlat) + 540) % 360; // 360 +180 besserer Vergleich mit MkCockpit |
// geo.distance = sqrt32(d1 * d1 + dlat * dlat); |
// return(geo); |
//} |
//void do_tracking(void) |
//{ //static uint8_t hysteresis = 0; |
// // aus MkCockpit http://forum.mikrokopter.de/topic-post216136.html#post216136 |
// // (4 * (........))/5 ==> Wichtung Luftdruck-Höhe zu GPS |
// currentPos.Altitude = MK_pos.Home_Alt + (4000 * (int32_t)(naviData->Altimeter) / AltFaktor + currentPos.Altitude - MK_pos.Home_Alt) / 5; |
// |
// geo = calc_geo(&MK_pos, ¤tPos); |
// angleTilt = RAD_TO_DEG * (double)atan2((double)(currentPos.Altitude - MK_pos.Home_Alt) / 1000, geo.distance); |
// //if (geo.distance < 4 || (geo.distance < 6 && hysteresis)) { // < 4m ==> Pan-Servo in Mittelstellung. Hysterese bis 6m, damit Servo im Grenzbereich nicht wild rumschlägt |
// //geo.bearing = MK_pos.direction; |
// //angleTilt = 0; |
// //hysteresis = 1; |
// //} |
// //else { |
// //hysteresis = 0; |
// //} |
//// |
// //// egal wo der Übergangspunkt 359, 360, 1grd ist => Winkelübergangspunkt auf 0 bzw. 180grd des Servos bringen |
// //// 360 grd negative Winkelwerte als positive |
// anglePan = (geo.bearing + 450 - MK_pos.direction) % 360; // 450 = 360 + 90 |
// |
// //if (angleTilt < 0) angleTilt = 0; |
// //if (angleTilt > 180) angleTilt = 180; |
//// |
// //if (anglePan >= 180) { // zwecks 360grd-Abdeckung flipt Pan-/Tilt-Servo |
// //anglePan = anglePan - 180; |
// //angleTilt = 180 - angleTilt; |
// // |
// //} |
////angleTilt = 180; |
////angleTilt = 180; |
// |
//// servoSetAngle(0, anglePan); |
//// servoSetAngle(1, angleTilt); |
//} |
/****************************************************************/ |
/* */ |
/* MK GPS Tracking */ |
/* */ |
/****************************************************************/ |
// MK OSD-Daten lesen und verifizieren |
//uint8_t OSD_Data_valid(NaviData_t **navi_data) |
//{ uint8_t ret = 0; |
//char *tx_osd = {"#co?]==EH\r"}; |
//// char interval[2] = {10, '\0'}; |
// |
//if (rx_line_decode('O')) { // OSD-Datensatz prüfen/dekodieren |
////*navi_data = (NaviData_t*)data_decode; // dekodierte Daten mit Struktur OSD-Daten versehen |
//if (rx_timeout < RX_TIME_OLD) { // GPS-Daten nicht zu alt und ok. |
//currentPos = (*navi_data)->CurrentPosition; |
//if ((*navi_data)->NCFlags & NC_FLAG_GPS_OK) |
//ret = 1; |
//// aus MkCockpit http://forum.mikrokopter.de/topic-post216136.html#post216136 |
//// (4 * (........))/5 ==> Wichtung Luftdruck-Höhe zu GPS |
//currentPos.Altitude = MK_pos.Home_Alt + (4000 * (int32_t)((*navi_data)->Altimeter) / AltFaktor + currentPos.Altitude - MK_pos.Home_Alt) / 5; |
//satsInUse = (*navi_data)->SatsInUse; |
//} |
//} |
//// ca. 210ms keine OSD-Daten empfangen ==> sende neue Anforderung an MK |
//// if ((track_tx) && (rx_timeout > RX_TIMEOUT)) tx_Mk(NC_ADDRESS, 'o', interval, 1); // 420 * 0.5ms interval |
//if ((track_tx) && (rx_timeout > RX_TIMEOUT)) SendOutData(tx_osd); // 420 * 0.5ms interval |
//return ret; |
//} |
// |
// MK eingeschaltet und GPS-ok, danach Motoren gestartet ==> Berechnung horizontaler/vertikaler Servowinkel |
// Hauptprogramm von GPS Antennen-Nachführung |
//void Tracking_GPS(void) |
//{ //NaviData_t *navidata; |
// static uint8_t track_running = 0; |
// |
// if (!track_running) |
// { |
// //track_running = 1; // verhindert doppelten Aufruf, wenn in Eingabeschleife Menu_MK_BatteryChangeNr() !!! |
// //if (OSD_Data_valid(&naviData)) { |
// if (coldstart) |
// { |
// //// erst nach Neustart NGVideo und beim Motorstart werden Daten vom MK übernommen |
// //if (naviData->FCFlags & FC_FLAG_MOTOR_START) |
// //{ |
// MK_pos.Home_Lon = (double)naviData->HomePosition.Longitude / 10000000.0; |
// MK_pos.Home_Lat = (double)naviData->HomePosition.Latitude / 10000000.0; |
// MK_pos.Home_Lon7 = naviData->HomePosition.Longitude; |
// MK_pos.Home_Lat7 = naviData->HomePosition.Latitude; |
// MK_pos.Home_Alt = naviData->HomePosition.Altitude; |
// MK_pos.direction = naviData->CompassHeading; |
// coldstart = 0; |
// //} |
// //} |
// //else { |
// //do_tracking(); |
// } |
// //} |
// track_running = 0; |
// } |
// do_tracking(); |
//} |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/tracking/servo_setup.h |
---|
0,0 → 1,46 |
#ifndef _TRACKING_H_ |
#define _TRACKING_H_ |
#define TRACKING_RSSI 1 |
#define TRACKING_GPS 2 |
#define TRACKING_MKCOCKPIT 3 |
#define TRACKING_NMEA 4 |
#define DLEFT 0 |
#define DRIGHT 1 |
#define AltFaktor 22.5 |
#define PAN_SERVO_CORRECT 3.125 |
#define TILT_SERVO_CORRECT 3.125 |
typedef void (*Displ_Fnct_t)( uint16_t ); |
//typedef struct { |
// int32_t distance; |
// int16_t bearing; |
//}geo_t; |
//typedef struct { |
// double Home_Lon; // in degrees |
// double Home_Lat; // in degrees |
// int32_t Home_Lon7; // in 1E-7 degrees |
// int32_t Home_Lat7; // in 1E-7 degrees |
// int32_t Home_Alt; // in mm |
// // ermittelte Konstante aus Mittelposition Antenne geo.bearing - navi_data.CompassHeading |
// int16_t direction; |
//}__attribute__((packed)) HomePos_t; |
#define INTERNAT_STEPS_255 "255 " |
#define INTERNAT_STEPS_1023 "1023" |
// kapeschi |
void servo_menu(void); |
void servotest_cont_menu(void); |
void Tracking_GPS(void); |
void Tracking_NMEA(void); |
void Tracking_RSSI(void); |
void setNMEAdir(void); |
#endif |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/tracking/tools.c |
---|
0,0 → 1,180 |
/****************************************************************/ |
/* */ |
/* NG-Video 5,8GHz */ |
/* */ |
/* Copyright (C) 2011 - gebad */ |
/* */ |
/* This code is distributed under the GNU Public License */ |
/* which can be found at http://www.gnu.org/licenses/gpl.txt */ |
/* */ |
/****************************************************************/ |
#include <stdlib.h> |
#include <util/delay.h> |
#include <avr/pgmspace.h> |
//#include "config.h" |
//#include "dogm.h" |
#include "tools.h" |
//#include "messages.h" |
#define MAX_POWER 10 |
#define getPower(x) (int32_t)pgm_read_dword(&powers[x]) |
const int32_t PROGMEM powers[MAX_POWER] = {1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000}; |
/* Funktion zur Umwandlung einer vorzeichenbehafteten Integer |
32-Bit "Festkomma-Zahl"(gedachtes Komma in Integer) in einen String |
vereinfacht Variablenübergabe funktion change_value(uint16_t x), |
kein printf, double oder float |
siehe http://www.mikrocontroller.net/articles/Festkommaarithmetik |
len: max 13, Gesamtlänge des Resultats inklusive Vorzeichen und Komma, Rest wird mit ' ' aufgefüllt |
fixedPoint: Position des Kommas im Integer-Wert. Bei Wert in mm und Anzeige in m ist das z.B. 3 |
afterPoint: Ziffern nach dem Komma = wieviele der fixedPoint Ziffern angezeigt werden sollen |
Ist nicht genug Platz für die Zahl vorhanden werden nur '*' Zeichen ausgegeben! |
makefile derzeit somit auch ohne! Minimalistic printf version*/ |
char *my_itoa(int32_t value, uint8_t len, uint8_t fixedPoint, uint8_t afterPoint) |
{ int8_t i; |
int8_t digits, digitsNeeded; |
uint8_t neg = 0; |
static char str[13]; |
// Terminate string |
str[len] = '\0'; |
// Reduce precision of value if we're not supposed to show all of the mantissa |
if (fixedPoint > afterPoint) { |
value /= getPower(fixedPoint - afterPoint); |
fixedPoint = afterPoint; |
} |
// Handle negative values |
if (value < 0) { |
value = -value; |
neg = 1; |
} |
// Check how many digits we've got in total and if it fits in our space |
for (digits = 1; digits < MAX_POWER && value >= getPower(digits); digits++); |
if (neg) digits++; // We also need space for the sign |
if (fixedPoint) digits++; // Plus space for decimal point |
digitsNeeded = digits - len; |
if (digitsNeeded > 0) { |
// Not enough space, do something |
if (digitsNeeded == fixedPoint || digitsNeeded == fixedPoint + 1) { // +1 = space for decimal point that we can get rid of |
// If space is just big enough for integer part then simply don't show mantissa BUT ROUND CORRECTLY |
value = (value + 5 * getPower(fixedPoint - 1)) / getPower(fixedPoint); |
fixedPoint = 0; |
} else if (digitsNeeded < fixedPoint) { |
// We can reduce precision to make it fit (round correctly) |
value = (value + 5 * getPower(digitsNeeded - 1)) / getPower(digitsNeeded); |
fixedPoint -= digitsNeeded; |
} else { |
// Error, cannot display value! Let's show stars |
for (i = len - 1; i >= 0; --i) str[i] = '*'; |
return str; |
} |
} |
for (i = len - 1; i >= neg; --i) { |
if (fixedPoint && i == len - fixedPoint - 1) { |
// Insert decimal point at the right location |
// str[i] = Msg(MSG_KOMMA)[0]; |
str[i] = ','; |
fixedPoint = 0; // Now in integer part |
} else { |
str[i] = (value % 10) + '0'; |
value /= 10; |
// Break if we're in integer part and there are only zeros from this point on |
if (value == 0 && fixedPoint == 0) { |
--i; |
break; |
} |
} |
} |
// Insert sign |
if (neg) str[i--] = '-'; |
// Rest is blank |
for (; i >= 0; --i) |
str[i] = ' '; |
return str; |
} |
// Trying to avoid floating point maths here. Converts a floating point string to an integer with a smaller unit |
// i.e. floatStrToInt("4.5", 2) = 4.5 * 1E2 = 450 |
int32_t floatStrToInt(const char *s, int32_t power1) |
{ char *endPtr; |
int32_t v = strtol(s, &endPtr, 10); |
if (*endPtr == '.') { |
for (s = endPtr + 1; *s && power1; s++) { |
v = v * 10 + (*s - '0'); |
--power1; |
} |
} |
if (power1) { |
// Table to avoid multiple multiplications |
v = v * getPower(power1); |
} |
return v; |
} |
// Delay helper |
void delay_ms100x(uint8_t delay) |
{ |
for ( uint8_t i=0; i<delay; i++) |
_delay_ms(100); |
} |
// |
///************************************************************************************/ |
///* */ |
///* Zeitanzeige */ |
///* */ |
///************************************************************************************/ |
// |
//uint32_t TimeBase60(char *str, uint32_t time, uint8_t idx) |
//{ uint32_t tmp = time % 60; |
// |
// str[idx] = (tmp / 10) + '0'; |
// str[idx + 1] = (tmp % 10) + '0'; |
// return time / 60; |
//} |
// |
//void Displ_TimeMS(int32_t time) |
//{ char str[7]; |
// |
// str[6] = '\0'; |
// if (time < 0) { |
// time = abs(time); |
// str[0] = '-'; |
// } |
// else |
// str[0] = ' '; |
// time = TimeBase60(str, time, 4); |
// str[3] = ':'; |
// TimeBase60(str, time, 1); |
// lcdPuts(str); |
//} |
// |
//void Displ_TimeHMS(uint32_t time) |
//{ char str[9]; |
// |
// time /= T2SECDIV; // Zähler aller 500µs |
// str[8] = '\0'; |
// time = TimeBase60(str, time, 6); |
// str[5] = ':'; |
// time = TimeBase60(str, time, 3); |
// str[2] = ':'; |
// TimeBase60(str, time, 0); |
// lcdPuts(str); |
//} |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/tracking/tools.h |
---|
0,0 → 1,15 |
#ifndef _TOOLS_H_ |
#define _TOOLS_H_ |
#include <avr/io.h> |
//char *my_itoa(int32_t value, uint8_t sign, uint8_t len, uint8_t fixedPoint, uint8_t afterPoint); |
char *my_itoa(int32_t value, uint8_t len, uint8_t fixedPoint, uint8_t afterPoint); |
int32_t floatStrToInt(const char *s, int32_t power1); |
void delay_ms100x(uint8_t delay); |
void Displ_TimeMS(int32_t time); |
void Displ_TimeHMS(uint32_t time); |
#endif |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/tracking/tracking.c |
---|
0,0 → 1,694 |
/* |
* tracking.c |
* |
* Created on: 13.02.2012 |
* Author: cebra |
*/ |
#include "../cpu.h" |
#include <string.h> |
#include <util/delay.h> |
#include <avr/interrupt.h> |
#include <stdlib.h> |
#include <math.h> |
#include "../main.h" |
#include "../tracking/tracking.h" |
#include "../tracking/ng_servo.h" |
#include <avr/pgmspace.h> |
#include "../bluetooth/fifo.h" |
#include "../bluetooth/bluetooth.h" |
#include "../lcd/lcd.h" |
#include "../mk-data-structs.h" |
#include "tools.h" |
#include "../messages.h" |
#include "../lcd/lcd.h" |
#include "../eeprom/eeprom.h" |
#include "../timer/timer.h" |
#include "../uart/uart1.h" |
#include "../uart/usart.h" |
#include "../osd/osd.h" |
#include "../tracking/mymath.h" |
#include "../setup/setup.h" |
#ifdef HWVERSION3_9 |
//#define MAX_POWER 10 |
//#define getPower(x) (int32_t)pgm_read_dword(&powers[x]) |
//const int32_t PROGMEM powers[MAX_POWER] = {1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000}; |
#define DLEFT 0 |
#define DRIGHT 1 |
#define DEG_TO_RAD 0.0174533 // degrees to radians = PI / 180 |
#define RAD_TO_DEG 57.2957795 // radians to degrees = 180 / PI |
#define AltFaktor 22.5 |
#define TIMEOUT 200 // 2 sec |
NaviData_t *naviData; |
mk_param_struct_t *mk_param_struct; |
HomePos_t MK_pos; // Home position of station |
GPS_Pos_t currentPos; // Current position of flying object |
uint8_t NMEAsatsInUse; // Number of satelites currently in use BT-Mouse |
//uint8_t MKsatsInUse; // Number of satelites currently in use Mikrokopter |
int32_t NMEAlatitude, NMEAlongitude; // Longitude, Latitude |
int16_t NMEAaltitude; // Höhe in Meter |
uint8_t posfix; // GPS Fix, 0 = Fix not available or invalid,1 = GPS SPS Mode, fix valid, |
// 2 = Differential GPS, SPS Mode, fix valid, 6 = Dead Reckoning Mode, fix valid |
int16_t HDOP; // Horizontal Dilution of Precision, 1.1 -xx.x, niederiger = besser |
uint8_t tracking = TRACKING_MIN; |
uint8_t track_hyst = TRACKING_HYSTERESE; |
uint8_t track_tx =0; |
uint8_t coldstart; // Flag erstmaliger MK-Start(Motore) nur nach GPS-Fix |
geo_t geo; |
int16_t anglePan, angleTilt; |
char NMEAtime[9] = "GP:Ti:me"; |
//char NMEADate [6]; |
//// Berechnung von Distanz und Winkel aus GPS-Daten home(MK eingeschaltet) |
//// zur aktuellen Position(nach Motorstart) |
//geo_t calc_geo(HomePos_t *home, GPS_Pos_t *pos) |
//{ double lat1, lon1, lat2, lon2, d1, dlat; |
// geo_t geo; |
// |
// lon1 = MK_pos.Home_Lon; |
// lat1 = MK_pos.Home_Lat; |
// lon2 = (double)pos->Longitude / 10000000.0; |
// lat2 = (double)pos->Latitude / 10000000.0; |
// |
// // Formel verwendet von http://www.kompf.de/gps/distcalc.html |
// // 111.3 km = Abstand zweier Breitenkreise und/oder zweier Längenkreise am Äquator |
// // es wird jedoch in Meter weiter gerechnet |
// d1 = 111300 * (double)cos((double)(lat1 + lat2) / 2 * DEG_TO_RAD) * (lon1 - lon2); |
// dlat = 111300 * (double)(lat1 - lat2); |
// // returns a value in metres http://www.kompf.de/gps/distcalc.html |
// geo.bearing = fmod((RAD_TO_DEG * (double)atan2(d1, dlat)) + 180, 360); // +180 besserer Vergleich mit MkCockpit |
// if (geo.bearing > 360) geo.bearing -= 360; // bekam schon Werte über 400 |
// geo.distance = sqrt(d1 * d1 + dlat * dlat); |
// return(geo); |
//} |
// Berechnung von Distanz und Winkel aus GPS-Daten home(MK eingeschaltet) |
// zur aktuellen Position(nach Motorstart) |
geo_t calc_geo(HomePos_t *home, GPS_Pos_t *pos) |
{ int32_t lat1, lon1, lat2, lon2; |
int32_t d1, dlat; |
geo_t geo; |
lon1 = home->Home_Lon; |
lat1 = home->Home_Lat; |
lon2 = pos->Longitude; |
lat2 = pos->Latitude; |
if (!CheckGPS) |
{ |
lcd_puts_at (0, 3, my_itoa(home->Home_Lat, 10, 7, 7), 0); |
lcd_puts_at (11, 3, my_itoa(home->Home_Lon, 10, 7, 7), 0); |
lcd_puts_at (0, 4, my_itoa(pos->Latitude, 10, 7, 7), 0); |
lcd_puts_at (11, 4, my_itoa(pos->Longitude, 10, 7, 7), 0); |
} |
// lcd_printp_at (0, 3, PSTR("H"), 0); |
// lcd_printp_at (0, 4, PSTR("M"), 0); |
// Formel verwendet von http://www.kompf.de/gps/distcalc.html |
// 111.3 km = Abstand zweier Breitenkreise und/oder zweier Langenkreise am Äquator |
// es wird jedoch in dm Meter weiter gerechnet |
// (tlon1 - tlon2)/10) sonst uint32_t-Überlauf bei cos(0) gleich 1 |
d1 = (1359 * (int32_t)(c_cos_8192((lat1 + lat2) / 20000000)) * ((lon1 - lon2)/10))/ 10000000; |
dlat = 1113 * (lat1 - lat2) / 10000; |
geo.bearing = (my_atan2(d1, dlat) + 540) % 360; // 360 +180 besserer Vergleich mit MkCockpit |
geo.distance = sqrt32(d1 * d1 + dlat * dlat); |
if (!CheckGPS) |
{ |
lcd_printp_at (0, 5, PSTR("Bear:"), 0); |
lcd_puts_at (5, 5, my_itoa((uint32_t)geo.bearing, 3, 0, 0), 0); |
lcd_printp_at (8, 5, PSTR("\x1e"), 0); |
lcd_printp_at (9, 5, PSTR("Dist:"), 0); |
lcd_puts_at (15, 5, my_itoa((uint32_t)geo.distance, 3, 1, 1), 0); |
lcd_printp_at (20, 5, PSTR("m"), 0); |
} |
return(geo); |
} |
void do_tracking(void) |
{ static uint8_t hysteresis = 0; |
geo = calc_geo(&MK_pos, ¤tPos); |
angleTilt = my_atan2((currentPos.Altitude - MK_pos.Home_Alt) / 100, geo.distance); |
if (geo.distance < 40 || (geo.distance < 60 && hysteresis)) { // < 4m ==> Pan-Servo in Mittelstellung. Hysterese bis 6m, damit Servo im Grenzbereich nicht wild rumschl�gt |
geo.bearing = MK_pos.direction; |
if (currentPos.Altitude - MK_pos.Home_Alt < 4000) angleTilt = 0; // man fliegt nicht direkt �ber Kopf |
hysteresis = 1; |
} |
else { |
hysteresis = 0; |
} |
// egal wo der Übergangspunkt 359, 360, 1grd ist => Winkelübergangspunkt auf 0 bzw. 180grd des Servos bringen |
// 360 grd negative Winkelwerte als positive |
anglePan = (geo.bearing + 450 - MK_pos.direction) % 360; // 450 = 360 + 90 |
if (angleTilt < 0) angleTilt = 0; |
if (angleTilt > 180) angleTilt = 180; |
if (anglePan >= 180) { // zwecks 360grd-Abdeckung flipt Pan-/Tilt-Servo |
anglePan = anglePan - 180; |
angleTilt = 180 - angleTilt; |
} |
servoSetAngle(0, anglePan); |
servoSetAngle(1, angleTilt); |
if (!CheckGPS) |
{ |
lcd_printp_at (0, 6, PSTR("Pan :"), 0); |
write_ndigit_number_u (6, 6, anglePan, 3, 1,0); |
lcd_printp_at (11, 6, PSTR("Tilt:"), 0); |
write_ndigit_number_u (17, 6, angleTilt, 3, 1,0); |
} |
// write_ndigit_number_u (0, 5, (uint16_t)(currentPos.Altitude/10000000), 2, 0,0); |
//// lcd_printp_at (4, 4, PSTR("."), 0); |
// write_ndigit_number_u (2, 5, (uint16_t)((currentPos.Altitude/1000) % 10000), 4, 1,0); |
// write_ndigit_number_u (6, 5, (uint16_t)((currentPos.Altitude/10) % 100), 2, 1,0); |
// |
// write_ndigit_number_u (10, 5, (uint16_t)(MK_pos.Home_Alt/10000000), 2, 0,0); |
//// lcd_printp_at (4, 4, PSTR("."), 0); |
// write_ndigit_number_u (12, 5, (uint16_t)((MK_pos.Home_Alt/1000) % 10000), 4, 1,0); |
// write_ndigit_number_u (16, 5, (uint16_t)((MK_pos.Home_Alt/10) % 100), 2, 1,0); |
} |
//******************************************************************************************************* |
uint8_t PKT_trackingBT(void) // Tracking mit NMEA-Daten von BT-Maus |
{ |
uint8_t BT_WhasOn = 0; |
uint8_t BT_status; |
uint8_t flag; |
uint8_t tmp_dat; |
coldstart =1; |
{ |
// lcd_printp_at(0,1, PSTR("try NMEA data from:"), 0); |
lcd_puts_at (0, 1,Config.gps_UsedDevName, 0); |
set_BTOn(); |
BT_WhasOn = true; |
if (Config.BTIsSlave==true) |
{ |
bt_downlink_init(); |
} |
lcd_printp_at (18, 1, PSTR(" ?? "), 0); |
BT_status = bt_connect(Config.gps_UsedMac); |
if (BT_status==true) |
{ |
lcd_printp_at (18, 1, PSTR(" OK "), 0); |
receiveNMEA = true; |
} |
else lcd_printp_at (17, 1, PSTR("FAIL"), 2); |
if (receiveNMEA==true) |
{ |
lcd_printp_at (0, 2, PSTR("S Latitude Longitude"), 2); |
lcd_cls_line (0,1,20); |
lcd_printp_at (0, 3, PSTR("H"), 0); |
lcd_printp_at (0, 4, PSTR("M"), 0); |
bt_rx_ready = 0; |
SwitchToNC(); |
mode = 'O'; |
// disable debug... |
// RS232_request_mk_data (0, 'd', 0); |
tmp_dat = 0; |
SendOutData ('d', ADDRESS_ANY, 1, &tmp_dat, 1); |
// request OSD Data from NC every 100ms |
// RS232_request_mk_data (1, 'o', 100); |
tmp_dat = 10; |
// OSD_active = true; // benötigt für Navidata Ausgabe an SV2 |
SendOutData ('o', ADDRESS_NC, 1, &tmp_dat, 1); |
flag = 0; |
timer = TIMEOUT; |
abo_timer = ABO_TIMEOUT; |
do |
{ |
// bt_rx_ready = 0; |
if (!bt_receiveNMEA()) |
break; |
if (rxd_buffer_locked) |
{ |
timer = TIMEOUT; |
Decode64 (); |
naviData = (NaviData_t *) pRxData; |
//#ifdef DEBUG |
// debug_pgm(PSTR("setup Tracking_NMEA")); |
//#endif |
currentPos = naviData->CurrentPosition; |
// currentPos.Altitude = MK_pos.Home_Alt + (4000 * (int32_t)(naviData->Altimeter) / AltFaktor + currentPos.Altitude - MK_pos.Home_Alt) / 5; |
// uint32_t lat = currentPos.Latitude; |
// uint32_t lon = currentPos.Longitude; |
// write_ndigit_number_u (2, 4, (uint16_t)(lat/10000000), 2, 0,0); |
// lcd_printp_at (4, 4, PSTR("."), 0); |
// write_ndigit_number_u (5, 4, (uint16_t)((lat/1000) % 10000), 4, 1,0); |
// write_ndigit_number_u (9, 4, (uint16_t)((lat/10) % 100), 2, 1,0); |
// |
// write_ndigit_number_u (12, 4, (uint16_t)(lon/10000000), 2, 0,0); |
// lcd_printp_at (14, 4, PSTR("."), 0); |
// write_ndigit_number_u (15, 4, (uint16_t)((lon/1000) % 10000), 4, 1,0); |
// write_ndigit_number_u (19, 4, (uint16_t)((lon/10) % 100),2, 1,0); |
Tracking_NMEA(); |
// write_ndigit_number_u (2, 3, (uint16_t)(NMEAlatitude/10000000), 2, 0,0); |
// lcd_printp_at (4, 3, PSTR("."), 0); |
// write_ndigit_number_u (5, 3, (uint16_t)((NMEAlatitude/1000) % 10000), 4, 1,0); |
// write_ndigit_number_u (9, 3, (uint16_t)((NMEAlatitude/10) % 100), 2, 1,0); |
// |
// |
// write_ndigit_number_u (12, 3, (uint16_t)(NMEAlongitude/10000000), 2, 0,0); |
// lcd_printp_at (14, 3, PSTR("."), 0); |
// write_ndigit_number_u (15, 3, (uint16_t)((NMEAlongitude/1000) % 10000), 4, 1,0); |
// write_ndigit_number_u (19, 3, (uint16_t)((NMEAlongitude/10) % 100), 2, 1,0); |
// lcd_printp_at (0, 2, PSTR("GPS Time: "), 0); |
if (!CheckGPS) |
{ |
lcd_puts_at (13, 0, NMEAtime, 2); |
lcd_printp_at (16, 1, PSTR("Sat:"), 0); |
write_ndigit_number_u (19, 1, NMEAsatsInUse, 2, 1,0); |
lcd_printp_at (0, 1, PSTR("Fix:"), 0); |
write_ndigit_number_u (4, 1, posfix, 1, 1,0); |
lcd_printp_at (6, 1, PSTR("HDOP:"), 0); |
write_ndigit_number_u_10th (11, 1, HDOP, 3, 0,0); |
} |
rxd_buffer_locked = FALSE; |
if (!abo_timer) |
{ // renew abo every 3 sec |
// request OSD Data from NC every 100ms |
// RS232_request_mk_data (1, 'o', 100); |
tmp_dat = 10; |
SendOutData ('o', ADDRESS_NC, 1, &tmp_dat, 1); |
abo_timer = ABO_TIMEOUT; |
} |
}//if (rxd_buffer_locked) |
if (!timer) |
{ |
OSD_Timeout(flag); |
flag = 0; |
error = 1; |
} |
} //end do |
while (!get_key_press (1 << KEY_ENTER) || !receiveNMEA==true || error ==1); |
// while (!get_key_press (1 << KEY_ENTER)); |
lcd_cls_line(0,1,21); |
lcd_cls_line(0,2,21); |
lcd_cls_line(0,3,21); |
lcd_cls_line(0,4,21); |
lcd_cls_line(0,5,21); |
lcd_cls_line(0,6,21); |
if (!receiveNMEA) lcd_printp_at (0, 2, PSTR("lost BT data"), 0); |
// if (error ==1) lcd_printp_at (0, 2, PSTR("lost Wi.232 data"), 0); |
lcd_printp_at (0, 3, PSTR("GPS trennen"), 0); |
} |
else |
{ |
lcd_printp_at (0, 4, PSTR("Error at connecting"), 0); |
lcd_printp_at (0, 5, PSTR("switch on BT Mouse!!"), 0); |
while (!get_key_press (1 << KEY_ENTER)); |
} |
receiveNMEA = false; |
if (!bt_disconnect()) lcd_printp_at (0, 3, PSTR("Fehler beim Trennen"), 0); |
set_BTOff(); |
return true; |
} |
} |
//******************************************************************************************************* |
uint8_t PKT_trackingMK(void) // Tracking mit GPS-Daten vom Mikrokopter |
{ |
// uint8_t BT_WhasOn = 0; |
// uint8_t BT_status; |
uint8_t GPSfix=0; |
uint8_t tmp_dat; |
uint8_t toggletimer=0; |
coldstart = true; |
lcd_printp_at (0, 2, PSTR("S Latitude Longitude"), 2); |
lcd_cls_line (0,1,20); |
// lcd_printp_at (0, 3, PSTR("H"), 0); |
// lcd_printp_at (0, 4, PSTR("M"), 0); |
SwitchToNC(); |
mode = 'O'; |
// disable debug... |
// RS232_request_mk_data (0, 'd', 0); |
tmp_dat = 0; |
SendOutData ('d', ADDRESS_ANY, 1, &tmp_dat, 1); |
// request OSD Data from NC every 100ms |
// RS232_request_mk_data (1, 'o', 100); |
tmp_dat = 10; |
SendOutData ('o', ADDRESS_NC, 1, &tmp_dat, 1); |
timer = TIMEOUT; |
abo_timer = ABO_TIMEOUT; |
error = 0; |
do |
{ |
if (rxd_buffer_locked) |
{ |
timer = TIMEOUT; |
Decode64 (); |
naviData = (NaviData_t *) pRxData; |
//OSD_Screen_Element (18, 1, OSD_SATS_IN_USE,1); |
//if (GPSfix == true) OSD_Screen_Element (0, 1, OSD_STATUS_FLAGS,1); |
OSD_Element_SatsInUse( 18, 1, 1); |
if (GPSfix == true) OSD_Element_StatusFlags( 0, 1); |
if (!(naviData->NCFlags & NC_FLAG_GPS_OK)) |
{ |
toggletimer++; |
if (toggletimer == 50) toggletimer = 0; |
if (toggletimer == 25) lcd_printp_at(0,1, PSTR("Whait for GPS Fix "), 2); |
if (toggletimer == 1) lcd_printp_at(0,1, PSTR("Whait for GPS Fix "), 0); |
rxd_buffer_locked = false; |
GPSfix = false; |
} |
else GPSfix = true; |
if (GPSfix) |
{ |
if (coldstart) |
{ |
// erst nach Neustart NGVideo und beim Motorstart werden Daten vom MK übernommen |
if (naviData->FCStatusFlags & FC_FLAG_MOTOR_START) { |
MK_pos.Home_Lon = naviData->HomePosition.Longitude; |
MK_pos.Home_Lat = naviData->HomePosition.Latitude; |
MK_pos.Home_Alt = naviData->HomePosition.Altitude; |
MK_pos.direction = naviData->CompassHeading; |
coldstart = false; |
rxd_buffer_locked = false; |
lcd_printp_at(0,1, PSTR(" "), 0); |
} |
else |
{ |
lcd_printp_at(0,1, PSTR("GPS ok, start ok "), 0); |
rxd_buffer_locked = false; |
} |
} |
else |
{ //run |
currentPos = naviData->CurrentPosition; |
currentPos.Altitude = MK_pos.Home_Alt + (4000 * (int32_t)(naviData->Altimeter) / AltFaktor + currentPos.Altitude - MK_pos.Home_Alt) / 5; |
do_tracking(); |
// lcd_puts_at (13, 0, NMEAtime, 2); |
// lcd_printp_at (16, 1, PSTR("Sat:"), 0); |
// write_ndigit_number_u (19, 1, NMEAsatsInUse, 2, 1,0); |
// lcd_printp_at (0, 1, PSTR("Fix:"), 0); |
// write_ndigit_number_u (4, 1, posfix, 1, 1,0); |
// lcd_printp_at (6, 1, PSTR("HDOP:"), 0); |
// write_ndigit_number_u_10th (11, 1, HDOP, 3, 0,0); |
rxd_buffer_locked = FALSE; |
} // run |
} |
if (!abo_timer) |
{ // renew abo every 3 sec |
// request OSD Data from NC every 100ms |
// RS232_request_mk_data (1, 'o', 100); |
tmp_dat = 10; |
SendOutData ('o', ADDRESS_NC, 1, &tmp_dat, 1); |
abo_timer = ABO_TIMEOUT; |
} |
} //rx_buffer_locked |
if (!timer) |
{ |
OSD_Timeout(1); |
error = 1; |
} |
} //end do |
while ((!get_key_press (1 << KEY_ENTER)) && (error ==0)); |
lcd_cls_line(0,1,21); |
lcd_cls_line(0,2,21); |
lcd_cls_line(0,3,21); |
lcd_cls_line(0,4,21); |
lcd_cls_line(0,5,21); |
lcd_cls_line(0,6,21); |
if (error ==1) |
{ |
lcd_printp_at (0, 2, PSTR("lost Wi.232 data"), 0); |
_delay_ms(2000); |
} |
return true; |
} |
//******************************************************************************************************* |
void PKT_tracking(void) |
{ |
get_key_press(KEY_ALL); |
lcd_cls (); |
if (Config.gps_UsedGPSMouse==GPS_Bluetoothmouse1) lcd_printp_at(0,0, PSTR("Tracking Bluetooth "), 2); |
if (Config.gps_UsedGPSMouse==GPS_Mikrokopter) lcd_printp_at(0,0, PSTR(" Tracking Mikrokopter"), 2); |
lcd_printp_at (16, 7, PSTR("Ende"), 0); |
if (Config.gps_UsedGPSMouse==GPS_Bluetoothmouse1) PKT_trackingBT(); |
if (Config.gps_UsedGPSMouse==GPS_Mikrokopter) PKT_trackingMK(); |
get_key_press(KEY_ALL); |
} |
//// Trying to avoid floating point maths here. Converts a floating point string to an integer with a smaller unit |
//// i.e. floatStrToInt("4.5", 2) = 4.5 * 1E2 = 450 |
//int32_t floatStrToInt(const char *s, int32_t power1) |
//{ char *endPtr; |
// int32_t v = strtol(s, &endPtr, 10); |
// |
// if (*endPtr == '.') { |
// for (s = endPtr + 1; *s && power1; s++) { |
// v = v * 10 + (*s - '0'); |
// --power1; |
// } |
// } |
// if (power1) { |
// // Table to avoid multiple multiplications |
// v = v * getPower(power1); |
// } |
// return v; |
//} |
// NMEA latitudes are in the form ddmm.mmmmm, we want an integer in 1E-7 degree steps |
int32_t getLatitude(const char *s, const char *NS) |
{ int32_t deg = (s[0] - '0') * 10 + s[1] - '0'; // First 2 chars are full degrees |
int32_t min = floatStrToInt(&s[2], 6) / 6; // Minutes * 1E5 * 100 / 60 = Minutes * 1E6 / 6 = 1E-7 degree steps |
deg = deg * 10000000 + min; |
if (*NS == 'S') deg = -deg; |
return deg; |
} |
// NMEA longitudes are in the form dddmm.mmmmm, we want an integer in 1E-7 degree steps |
int32_t getLongitude(const char *s, const char *WE) |
{ int32_t deg = ((s[0] - '0') * 10 + s[1] - '0') * 10 + s[2] - '0'; // First 3 chars are full degrees |
int32_t min = floatStrToInt(&s[3], 6) / 6; // Minutes * 1E5 * 100 / 60 = Minutes * 1E6 / 6 = 1E-7 degree steps |
deg = deg * 10000000 + min; |
if (*WE == 'W') deg = -deg; |
return deg; |
} |
void getNMEATime( const char *s) |
{ |
uint8_t sem = 0; |
uint8_t i; |
for ( i=0;i < 6; i++ ) |
{ |
NMEAtime[sem++] = s[i]; |
if (i==1 || i==3) NMEAtime[sem++] = ':'; |
} |
NMEAtime[sem] = '\0'; |
} |
//$GPGGA,191410.000,4735.5634,N,00739.3538,E,1,04,4.4,351.5,M,48.0,M,,*45 |
// ^ ^ ^ ^ ^ ^ ^ ^ |
// | | | | | | | | |
// | | | | | | | Höhe Geoid minus |
// | | | | | | | Höhe Ellipsoid (WGS84) |
// | | | | | | | in Metern (48.0,M) |
// | | | | | | | |
// | | | | | | Höhe über Meer (über Geoid)in Metern (351.5,M) |
// | | | | | | |
// | | | | | HDOP (horizontal dilution |
// | | | | | of precision) Genauigkeit |
// | | | | | |
// | | | | Anzahl der erfassten Satelliten |
// | | | | |
// | | | Qualität der Messung |
// | | | (0 = ungültig) |
// | | | (1 = GPS) |
// | | | (2 = DGPS) |
// | | | (6 = geschätzt nur NMEA-0183 2.3) |
// | | | |
// | | Längengrad |
// | | |
// | Breitengrad |
// | |
// Uhrzeit |
void Tracking_NMEA(void) |
{ |
char *token; |
if (decodeNMEA()) { |
token = strtok((char*)data_decode, ","); |
if (!strcmp(token, "GPGGA")) |
{ |
// $GPGGA,220613.400,4843.5080,N,00922.9583,E,1,7,2.23,287.1,M,48.0,M,, |
// Time |
getNMEATime(strtok(0, ".")); //Zeit |
strtok(0, ","); // Skip Rest von der Zeit |
// Latitude |
NMEAlatitude = getLatitude(strtok(0, ","), strtok(0, ",")); //N |
// Longitude |
NMEAlongitude = getLongitude(strtok(0, ","), strtok(0, ","));//E |
// Signal valid? (Position Fix Indicator) |
posfix = atoi(strtok(0, ",")); // Qualität |
// Satellites in use |
NMEAsatsInUse = atoi(strtok(0, ",")); //Anzahl Sats |
// Dilition, best = 0.0 |
HDOP = floatStrToInt(strtok(0, ","),1); //Dilution |
// // Altitude |
NMEAaltitude = floatStrToInt(strtok(0, ","), 1); |
// currentPos.Altitude = altitude; |
// currentPos.Latitude = latitude; |
// currentPos.Longitude = longitude; |
//TODO: erstmal test if ((coldstart) && (satsInUse > 5)) { |
// First position after reboot (or change of mode) will be the home position (facing north) |
MK_pos.Home_Lon = NMEAlongitude; |
MK_pos.Home_Lat = NMEAlatitude; |
MK_pos.Home_Alt = NMEAaltitude; |
MK_pos.direction = 0; |
// coldstart = 0; |
// Double_Beep(DBEEPNMEAFIX, DBEEPMEAFIXP); |
do_tracking(); |
// } |
} |
} |
// Displ_GPS(); // letzte empfangene Daten auch bei ausgeschalteter NMEA sichtbar |
} |
uint8_t hexDigitToInt(uint8_t digit) |
{ |
if (digit >= '0' && digit <= '9') return digit - '0'; |
if (digit >= 'a' && digit <= 'f') return digit - 'a' + 10; |
if (digit >= 'A' && digit <= 'F') return digit - 'A' + 10; |
return 0; |
} |
uint8_t decodeNMEA(void) |
{ |
uint8_t ret = 0; |
uint8_t crc; |
uint8_t tmpCRC = 0; |
uint8_t i; |
if (bt_rx_ready == 1 && bt_rx_len > 0) { |
// Calculate checksum |
for (i = 1; i < bt_rx_len && bt_rx_buffer[i] != '*'; i++) { |
tmpCRC ^= bt_rx_buffer[i]; |
} |
if (bt_rx_len >= i + 3) { |
crc = hexDigitToInt(bt_rx_buffer[i + 1]) << 4 | hexDigitToInt(bt_rx_buffer[i + 2]); |
if (crc == tmpCRC) { |
bt_rx_buffer[i] = 0; |
strcpy(data_decode, &bt_rx_buffer[1]); // Data without $, crc |
ret = 1; |
// wi232RX = 1; // So antenna-symbol will blink |
// cli(); |
// rx_timeout = 0; // Got valid data, reset counter |
// sei(); |
} |
} |
} |
// if (rx_timeout < RX_TIME_OLD) wi232RX = 1; |
bt_rx_ready = 0; // Unlock buffer, next NMEA string can be received |
return ret; |
} |
#endif |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/tracking/tracking.h |
---|
0,0 → 1,67 |
/* |
* tracking.h |
* |
* Created on: 13.02.2012 |
* Author: cebra |
*/ |
#ifndef TRACKING_H_ |
#define TRACKING_H_ |
#define REPEAT 1 |
#define REPEAT_MIN 1 |
#define REPEAT_MAX 100 |
#define PAUSE 10 |
#define PAUSE_MIN 4 // mindestens 400ms, da mechanischer Servo-Lauf zur Position berücksichtigt werden muss |
#define PAUSE_MAX 20 // Pause pro Links-, Mittel- und Rechtsposition 10*100ms |
#define PAUSE_STEP 0 |
#define PAUSE_STEP_MIN 0 // Pause bei jeden Servoschritt in ms |
#define PAUSE_STEP_MAX 200 |
/* Antennen-Nachführung */ |
#define TRACKING_MIN 0 // aus, TRACKING_RSSI, TRACKING_GPS, TRACKING_MKCOCKPIT, TRACKING_NMEA |
#define TRACKING_MAX 4 |
/* Antennen-Nachführung per RSSI */ |
#define TRACKING_HYSTERESE 40 // Hysterese bevor Tracking bei Richtungswechsel anspricht |
#define TRACKING_HYST_MIN 0 |
#define TRACKING_HYST_MAX 100 |
#define FC_FLAG_MOTOR_RUN 0x01 |
#define FC_FLAG_FLY 0x02 |
#define FC_FLAG_CALIBRATE 0x04 |
#define FC_FLAG_MOTOR_START 0x08 |
//#define NC_FLAG_GPS_OK 0 |
typedef struct { |
int32_t distance; |
int16_t bearing; |
}geo_t; |
typedef struct { |
int32_t Home_Lon; // in 1E-7 degrees |
int32_t Home_Lat; // in 1E-7 degrees |
int32_t Home_Alt; // in mm |
int16_t direction; // ermittelte Konstante aus Mittelposition Antenne geo.bearing - navi_data.CompassHeading |
}__attribute__((packed)) HomePos_t; |
extern uint8_t NMEAsatsInUse; // Number of satelites currently in use |
extern int32_t NMEAlatitude, NMEAlongitude; |
extern uint8_t posfix; // GPS Fix, 0 = Fix not available or invalid,1 = GPS SPS Mode, fix valid, |
// 2 = Differential GPS, SPS Mode, fix valid, 6 = Dead Reckoning Mode, fix valid |
extern int16_t HDOP; // Horizontal Dilution of Precision, 1.1 -xx.x, niederiger = besser |
extern int16_t NMEAaltitude; // Höhe in Meter |
extern char NMEAtime[9]; |
extern uint8_t coldstart; // Flag erstmaliger MK-Start(Motore) nur nach GPS-Fix |
void Tracking_NMEA(void); |
uint8_t decodeNMEA(void); |
void PKT_tracking(void); |
#endif /* TRACKING_H_ */ |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/uart/.directory |
---|
0,0 → 1,3 |
[Dolphin] |
Timestamp=2013,2,17,15,38,3 |
ViewMode=1 |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/uart/uart1.c |
---|
0,0 → 1,371 |
/************************************************************************* |
Title: Interrupt UART library with receive/transmit circular buffers |
Author: Peter Fleury <pfleury@gmx.ch> http://jump.to/fleury |
File: $Id: uart.c,v 1.6.2.2 2009/11/29 08:56:12 Peter Exp $ |
Software: AVR-GCC 4.1, AVR Libc 1.4.6 or higher |
Hardware: any AVR with built-in UART, |
License: GNU General Public License |
DESCRIPTION: |
An interrupt is generated when the UART has finished transmitting or |
receiving a byte. The interrupt handling routines use circular buffers |
for buffering received and transmitted data. |
The UART_RX_BUFFER_SIZE and UART_TX_BUFFER_SIZE variables define |
the buffer size in bytes. Note that these variables must be a |
power of 2. |
USAGE: |
Refere to the header file uart.h for a description of the routines. |
See also example test_uart.c. |
NOTES: |
Based on Atmel Application Note AVR306 |
LICENSE: |
Copyright (C) 2006 Peter Fleury |
This program is free software; you can redistribute it and/or modify |
it under the terms of the GNU General Public License as published by |
the Free Software Foundation; either version 2 of the License, or |
any later version. |
This program is distributed in the hope that it will be useful, |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
GNU General Public License for more details. |
*************************************************************************/ |
#include <avr/io.h> |
#include <avr/interrupt.h> |
#include <avr/pgmspace.h> |
#include <string.h> |
#include <stdbool.h> |
#include "uart1.h" |
#include "../main.h" |
#include "../bluetooth/bluetooth.h" |
#include "../tracking/tracking.h" |
// |
// constants and macros |
// |
#if defined HWVERSION1_3W || defined HWVERSION3_9 |
// size of RX/TX buffers |
#define UART_RX_BUFFER_MASK ( UART_RX_BUFFER_SIZE - 1) |
#define UART_TX_BUFFER_MASK ( UART_TX_BUFFER_SIZE - 1) |
#if ( UART_RX_BUFFER_SIZE & UART_RX_BUFFER_MASK ) |
#error RX buffer size is not a power of 2 |
#endif |
#if ( UART_TX_BUFFER_SIZE & UART_TX_BUFFER_MASK ) |
#error TX buffer size is not a power of 2 |
#endif |
// ATmega with two USART |
#define ATMEGA_USART1 |
#define UART1_STATUS UCSR1A |
#define UART1_CONTROL UCSR1B |
#define UART1_DATA UDR1 |
#define UART1_UDRIE UDRIE1 |
// |
// module global variables |
// |
uint8_t receiveNMEA = false; |
#if defined( ATMEGA_USART1 ) |
static volatile unsigned char UART1_TxBuf[UART_TX_BUFFER_SIZE]; |
static volatile unsigned char UART1_RxBuf[UART_RX_BUFFER_SIZE]; |
static volatile unsigned char UART1_TxHead; |
static volatile unsigned char UART1_TxTail; |
static volatile unsigned char UART1_RxHead; |
static volatile unsigned char UART1_RxTail; |
static volatile unsigned char UART1_LastRxError; |
volatile uint16_t UART1_RxError; |
#endif |
void SetBaudUart1(uint8_t Baudrate) |
{ |
switch (Baudrate) |
{ |
case Baud_2400: uart1_init( UART_BAUD_SELECT(2400,F_CPU) ); break; |
case Baud_4800: uart1_init( UART_BAUD_SELECT(4800,F_CPU) ); break; |
// case Baud_9600: uart1_init( UART_BAUD_SELECT(9600,F_CPU) ); break; |
case Baud_9600: uart1_init( 129); break; |
case Baud_19200: uart1_init( UART_BAUD_SELECT(19200,F_CPU) ); break; |
case Baud_38400: uart1_init( UART_BAUD_SELECT(38400,F_CPU) ); break; |
case Baud_57600: uart1_init( UART_BAUD_SELECT(57600,F_CPU) ); break; |
// case Baud_57600: uart1_init( 21); break; |
// case Baud_115200: uart1_init( UART_BAUD_SELECT(115200,F_CPU) ); break; |
case Baud_115200: uart1_init( 10 ); break; |
} |
} |
// |
// these functions are only for ATmegas with two USART |
// |
#if defined( ATMEGA_USART1 ) |
//-------------------------------------------------------------- |
// Function: UART1 Receive Complete interrupt |
// Purpose: called when the UART1 has received a character |
//-------------------------------------------------------------- |
ISR(USART1_RX_vect) |
{ |
unsigned char tmphead; |
unsigned char data; |
unsigned char usr; |
unsigned char lastRxError; |
// read UART status register and UART data register |
usr = UART1_STATUS; |
data = UART1_DATA; |
lastRxError = (usr & (_BV(FE1)|_BV(DOR1)) ); |
// calculate buffer index |
tmphead = ( UART1_RxHead + 1) & UART_RX_BUFFER_MASK; |
if ( tmphead == UART1_RxTail ) |
{ |
// error: receive buffer overflow |
lastRxError = UART_BUFFER_OVERFLOW >> 8; |
UART1_RxError++; |
} |
else |
{ |
// store new index |
UART1_RxHead = tmphead; |
// store received data in buffer |
UART1_RxBuf[tmphead] = data; |
} |
UART1_LastRxError = lastRxError; |
// if (receiveNMEA==true) |
// { |
// if (bt_receiveNMEA()) Tracking_NMEA(); |
// else receiveNMEA = false; |
// |
// } |
} |
//-------------------------------------------------------------- |
// Function: UART1 Data Register Empty interrupt |
// Purpose: called when the UART1 is ready to transmit the next byte |
//-------------------------------------------------------------- |
ISR(USART1_UDRE_vect) |
{ |
unsigned char tmptail; |
if ( UART1_TxHead != UART1_TxTail) |
{ |
// calculate and store new buffer index |
tmptail = (UART1_TxTail + 1) & UART_TX_BUFFER_MASK; |
UART1_TxTail = tmptail; |
// get one byte from buffer and write it to UART |
UART1_DATA = UART1_TxBuf[tmptail]; // start transmission |
} |
else |
{ |
// tx buffer empty, disable UDRE interrupt |
UART1_CONTROL &= ~_BV(UART1_UDRIE); |
} |
} |
//-------------------------------------------------------------- |
// Function: uart1_init() |
// Purpose: initialize UART1 and set baudrate |
// Input: baudrate using macro UART_BAUD_SELECT() |
// Returns: none |
//-------------------------------------------------------------- |
void uart1_init(unsigned int baudrate) |
{ |
UART1_TxHead = 0; |
UART1_TxTail = 0; |
UART1_RxHead = 0; |
UART1_RxTail = 0; |
UART1_RxError = 0; |
// Set baud rate |
if ( baudrate & 0x8000 ) |
{ |
UART1_STATUS = (1<<U2X1); //Enable 2x speed |
baudrate &= ~0x8000; |
} |
UBRR1H = (unsigned char)(baudrate>>8); |
UBRR1L = (unsigned char) baudrate; |
// Enable USART receiver and transmitter and receive complete interrupt |
UART1_CONTROL = _BV(RXCIE1)|(1<<RXEN1)|(1<<TXEN1); |
// Set frame format: asynchronous, 8data, no parity, 1stop bit |
#ifdef URSEL1 |
UCSR1C = (1<<URSEL1)|(3<<UCSZ10); |
#else |
UCSR1C = (3<<UCSZ10); |
// UCSR1C = (1<<UCSZ11) | (1<<UCSZ10); // 8data Bit |
#endif |
} |
//-------------------------------------------------------------- |
// Function: uart1_getc() |
// Purpose: return byte from ringbuffer |
// Returns: lower byte: received byte from ringbuffer |
// higher byte: last receive error |
//-------------------------------------------------------------- |
unsigned int uart1_getc(void) |
{ |
unsigned char tmptail; |
unsigned char data; |
if ( UART1_RxHead == UART1_RxTail ) |
{ |
return UART_NO_DATA; // no data available |
} |
// calculate /store buffer index |
tmptail = (UART1_RxTail + 1) & UART_RX_BUFFER_MASK; |
UART1_RxTail = tmptail; |
// get data from receive buffer |
data = UART1_RxBuf[tmptail]; |
return (UART1_LastRxError << 8) + data; |
}/* uart1_getc */ |
//-------------------------------------------------------------- |
// Function: uart1_putc() |
// Purpose: write byte to ringbuffer for transmitting via UART |
// Input: byte to be transmitted |
// Returns: 1 on succes, 0 if remote not ready |
//-------------------------------------------------------------- |
int uart1_putc(unsigned char data) |
{ |
unsigned char tmphead; |
tmphead = (UART1_TxHead + 1) & UART_TX_BUFFER_MASK; |
while ( tmphead == UART1_TxTail ) |
{;} // wait for free space in buffer |
UART1_TxBuf[tmphead] = data; |
UART1_TxHead = tmphead; |
// enable UDRE interrupt |
UART1_CONTROL |= _BV(UART1_UDRIE); |
return (UART1_LastRxError << 8) + data; |
} |
//-------------------------------------------------------------- |
// Function: uart1_puts() |
// Purpose: transmit string to UART1 |
// Input: string to be transmitted |
// Returns: none |
//-------------------------------------------------------------- |
void uart1_puts(const char *s ) |
{ |
while (*s) |
uart1_putc(*s++); |
} |
//-------------------------------------------------------------- |
// Function: uart1_puts_p() |
// Purpose: transmit string from program memory to UART1 |
// Input: program memory string to be transmitted |
// Returns: none |
//-------------------------------------------------------------- |
void uart1_puts_p(const char *progmem_s ) |
{ |
register char c; |
while ( (c = pgm_read_byte(progmem_s++)) ) |
uart1_putc(c); |
} |
//-------------------------------------------------------------- |
// Function: uart1_available() |
// Purpose: Determine the number of bytes waiting in the receive buffer |
// Input: None |
// Returns: Integer number of bytes in the receive buffer |
//-------------------------------------------------------------- |
uint16_t uart1_available(void) |
{ |
return (UART_RX_BUFFER_MASK + UART1_RxHead - UART1_RxTail) % UART_RX_BUFFER_MASK; |
} |
//-------------------------------------------------------------- |
// Function: uart1_flush() |
// Purpose: Flush bytes waiting the receive buffer. Acutally ignores them. |
// Input: None |
// Returns: None |
//-------------------------------------------------------------- |
void uart1_flush(void) |
{ |
UART1_RxHead = UART1_RxTail; |
} |
/************************************************************************* |
Function: utoa() |
Purpose: convert unsigned integer to ascii |
Input: string_buffer, string_buffer_size, unsigned integer value |
Returns: first ascii character |
**************************************************************************/ |
char *utoa1(char* buffer, const unsigned int size, unsigned int value) |
{ |
char *p; |
// p points to last char |
p = buffer+size-1; |
// Set terminating Zero |
*p='\0'; |
do |
{ |
*--p = value%10 + '0'; |
value = value/10; |
} while (value!=0 && p>buffer); |
return p; |
}/* utoa */ |
#endif |
#endif |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/uart/uart1.h |
---|
0,0 → 1,175 |
/************************************************************************ |
Title: Interrupt UART library with receive/transmit circular buffers |
Author: Peter Fleury <pfleury@gmx.ch> http://jump.to/fleury |
File: $Id: uart.h,v 1.8.2.1 2007/07/01 11:14:38 peter Exp $ |
Software: AVR-GCC 4.1, AVR Libc 1.4 |
Hardware: any AVR with built-in UART, tested on AT90S8515 & ATmega8 at 4 Mhz |
License: GNU General Public License |
Usage: see Doxygen manual |
LICENSE: |
Copyright (C) 2006 Peter Fleury |
This program is free software; you can redistribute it and/or modify |
it under the terms of the GNU General Public License as published by |
the Free Software Foundation; either version 2 of the License, or |
any later version. |
This program is distributed in the hope that it will be useful, |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
GNU General Public License for more details. |
************************************************************************/ |
// |
// @defgroup pfleury_uart UART Library |
// @code #include <uart.h> @endcode |
// |
// @brief Interrupt UART library using the built-in UART with transmit and receive circular buffers. |
// |
// This library can be used to transmit and receive data through the built in UART. |
// |
// An interrupt is generated when the UART has finished transmitting or |
// receiving a byte. The interrupt handling routines use circular buffers |
// for buffering received and transmitted data. |
// |
// The UART_RX_BUFFER_SIZE and UART_TX_BUFFER_SIZE constants define |
// the size of the circular buffers in bytes. Note that these constants must be a power of 2. |
// You may need to adapt this constants to your target and your application by adding |
// CDEFS += -DUART_RX_BUFFER_SIZE=nn -DUART_RX_BUFFER_SIZE=nn to your Makefile. |
// |
// @note Based on Atmel Application Note AVR306 |
// @author Peter Fleury pfleury@gmx.ch http://jump.to/fleury |
// |
#ifndef UART_H |
#define UART_H |
#if (__GNUC__ * 100 + __GNUC_MINOR__) < 304 |
#error "This library requires AVR-GCC 3.4 or later, update to newer AVR-GCC compiler !" |
#endif |
// constants and macros |
// @brief UART Baudrate Expression |
// @param xtalcpu system clock in Mhz, e.g. 4000000L for 4Mhz |
// @param baudrate baudrate in bps, e.g. 1200, 2400, 9600 |
// |
#define UART_BAUD_SELECT(baudRate,xtalCpu) ((xtalCpu)/((baudRate)*16l)-1) |
// @brief UART Baudrate Expression for ATmega double speed mode |
// @param xtalcpu system clock in Mhz, e.g. 4000000L for 4Mhz |
// @param baudrate baudrate in bps, e.g. 1200, 2400, 9600 |
// |
#define UART_BAUD_SELECT_DOUBLE_SPEED(baudRate,xtalCpu) (((xtalCpu)/((baudRate)*8l)-1)|0x8000) |
// Size of the circular receive buffer, must be power of 2 |
#ifndef UART_RX_BUFFER_SIZE |
#define UART_RX_BUFFER_SIZE 1024 |
#endif |
// Size of the circular transmit buffer, must be power of 2 |
#ifndef UART_TX_BUFFER_SIZE |
#define UART_TX_BUFFER_SIZE 64 |
#endif |
// test if the size of the circular buffers fits into SRAM |
#if ( (UART_RX_BUFFER_SIZE+UART_TX_BUFFER_SIZE) >= (RAMEND-0x60 ) ) |
#error "size of UART_RX_BUFFER_SIZE + UART_TX_BUFFER_SIZE larger than size of SRAM" |
#endif |
//global variable |
extern uint8_t receiveNMEA; |
extern volatile uint16_t UART1_RxError; |
// high byte error return code of uart_getc() |
#define UART_FRAME_ERROR 0x0800 // Framing Error by UART |
#define UART_OVERRUN_ERROR 0x0400 // Overrun condition by UART |
#define UART_BUFFER_OVERFLOW 0x0200 // receive ringbuffer overflow |
#define UART_NO_DATA 0x0100 // no receive data available |
#define TRACKING_RSSI 1 |
#define TRACKING_GPS 2 |
#define TRACKING_MKCOCKPIT 3 |
#define TRACKING_NMEA 4 |
// |
// function prototypes |
// |
// |
// @brief Initialize UART and set baudrate |
// @param baudrate Specify baudrate using macro UART_BAUD_SELECT() |
// @return none |
// |
extern void uart_init(unsigned int baudrate); |
// |
// @brief Get received byte from ringbuffer |
// |
// Returns in the lower byte the received character and in the |
// higher byte the last receive error. |
// UART_NO_DATA is returned when no data is available. |
// |
// @param void |
// @return lower byte: received byte from ringbuffer |
// @return higher byte: last receive status |
// - \b 0 successfully received data from UART |
// - \b UART_NO_DATA |
// <br>no receive data available |
// - \b UART_BUFFER_OVERFLOW |
// <br>Receive ringbuffer overflow. |
// We are not reading the receive buffer fast enough, |
// one or more received character have been dropped |
// - \b UART_OVERRUN_ERROR |
// <br>Overrun condition by UART. |
// A character already present in the UART UDR register was |
// not read by the interrupt handler before the next character arrived, |
// one or more received characters have been dropped. |
// - \b UART_FRAME_ERROR |
// <br>Framing Error by UART |
// |
extern unsigned int uart_getc(void); |
// |
// @brief Put byte to ringbuffer for transmitting via UART |
// @param data byte to be transmitted |
// @return none |
// |
// @brief Set Baudrate USART1 |
extern void SetBaudUart1(uint8_t Baudrate); |
// @brief Initialize USART1 (only available on selected ATmegas) @see uart_init |
extern void uart1_init(unsigned int baudrate); |
// @brief Get received byte of USART1 from ringbuffer. (only available on selected ATmega) @see uart_getc |
extern unsigned int uart1_getc(void); |
// @brief Put byte to ringbuffer for transmitting via USART1 (only available on selected ATmega) @see uart_putc |
//extern void uart1_putc(unsigned char data); |
extern int uart1_putc(unsigned char data); |
// @brief Put string to ringbuffer for transmitting via USART1 (only available on selected ATmega) @see uart_puts |
extern void uart1_puts(const char *s ); |
// @brief Put string from program memory to ringbuffer for transmitting via USART1 (only available on selected ATmega) @see uart_puts_p |
extern void uart1_puts_p(const char *s ); |
// @brief Macro to automatically put a string constant into program memory |
#define uart1_puts_P(__s) uart1_puts_p(PSTR(__s)) |
extern char *utoa1(char* buffer, const unsigned int size, unsigned int value); |
extern uint16_t uart1_available(void); |
#endif // UART_H |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/uart/usart.c |
---|
0,0 → 1,688 |
/***************************************************************************** |
* Copyright (C) 2008 Thomas Kaiser, thomas@ft-fanpage.de * |
* Copyright (C) 2009 Peter "woggle" Mack, mac@denich.net * |
* Copyright (C) 2011 Christian "Cebra" Brandtner, brandtner@brandtner.net * |
* Copyright (C) 2011 Harald Bongartz * |
* * |
* This program is free software; you can redistribute it and/or modify * |
* it under the terms of the GNU General Public License as published by * |
* the Free Software Foundation; either version 2 of the License. * |
* * |
* This program is distributed in the hope that it will be useful, * |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
* GNU General Public License for more details. * |
* * |
* You should have received a copy of the GNU General Public License * |
* along with this program; if not, write to the * |
* Free Software Foundation, Inc., * |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
* * |
* * |
* Credits to: * |
* Holger Buss & Ingo Busker from mikrokopter.de for the MK project + SVN * |
* http://www.mikrokopter.de * |
* Gregor "killagreg" Stobrawa for his version of the MK code * |
* Thomas Kaiser "thkais" for the original project. See * |
* http://www.ft-fanpage.de/mikrokopter/ * |
* http://forum.mikrokopter.de/topic-4061-1.html * |
* Claas Anders "CaScAdE" Rathje for providing the font and his C-OSD code * |
* http://www.mylifesucks.de/oss/c-osd/ * |
* Harald Bongartz "HaraldB" for providing his Ideas and Code for usibility* |
*****************************************************************************/ |
#include <avr/io.h> |
#include <avr/interrupt.h> |
#include <avr/pgmspace.h> |
#include <avr/wdt.h> |
#include "../cpu.h" |
#include <util/delay.h> |
#include <stdarg.h> |
#include "../main.h" |
#include "usart.h" |
#include "../lcd/lcd.h" |
#include "../timer/timer.h" |
#include "uart1.h" |
#include "../eeprom/eeprom.h" |
#include "../osd/osd.h" |
uint8_t buffer[30]; |
volatile uint8_t txd_buffer[TXD_BUFFER_LEN]; |
volatile uint8_t txd_complete = TRUE; |
volatile uint8_t rxd_buffer[RXD_BUFFER_LEN]; |
volatile uint8_t rxd_buffer_locked = FALSE; |
volatile uint8_t ReceivedBytes = 0; |
volatile uint8_t *pRxData = 0; |
volatile uint8_t RxDataLen = 0; |
volatile uint16_t stat_crc_error = 0; |
volatile uint16_t stat_overflow_error = 0; |
volatile uint8_t rx_byte; |
volatile uint8_t rxFlag = 0; |
#define UART_RXBUFSIZE 64 |
#define UART_NO_DATA 0x0100 /* no receive data available */ |
volatile static uint8_t rxbuf[UART_RXBUFSIZE]; |
volatile static uint8_t *volatile rxhead, *volatile rxtail; |
/* |
//----------------------------------------------------------------------------- |
// USART1 transmitter ISR |
ISR (USART1_TX_vect) |
{ |
static uint16_t ptr_txd1_buffer = 0; |
uint8_t tmp_tx1; |
if(!txd1_complete) // transmission not completed |
{ |
ptr_txd1_buffer++; // [0] was already sent |
tmp_tx1 = txd1_buffer[ptr_txd1_buffer]; |
// if terminating character or end of txd buffer was reached |
if((tmp_tx1 == '\r') || (ptr_txd1_buffer == TXD_BUFFER_LEN)) |
{ |
ptr_txd1_buffer = 0; // reset txd pointer |
txd1_complete = TRUE; // stop transmission |
} |
UDR1 = tmp_tx1; // send current byte will trigger this ISR again |
} |
// transmission completed |
else ptr_txd1_buffer = 0; |
} |
*/ |
#ifdef USART_INT |
//----------------------------------------------------------------------------- |
// USART0 transmitter ISR |
ISR (USART_TX_vect) |
{ |
static uint16_t ptr_txd_buffer = 0; |
uint8_t tmp_tx; |
if(!txd_complete) // transmission not completed |
{ |
ptr_txd_buffer++; // [0] was already sent |
tmp_tx = txd_buffer[ptr_txd_buffer]; |
// if terminating character or end of txd buffer was reached |
if((tmp_tx == '\r') || (ptr_txd_buffer == TXD_BUFFER_LEN)) |
{ |
ptr_txd_buffer = 0; // reset txd pointer |
txd_complete = TRUE; // stop transmission |
} |
UDR = tmp_tx; // send current byte will trigger this ISR again |
} |
// transmission completed |
else ptr_txd_buffer = 0; |
} |
#endif |
void SetBaudUart0(uint8_t Baudrate) |
{ |
switch (Baudrate) |
{ |
case Baud_2400: USART_Init( UART_BAUD_SELECT(2400,F_CPU) ); break; |
case Baud_4800: USART_Init( UART_BAUD_SELECT(4800,F_CPU) ); break; |
case Baud_9600: USART_Init( UART_BAUD_SELECT(9600,F_CPU) ); break; |
case Baud_19200: USART_Init( UART_BAUD_SELECT(19200,F_CPU) ); break; |
case Baud_38400: USART_Init( UART_BAUD_SELECT(38400,F_CPU) ); break; |
case Baud_57600: USART_Init( UART_BAUD_SELECT(57600,F_CPU) ); break; |
// case Baud_115200: USART_Init( UART_BAUD_SELECT(115200,F_CPU) ); break; |
// Macro erechnet falschen Wert (9,85 = 9) für 115200 Baud mit 20Mhz Quarz, zu grosse Abweichung |
//#warning "Baurate prüfen wenn kein 20 Mhz Quarz verwendet wird" |
case Baud_115200: USART_Init( 10 ); break; |
} |
} |
//----------------------------------------------------------------------------- |
// |
// |
//uint8_t uart_getc_nb(uint8_t *c) |
//{ |
// if (rxhead==rxtail) return 0; |
// *c = *rxtail; |
// if (++rxtail == (rxbuf + UART_RXBUFSIZE)) rxtail = rxbuf; |
// return 1; |
//} |
ISR (USART0_RX_vect) |
{ |
static uint16_t crc; |
static uint8_t ptr_rxd_buffer = 0; |
uint8_t crc1, crc2; |
uint8_t c; |
// IdleTimer = 0; |
if (current_hardware == Wi232) |
{ |
// rx_byte = c; |
// rxFlag = 1; |
int diff; |
uint8_t c; |
c=UDR; |
diff = rxhead - rxtail; |
if (diff < 0) diff += UART_RXBUFSIZE; |
if (diff < UART_RXBUFSIZE -1) |
{ |
*rxhead = c; |
++rxhead; |
if (rxhead == (rxbuf + UART_RXBUFSIZE)) rxhead = rxbuf; |
}; |
// USART_putc (c); |
return; |
} |
if (current_hardware == MKGPS) |
{ |
// rx_byte = c; |
// rxFlag = 1; |
int diff; |
uint8_t c; |
c=UDR; |
diff = rxhead - rxtail; |
if (diff < 0) diff += UART_RXBUFSIZE; |
if (diff < UART_RXBUFSIZE -1) |
{ |
*rxhead = c; |
++rxhead; |
if (rxhead == (rxbuf + UART_RXBUFSIZE)) rxhead = rxbuf; |
}; |
return; |
} |
c = UDR; // catch the received byte |
if (OSD_active && Config.OSD_SendOSD) // Daten an SV2 senden |
uart1_putc(c); |
if (rxd_buffer_locked) |
return; // if rxd buffer is locked immediately return |
// the rxd buffer is unlocked |
if ((ptr_rxd_buffer == 0) && (c == '#')) // if rxd buffer is empty and syncronisation character is received |
{ |
rxd_buffer[ptr_rxd_buffer++] = c; // copy 1st byte to buffer |
crc = c; // init crc |
} |
else if (ptr_rxd_buffer < RXD_BUFFER_LEN) // collect incomming bytes |
{ |
if(c != '\r') // no termination character |
{ |
rxd_buffer[ptr_rxd_buffer++] = c; // copy byte to rxd buffer |
crc += c; // update crc |
} |
else // termination character was received |
{ |
// the last 2 bytes are no subject for checksum calculation |
// they are the checksum itself |
crc -= rxd_buffer[ptr_rxd_buffer-2]; |
crc -= rxd_buffer[ptr_rxd_buffer-1]; |
// calculate checksum from transmitted data |
crc %= 4096; |
crc1 = '=' + crc / 64; |
crc2 = '=' + crc % 64; |
// compare checksum to transmitted checksum bytes |
if((crc1 == rxd_buffer[ptr_rxd_buffer-2]) && (crc2 == rxd_buffer[ptr_rxd_buffer-1])) |
{ // checksum valid |
rxd_buffer[ptr_rxd_buffer] = '\r'; // set termination character |
ReceivedBytes = ptr_rxd_buffer + 1;// store number of received bytes |
if (mode == rxd_buffer[2]) |
{ |
rxd_buffer_locked = TRUE; // lock the rxd buffer |
// if 2nd byte is an 'R' enable watchdog that will result in an reset |
if(rxd_buffer[2] == 'R') {wdt_enable(WDTO_250MS);} // Reset-Commando |
} |
} |
else |
{ // checksum invalid |
stat_crc_error++; |
rxd_buffer_locked = FALSE; // unlock rxd buffer |
} |
ptr_rxd_buffer = 0; // reset rxd buffer pointer |
} |
} |
else // rxd buffer overrun |
{ |
stat_overflow_error++; |
ptr_rxd_buffer = 0; // reset rxd buffer |
rxd_buffer_locked = FALSE; // unlock rxd buffer |
} |
} |
//----------------------------------------------------------------------------- |
// Function: uart0_getc() |
// Purpose: return byte from ringbuffer |
// Returns: lower byte: received byte from ringbuffer |
// higher byte: last receive error |
//----------------------------------------------------------------------------- |
char USART_getc(void) |
{ |
char val; |
// while(rxhead==rxtail) ; |
if (rxhead==rxtail) |
return val=0; |
// IdleTimer = 0; |
val = *rxtail; |
if (++rxtail == (rxbuf + UART_RXBUFSIZE)) |
rxtail = rxbuf; |
return val; |
} |
uint8_t uart_getc_nb(uint8_t *c) |
{ |
if (rxhead==rxtail) |
return 0; |
// IdleTimer = 0; |
*c = *rxtail; |
if (++rxtail == (rxbuf + UART_RXBUFSIZE)) |
rxtail = rxbuf; |
return 1; |
} |
//----------------------------------------------------------------------------- |
// |
//----------------------------------------------------------------------------- |
// |
void USART_Init (unsigned int baudrate) |
{ |
// set clock divider |
// #undef BAUD |
// #define BAUD baudrate |
// #include <util/setbaud.h> |
// UBRRH = UBRRH_VALUE; |
// UBRRL = UBRRL_VALUE; |
//#ifndef F_CPU |
///* In neueren Version der WinAVR/Mfile Makefile-Vorlage kann |
// F_CPU im Makefile definiert werden, eine nochmalige Definition |
// hier wuerde zu einer Compilerwarnung fuehren. Daher "Schutz" durch |
// #ifndef/#endif |
// |
// Dieser "Schutz" kann zu Debugsessions führen, wenn AVRStudio |
// verwendet wird und dort eine andere, nicht zur Hardware passende |
// Taktrate eingestellt ist: Dann wird die folgende Definition |
// nicht verwendet, sondern stattdessen der Defaultwert (8 MHz?) |
// von AVRStudio - daher Ausgabe einer Warnung falls F_CPU |
// noch nicht definiert: */ |
//#warning "F_CPU war noch nicht definiert, wird nun nachgeholt mit 4000000" |
//#define F_CPU 18432000UL // Systemtakt in Hz - Definition als unsigned long beachten |
// Ohne ergeben sich unten Fehler in der Berechnung |
//#endif |
//#define BAUD 115200UL // Baudrate |
// |
//// Berechnungen |
//#define UBRR_VAL ((F_CPU+BAUD*8)/(BAUD*16)-1) // clever runden |
//#define BAUD_REAL (F_CPU/(16*(UBRR_VAL+1))) // Reale Baudrate |
//#define BAUD_ERROR ((BAUD_REAL*1000)/BAUD) // Fehler in Promille, 1000 = kein Fehler. |
// |
// |
//#if ((BAUD_ERROR<990) || (BAUD_ERROR>1010)) |
// #error "Systematischer Fehler der Baudrate grösser 1% und damit zu hoch!" |
//#endif |
UBRRH = (unsigned char)(baudrate>>8); |
UBRRL = (unsigned char) baudrate; |
// UBRRH = (unsigned char)(BAUD_REAL>>8); |
// UBRRL = (unsigned char) BAUD_REAL; |
#if USE_2X |
UCSRA |= (1 << U2X); // enable double speed operation |
#else |
UCSRA &= ~(1 << U2X); // disable double speed operation |
#endif |
// set 8N1 |
#if defined (__AVR_ATmega8__) || defined (__AVR_ATmega32__) |
UCSRC = (1 << URSEL) | (1 << UCSZ1) | (1 << UCSZ0); |
#else |
UCSRC = (1 << UCSZ1) | (1 << UCSZ0); |
#endif |
UCSRB &= ~(1 << UCSZ2); |
// flush receive buffer |
while ( UCSRA & (1 << RXC) ) UDR; |
UCSRB |= (1 << RXEN) | (1 << TXEN); |
#ifdef USART_INT |
UCSRB |= (1 << RXCIE) | (1 << TXCIE); |
#else |
UCSRB |= (1 << RXCIE); |
#endif |
rxhead = rxtail = rxbuf; |
} |
//----------------------------------------------------------------------------- |
// disable the txd pin of usart |
void USART_DisableTXD (void) |
{ |
#ifdef USART_INT |
UCSRB &= ~(1 << TXCIE); // disable TX-Interrupt |
#endif |
UCSRB &= ~(1 << TXEN); // disable TX in USART |
DDRB &= ~(1 << DDB3); // set TXD pin as input |
PORTB &= ~(1 << PORTB3); // disable pullup on TXD pin |
} |
//----------------------------------------------------------------------------- |
// enable the txd pin of usart |
void USART_EnableTXD (void) |
{ |
DDRB |= (1 << DDB3); // set TXD pin as output |
PORTB &= ~(1 << PORTB3); // disable pullup on TXD pin |
UCSRB |= (1 << TXEN); // enable TX in USART |
#ifdef USART_INT |
UCSRB |= (1 << TXCIE); // enable TX-Interrupt |
#endif |
} |
//----------------------------------------------------------------------------- |
// short script to directly send a request thorugh usart including en- and disabling it |
// where <address> is the address of the receipient, <label> is which data set to request |
// and <ms> represents the milliseconds delay between data |
void USART_request_mk_data (uint8_t cmd, uint8_t addr, uint8_t ms) |
{ |
USART_EnableTXD (); // re-enable TXD pin |
unsigned char mstenth = ms/10; |
SendOutData(cmd, addr, 1, &mstenth, 1); |
// wait until command transmitted |
while (txd_complete == FALSE); |
USART_DisableTXD (); // disable TXD pin again |
} |
//----------------------------------------------------------------------------- |
// |
void USART_putc (char c) |
{ |
#ifdef USART_INT |
#else |
loop_until_bit_is_set(UCSRA, UDRE); |
UDR = c; |
#endif |
} |
//----------------------------------------------------------------------------- |
// |
void USART_puts (char *s) |
{ |
#ifdef USART_INT |
#else |
while (*s) |
{ |
USART_putc (*s); |
s++; |
} |
#endif |
} |
//----------------------------------------------------------------------------- |
// |
void USART_puts_p (const char *s) |
{ |
#ifdef USART_INT |
#else |
while (pgm_read_byte(s)) |
{ |
USART_putc (pgm_read_byte(s)); |
s++; |
} |
#endif |
} |
//----------------------------------------------------------------------------- |
// |
void SendOutData(uint8_t cmd, uint8_t addr, uint8_t numofbuffers, ...) // uint8_t *pdata, uint8_t len, ... |
{ |
va_list ap; |
uint16_t pt = 0; |
uint8_t a,b,c; |
uint8_t ptr = 0; |
uint16_t tmpCRC = 0; |
uint8_t *pdata = 0; |
int len = 0; |
txd_buffer[pt++] = '#'; // Start character |
txd_buffer[pt++] = 'a' + addr; // Address (a=0; b=1,...) |
txd_buffer[pt++] = cmd; // Command |
va_start(ap, numofbuffers); |
if(numofbuffers) |
{ |
pdata = va_arg (ap, uint8_t*); |
len = va_arg (ap, int); |
ptr = 0; |
numofbuffers--; |
} |
while(len) |
{ |
if(len) |
{ |
a = pdata[ptr++]; |
len--; |
if((!len) && numofbuffers) |
{ |
pdata = va_arg(ap, uint8_t*); |
len = va_arg(ap, int); |
ptr = 0; |
numofbuffers--; |
} |
} |
else |
a = 0; |
if(len) |
{ |
b = pdata[ptr++]; |
len--; |
if((!len) && numofbuffers) |
{ |
pdata = va_arg(ap, uint8_t*); |
len = va_arg(ap, int); |
ptr = 0; |
numofbuffers--; |
} |
} |
else |
b = 0; |
if(len) |
{ |
c = pdata[ptr++]; |
len--; |
if((!len) && numofbuffers) |
{ |
pdata = va_arg(ap, uint8_t*); |
len = va_arg(ap, int); |
ptr = 0; |
numofbuffers--; |
} |
} |
else |
c = 0; |
txd_buffer[pt++] = '=' + (a >> 2); |
txd_buffer[pt++] = '=' + (((a & 0x03) << 4) | ((b & 0xf0) >> 4)); |
txd_buffer[pt++] = '=' + (((b & 0x0f) << 2) | ((c & 0xc0) >> 6)); |
txd_buffer[pt++] = '=' + ( c & 0x3f); |
} |
va_end(ap); |
for(a = 0; a < pt; a++) |
{ |
tmpCRC += txd_buffer[a]; |
} |
tmpCRC %= 4096; |
txd_buffer[pt++] = '=' + tmpCRC / 64; |
txd_buffer[pt++] = '=' + tmpCRC % 64; |
txd_buffer[pt++] = '\r'; |
txd_complete = FALSE; |
#ifdef USART_INT |
UDR = txd_buffer[0]; // initiates the transmittion (continued in the TXD ISR) |
#else |
for(a = 0; a < pt; a++) |
{ |
loop_until_bit_is_set(UCSRA, UDRE); |
UDR = txd_buffer[a]; |
} |
txd_complete = TRUE; |
#endif |
} |
//----------------------------------------------------------------------------- |
// |
void Decode64 (void) |
{ |
uint8_t a,b,c,d; |
uint8_t ptrIn = 3; |
uint8_t ptrOut = 3; |
uint8_t len = ReceivedBytes - 6; |
while (len) |
{ |
a = rxd_buffer[ptrIn++] - '='; |
b = rxd_buffer[ptrIn++] - '='; |
c = rxd_buffer[ptrIn++] - '='; |
d = rxd_buffer[ptrIn++] - '='; |
//if(ptrIn > ReceivedBytes - 3) break; |
if (len--) |
rxd_buffer[ptrOut++] = (a << 2) | (b >> 4); |
else |
break; |
if (len--) |
rxd_buffer[ptrOut++] = ((b & 0x0f) << 4) | (c >> 2); |
else |
break; |
if (len--) |
rxd_buffer[ptrOut++] = ((c & 0x03) << 6) | d; |
else |
break; |
} |
pRxData = &rxd_buffer[3]; |
RxDataLen = ptrOut - 3; |
} |
//----------------------------------------------------------------------------- |
// |
void SwitchToNC (void) |
{ |
if(hardware == NC) |
{ |
// switch to NC |
USART_putc (0x1b); |
USART_putc (0x1b); |
USART_putc (0x55); |
USART_putc (0xaa); |
USART_putc (0x00); |
current_hardware = NC; |
_delay_ms (50); |
} |
} |
//----------------------------------------------------------------------------- |
// |
//----------------------------------------------------------------------------- |
// |
void SwitchToWi232 (void) |
{ |
// if(hardware == NC) |
{ |
// switch to Wi232 |
current_hardware = Wi232; |
_delay_ms (50); |
} |
} |
//----------------------------------------------------------------------------- |
// |
void SwitchToFC (void) |
{ |
uint8_t cmd; |
if (current_hardware == NC) |
{ |
// switch to FC |
cmd = 0x00; // 0 = FC, 1 = MK3MAG, 2 = MKGPS |
SendOutData('u', ADDRESS_NC, 1, &cmd, 1); |
current_hardware = FC; |
_delay_ms (50); |
} |
} |
//----------------------------------------------------------------------------- |
// |
void SwitchToMAG (void) |
{ |
uint8_t cmd; |
if (current_hardware == NC) |
{ |
// switch to MK3MAG |
cmd = 0x01; // 0 = FC, 1 = MK3MAG, 2 = MKGPS |
SendOutData('u', ADDRESS_NC, 1, &cmd, 1); |
current_hardware = MK3MAG; |
_delay_ms (50); |
} |
} |
//----------------------------------------------------------------------------- |
// |
void SwitchToGPS (void) |
{ |
uint8_t cmd; |
if (current_hardware == NC) |
{ |
// switch to MKGPS |
cmd = 0x02; // 0 = FC, 1 = MK3MAG, 2 = MKGPS |
SendOutData('u', ADDRESS_NC, 1, &cmd, 1); |
current_hardware = MKGPS; |
_delay_ms (50); |
} |
} |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/uart/usart.h |
---|
0,0 → 1,150 |
/***************************************************************************** |
* Copyright (C) 2008 Thomas Kaiser, thomas@ft-fanpage.de * |
* Copyright (C) 2009 Peter "woggle" Mack, mac@denich.net * |
* Copyright (C) 2011 Christian "Cebra" Brandtner, brandtner@brandtner.net * |
* Copyright (C) 2011 Harald Bongartz * |
* * |
* This program is free software; you can redistribute it and/or modify * |
* it under the terms of the GNU General Public License as published by * |
* the Free Software Foundation; either version 2 of the License. * |
* * |
* This program is distributed in the hope that it will be useful, * |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
* GNU General Public License for more details. * |
* * |
* You should have received a copy of the GNU General Public License * |
* along with this program; if not, write to the * |
* Free Software Foundation, Inc., * |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
* * |
* * |
* Credits to: * |
* Holger Buss & Ingo Busker from mikrokopter.de for the MK project + SVN * |
* http://www.mikrokopter.de * |
* Gregor "killagreg" Stobrawa for his version of the MK code * |
* Thomas Kaiser "thkais" for the original project. See * |
* http://www.ft-fanpage.de/mikrokopter/ * |
* http://forum.mikrokopter.de/topic-4061-1.html * |
* Claas Anders "CaScAdE" Rathje for providing the font and his C-OSD code * |
* http://www.mylifesucks.de/oss/c-osd/ * |
* Harald Bongartz "HaraldB" for providing his Ideas and Code for usibility* |
*****************************************************************************/ |
#ifndef _USART_H |
#define _USART_H |
//-------------------------------------------------------------- |
// |
#ifndef FALSE |
#define FALSE 0 |
#endif |
#ifndef TRUE |
#define TRUE 1 |
#endif |
// addresses |
#define ADDRESS_ANY 0 |
#define ADDRESS_FC 1 |
#define ADDRESS_NC 2 |
#define ADDRESS_MAG 3 |
// must be at least 4('#'+Addr+'CmdID'+'\r')+ (80 * 4)/3 = 111 bytes |
#define TXD_BUFFER_LEN 180 |
#define RXD_BUFFER_LEN 180 |
// Baud rate of the USART |
#define USART_BAUD 57600 |
//#define USART_BAUD 125000 |
//-------------------------------------------------------------- |
// |
extern uint8_t buffer[30]; |
extern volatile uint8_t txd_buffer[TXD_BUFFER_LEN]; |
extern volatile uint8_t txd_complete; |
extern volatile uint8_t txd1_buffer[TXD_BUFFER_LEN]; |
extern volatile uint8_t txd1_complete; |
extern volatile uint8_t rxd_buffer[RXD_BUFFER_LEN]; |
extern volatile uint8_t rxd_buffer_locked; |
extern volatile uint8_t ReceivedBytes; |
extern volatile uint8_t *pRxData; |
extern volatile uint8_t RxDataLen; |
extern volatile uint16_t stat_crc_error; |
extern volatile uint16_t stat_overflow_error; |
extern volatile uint8_t rxFlag; |
extern volatile uint8_t rx_byte; |
//-------------------------------------------------------------- |
// |
void SetBaudUart0(uint8_t Baudrate); |
void USART_Init (unsigned int baudrate); |
void USART_DisableTXD (void); |
void USART_EnableTXD (void); |
void USART_request_mk_data (uint8_t cmd, uint8_t addr, uint8_t ms); |
void USART_putc (char c); |
void USART_puts (char *s); |
void USART_puts_p (const char *s); |
extern char USART_getc(void); |
void SendOutData (uint8_t cmd, uint8_t addr, uint8_t numofbuffers, ...); // uint8_t *pdata, uint8_t len, ... |
//void SendOutData(uint8_t cmd, uint8_t addr, uint8_t numofbuffers, uint8_t *pdata, uint8_t len); // uint8_t *pdata, uint8_t len, ... |
void Decode64 (void); |
void SwitchToNC (void); |
void SwitchToFC (void); |
void SwitchToMAG (void); |
void SwitchToGPS (void); |
void SwitchToWi232 (void); |
void debug1(void); |
uint8_t uart_getc_nb(uint8_t*); |
//-------------------------------------------------------------- |
//Anpassen der seriellen Schnittstellen Register |
#define USART_RXC_vect USART0_RX_vect |
//-------------------------------------------------------------- |
#define UCSRA UCSR0A |
#define UCSRB UCSR0B |
#define UCSRC UCSR0C |
#define UDR UDR0 |
#define UBRRL UBRR0L |
#define UBRRH UBRR0H |
// UCSRA |
#define RXC RXC0 |
#define TXC TXC0 |
#define UDRE UDRE0 |
#define FE FE0 |
#define UPE UPE0 |
#define U2X U2X0 |
#define MPCM MPCM0 |
// UCSRB |
#define RXCIE RXCIE0 |
#define TXCIE TXCIE0 |
#define UDRIE UDRIE0 |
#define TXEN TXEN0 |
#define RXEN RXEN0 |
#define UCSZ2 UCSZ02 |
#define RXB8 RXB80 |
#define TXB8 TXB80 |
// UCSRC |
#define UMSEL1 UMSEL01 |
#define UMSEL0 UMSEL00 |
#define UPM1 UPM01 |
#define UPM0 UPM00 |
#define USBS USBS0 |
#define UCSZ1 UCSZ01 |
#define UCSZ0 UCSZ00 |
#define UCPOL UCPOL0 |
#endif |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/waypoints/waypoints.c |
---|
0,0 → 1,360 |
/*#######################################################################################*/ |
/* !!! THIS IS NOT FREE SOFTWARE !!! */ |
/*#######################################################################################*/ |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Copyright (c) 2008 Ingo Busker, Holger Buss |
// + Nur für den privaten Gebrauch / NON-COMMERCIAL USE ONLY |
// + FOR NON COMMERCIAL USE ONLY |
// + www.MikroKopter.com |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Es gilt für das gesamte Projekt (Hardware, Software, Binärfiles, Sourcecode und Dokumentation), |
// + dass eine Nutzung (auch auszugsweise) nur für den privaten (nicht-kommerziellen) Gebrauch zulässig ist. |
// + Sollten direkte oder indirekte kommerzielle Absichten verfolgt werden, ist mit uns (info@mikrokopter.de) Kontakt |
// + bzgl. der Nutzungsbedingungen aufzunehmen. |
// + Eine kommerzielle Nutzung ist z.B.Verkauf von MikroKoptern, Bestückung und Verkauf von Platinen oder Bausätzen, |
// + Verkauf von Luftbildaufnahmen, usw. |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Werden Teile des Quellcodes (mit oder ohne Modifikation) weiterverwendet oder veröffentlicht, |
// + unterliegen sie auch diesen Nutzungsbedingungen und diese Nutzungsbedingungen incl. Copyright müssen dann beiliegen |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Sollte die Software (auch auszugesweise) oder sonstige Informationen des MikroKopter-Projekts |
// + auf anderen Webseiten oder sonstigen Medien veröffentlicht werden, muss unsere Webseite "http://www.mikrokopter.de" |
// + eindeutig als Ursprung verlinkt werden |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Keine Gewähr auf Fehlerfreiheit, Vollständigkeit oder Funktion |
// + Benutzung auf eigene Gefahr |
// + Wir übernehmen keinerlei Haftung für direkte oder indirekte Personen- oder Sachschäden |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Portierung oder Nutzung der Software (oder Teile davon) auf andere Systeme (ausser der Hardware von www.mikrokopter.de) ist nur |
// + mit unserer Zustimmung zulässig |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Funktion printf_P() unterliegt ihrer eigenen Lizenz und ist hiervon nicht betroffen |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Redistributions of source code (with or without modifications) must retain the above copyright notice, |
// + this list of conditions and the following disclaimer. |
// + * Neither the name of the copyright holders nor the names of contributors may be used to endorse or promote products derived |
// + from this software without specific prior written permission. |
// + * The use of this project (hardware, software, binary files, sources and documentation) is only permitted |
// + for non-commercial use (directly or indirectly) |
// + Commercial use (for excample: selling of MikroKopters, selling of PCBs, assembly, ...) is only permitted |
// + with our written permission |
// + * If sources or documentations are redistributet on other webpages, out webpage (http://www.MikroKopter.de) must be |
// + clearly linked as origin |
// + * porting the sources to other systems or using the software on other systems (except hardware from www.mikrokopter.de) is not allowed |
// |
// + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
// + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
// + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
// + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
// + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
// + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
// + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
// + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
// + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
// + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
// + POSSIBILITY OF SUCH DAMAGE. |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
#include <stdlib.h> |
#include <avr/io.h> |
#include <stdint.h> |
#include <string.h> |
#include <stdbool.h> |
//#include "91x_lib.h" |
#include "waypoints.h" |
#include "../mk-data-structs.h" |
#include "../uart/uart1.h" |
#include "../eeprom/eeprom.h" |
#include <util/delay.h> |
// the waypoints list |
NaviData_t *NaviData; |
//Point_t PointList[MAX_LIST_LEN]; |
uint8_t WPIndex = 0; // list index of GPS point representig the current WP, can be maximal WPCount |
uint8_t POIIndex = 0; // list index of GPS Point representing the current POI, can be maximal WPCount |
uint8_t WPCount = 0; // number of waypoints |
uint8_t PointCount = 0; // number of wp in the list can be maximal equal to MAX_LIST_LEN |
uint8_t POICount = 0; |
uint8_t WPActive = false; |
uint8_t PointList_Init(void) |
{ |
return PointList_Clear(); |
} |
uint8_t PointList_Clear(void) |
{ |
uint8_t i; |
WPIndex = 0; // real list position are 1 ,2, 3 ... |
POIIndex = 0; // real list position are 1 ,2, 3 ... |
WPCount = 0; // no waypoints |
POICount = 0; |
PointCount = 0; // no contents |
WPActive = false; |
NaviData->WaypointNumber = WPCount; |
NaviData->WaypointIndex = 0; |
for(i = 0; i < MAX_LIST_LEN; i++) |
{ |
Config.PointList[i].Position.Status = INVALID; |
Config.PointList[i].Position.Latitude = 0; |
Config.PointList[i].Position.Longitude = 0; |
Config.PointList[i].Position.Altitude = 0; |
Config.PointList[i].Heading = 361; // invalid value |
Config.PointList[i].ToleranceRadius = 0; // in meters, if the MK is within that range around the target, then the next target is triggered |
Config.PointList[i].HoldTime = 0; // in seconds, if the was once in the tolerance area around a WP, this time defines the delay before the next WP is triggered |
Config.PointList[i].Type = POINT_TYPE_INVALID; |
Config.PointList[i].Event_Flag = 0; // future implementation |
Config.PointList[i].AltitudeRate = 0; // no change of setpoint |
} |
return true; |
} |
uint8_t PointList_GetCount(void) |
{ |
return PointCount; // number of points in the list |
} |
Point_t* PointList_GetAt(uint8_t index) |
{ |
if((index > 0) && (index <= PointCount)) return(&(Config.PointList[index-1])); // return pointer to this waypoint |
else return(NULL); |
} |
uint8_t PointList_SetAt(Point_t* pPoint) |
{ |
// if index is in range |
if((pPoint->Index > 0) && (pPoint->Index <= MAX_LIST_LEN)) |
{ |
// check list entry before update |
switch(Config.PointList[pPoint->Index-1].Type) |
{ |
case POINT_TYPE_INVALID: // was invalid |
switch(pPoint->Type) |
{ |
default: |
case POINT_TYPE_INVALID: |
// nothing to do |
break; |
case POINT_TYPE_WP: |
WPCount++; |
PointCount++; |
break; |
case POINT_TYPE_POI: |
POICount++; |
PointCount++; |
break; |
} |
break; |
case POINT_TYPE_WP: // was a waypoint |
switch(pPoint->Type) |
{ |
case POINT_TYPE_INVALID: |
WPCount--; |
PointCount--; |
break; |
default: |
case POINT_TYPE_WP: |
//nothing to do |
break; |
case POINT_TYPE_POI: |
POICount++; |
WPCount--; |
break; |
} |
break; |
case POINT_TYPE_POI: // was a poi |
switch(pPoint->Type) |
{ |
case POINT_TYPE_INVALID: |
POICount--; |
PointCount--; |
break; |
case POINT_TYPE_WP: |
WPCount++; |
POICount--; |
break; |
case POINT_TYPE_POI: |
default: |
// nothing to do |
break; |
} |
break; |
} |
memcpy(&Config.PointList[pPoint->Index-1], pPoint, sizeof(Point_t)); // copy data to list entry |
NaviData->WaypointNumber = WPCount; |
return pPoint->Index; |
} |
else return(0); |
} |
// returns the pointer to the first waypoint within the list |
Point_t* PointList_WPBegin(void) |
{ |
uint8_t i; |
WPIndex = 0; // set list position invalid |
if(WPActive == false) return(NULL); |
POIIndex = 0; // set invalid POI |
if(PointCount > 0) |
{ |
// search for first wp in list |
for(i = 0; i <MAX_LIST_LEN; i++) |
{ |
if((Config.PointList[i].Type == POINT_TYPE_WP) && (Config.PointList[i].Position.Status != INVALID)) |
{ |
WPIndex = i + 1; |
break; |
} |
} |
if(WPIndex) // found a WP in the list |
{ |
NaviData->WaypointIndex = 1; |
// update index to POI |
if(Config.PointList[WPIndex-1].Heading < 0) POIIndex = (uint8_t)(-Config.PointList[WPIndex-1].Heading); |
else POIIndex = 0; |
} |
else // some points in the list but no WP found |
{ |
NaviData->WaypointIndex = 0; |
//Check for an existing POI |
for(i = 0; i < MAX_LIST_LEN; i++) |
{ |
if((Config.PointList[i].Type == POINT_TYPE_POI) && (Config.PointList[i].Position.Status != INVALID)) |
{ |
POIIndex = i + 1; |
break; |
} |
} |
} |
} |
else // no point in the list |
{ |
POIIndex = 0; |
NaviData->WaypointIndex = 0; |
} |
if(WPIndex) return(&(Config.PointList[WPIndex-1])); |
else return(NULL); |
} |
// returns the last waypoint |
Point_t* PointList_WPEnd(void) |
{ |
uint8_t i; |
WPIndex = 0; // set list position invalid |
POIIndex = 0; // set invalid |
if(WPActive == false) return(NULL); |
if(PointCount > 0) |
{ |
// search backward! |
for(i = 1; i <= MAX_LIST_LEN; i++) |
{ |
if((Config.PointList[MAX_LIST_LEN - i].Type == POINT_TYPE_WP) && (Config.PointList[MAX_LIST_LEN - i].Position.Status != INVALID)) |
{ |
WPIndex = MAX_LIST_LEN - i + 1; |
break; |
} |
} |
if(WPIndex) // found a WP within the list |
{ |
NaviData->WaypointIndex = WPCount; |
if(Config.PointList[WPIndex-1].Heading < 0) POIIndex = (uint8_t)(-Config.PointList[WPIndex-1].Heading); |
else POIIndex = 0; |
} |
else // list contains some points but no WP in the list |
{ |
// search backward for a POI! |
for(i = 1; i <= MAX_LIST_LEN; i++) |
{ |
if((Config.PointList[MAX_LIST_LEN - i].Type == POINT_TYPE_POI) && (Config.PointList[MAX_LIST_LEN - i].Position.Status != INVALID)) |
{ |
POIIndex = MAX_LIST_LEN - i + 1; |
break; |
} |
} |
NaviData->WaypointIndex = 0; |
} |
} |
else // no point in the list |
{ |
POIIndex = 0; |
NaviData->WaypointIndex = 0; |
} |
if(WPIndex) return(&(Config.PointList[WPIndex-1])); |
else return(NULL); |
} |
// returns a pointer to the next waypoint or NULL if the end of the list has been reached |
Point_t* PointList_WPNext(void) |
{ |
uint8_t wp_found = 0; |
if(WPActive == false) return(NULL); |
if(WPIndex < MAX_LIST_LEN) // if there is a next entry in the list |
{ |
uint8_t i; |
for(i = WPIndex; i < MAX_LIST_LEN; i++) // start search for next at next list entry |
{ |
if((Config.PointList[i].Type == POINT_TYPE_WP) && (Config.PointList[i].Position.Status != INVALID)) // jump over POIs |
{ |
wp_found = i+1; |
break; |
} |
} |
} |
if(wp_found) |
{ |
WPIndex = wp_found; // update list position |
NaviData->WaypointIndex++; |
if(Config.PointList[WPIndex-1].Heading < 0) POIIndex = (uint8_t)(-Config.PointList[WPIndex-1].Heading); |
else POIIndex = 0; |
return(&(Config.PointList[WPIndex-1])); // return pointer to this waypoint |
} |
else |
{ // no next wp found |
NaviData->WaypointIndex = 0; |
POIIndex = 0; |
return(NULL); |
} |
} |
void PointList_WPActive(uint8_t set) |
{ |
if(set) |
{ |
WPActive = true; |
PointList_WPBegin(); // uopdates POI index |
} |
else |
{ |
WPActive = false; |
POIIndex = 0; // disable POI also |
} |
} |
Point_t* PointList_GetPOI(void) |
{ |
return PointList_GetAt(POIIndex); |
} |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/waypoints/waypoints.h |
---|
0,0 → 1,56 |
#ifndef _WAYPOINTS_H |
#define _WAYPOINTS_H |
//#include "ubx.h" |
#include "../mk-data-structs.h" |
#define POINT_TYPE_INVALID 255 |
#define POINT_TYPE_WP 0 |
#define POINT_TYPE_POI 1 |
#define INVALID 0x00 |
//typedef struct |
//{ |
// int32_t Longitude; // in 1E-7 deg |
// int32_t Latitude; // in 1E-7 deg |
// int32_t Altitude; // in mm |
// uint8_t Status;// validity of data |
//} __attribute__((packed)) GPS_Pos_t; |
//typedef struct |
//{ |
// GPS_Pos_t Position; // the gps position of the waypoint, see ubx.h for details |
// int16_t Heading; // orientation, 0 no action, 1...360 fix heading, neg. = Index to POI in WP List |
// uint8_t ToleranceRadius; // in meters, if the MK is within that range around the target, then the next target is triggered |
// uint8_t HoldTime; // in seconds, if the was once in the tolerance area around a WP, this time defines the delay before the next WP is triggered |
// uint8_t Event_Flag; // future implementation |
// uint8_t Index; // to indentify different waypoints, workaround for bad communications PC <-> NC |
// uint8_t Type; // typeof Waypoint |
// uint8_t WP_EventChannelValue; // |
// uint8_t AltitudeRate; // rate to change the setpoint |
// uint8_t reserve[8]; // reserve |
//} __attribute__((packed)) Point_t; |
// Init List, return TRUE on success |
uint8_t PointList_Init(void); |
// Clear List, return TRUE on success |
uint8_t PointList_Clear(void); |
// Returns number of points in the list |
uint8_t PointList_GetCount(void); |
// return pointer to point at position |
Point_t* PointList_GetAt(uint8_t index); |
// set a point in the list at index, returns its index on success, else 0 |
uint8_t PointList_SetAt(Point_t* pPoint); |
// goto the first WP in the list and return pointer to it |
Point_t* PointList_WPBegin(void); |
// goto the last WP in the list and return pointer to it |
Point_t* PointList_WPEnd(void); |
// goto next WP in the list and return pointer to it |
Point_t* PointList_WPNext(void); |
// enables/disables waypoint function |
void PointList_WPActive(uint8_t set); |
// returns pointer to actual POI |
Point_t* PointList_GetPOI(void); |
#endif // _WAYPOINTS_H |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/wi232/Text File |
---|
0,0 → 1,177 |
// wi232.c: |
// |
// Call fopen_wi232() to set up the wi232 as an input output data stream. |
// If fopen_wi232() is the first fopen command called, then the wi232 |
// becomes stdin and stdout and stderr. |
// The |
// |
// Uses Interupts to handle data streaming. The wi232 uses USART0, which uses: |
// Rx = PORTE0 = pin 2 |
// Tx = PORTE1 = pin 3 |
// CTS = PORTE2 = pin 4 |
#include <inttypes.h> |
#include <stdio.h> |
#include <avr/io.h> |
#include <avr/interrupt.h> |
#include <avr/signal.h> |
#include "wi232.h" |
#include "circularqueue.h" |
#include "usart.h" |
const int _baud_rate_c = 38400; |
const int _tx_buffer_size_c = 256; |
const int _rx_buffer_size_c = 256; |
const uint8_t _cts_pin_c = _BV( PINE2 ); |
volatile char wi232_tx_buffer[ _tx_buffer_size_c ]; |
volatile char wi232_rx_buffer[ _rx_buffer_size_c ]; |
// circular queues used for the USART |
CircularQueue< volatile char > wi232_tx_q( wi232_tx_buffer, _tx_buffer_size_c ); |
CircularQueue< volatile char > wi232_rx_q( wi232_rx_buffer, _rx_buffer_size_c ); |
// prototype |
int wi232_putchar( char ); |
int wi232_getchar(); |
void initialize_baud_rate(); |
void command( bool enable ); |
void write_register( uint8_t reg, uint8_t value ); |
bool _cts(); |
// use BAUD_RATE baud 8N1 RX & TX on USART0 |
// to transmit to the wi232 |
FILE* fopen_wi232() |
{ |
// enable Rx, Tx & Rx interupt |
// (Tx buffer empty interupt is enabled when we actually send something) |
UCSR0B = _BV( RXEN0 ) | |
_BV( TXEN0 ) | |
_BV( RXCIE0 ); |
// UCSC00 = 1 & UCSC01 = 1 -> 8-bit data |
UCSR0C = _BV( UCSZ00 ) | _BV( UCSZ01 ); |
initialize_baud_rate(); |
wi232_tx_q.clear(); |
wi232_rx_q.clear(); |
// set wi232_putchar as the stdout stream character Tx-er |
// set wi232_getchar as the stdin stream chacacter Rx-er |
return fdevopen( wi232_putchar, wi232_getchar, 0 ); |
} |
inline void initialize_baud_rate() |
{ |
// enable command pin as output |
DDRE |= _BV( PORTE3 ); |
command( true ); |
usart0_set_baud_rate( 2400 ); |
sei(); |
write_register( 78, 3 ); // set baud rate to 38400 |
wait(100); |
cli(); |
usart0_set_baud_rate( 38400 ); |
command( false ); |
} |
inline void command( bool enable ) |
{ |
if ( enable ) |
PORTE &= ~_BV( PORTE3 ); |
else |
PORTE |= _BV( PORTE3 ); |
} |
inline void write_register( uint8_t reg, uint8_t value ) |
{ |
if ( value < 0x80 ) |
{ |
// data = [ 0xFF, 2, reg, value ] |
wi232_putchar( 0xFF ); |
wi232_putchar( 2 ); |
wi232_putchar( reg ); |
wi232_putchar( value ); |
} |
else // value >= 0x80 |
{ |
// data = [ 0xFF, 3, reg, 0xFE, (value - 0x80) ] |
wi232_putchar( 0xFF ); |
wi232_putchar( 3 ); |
wi232_putchar( reg ); |
wi232_putchar( 0xFE ); |
wi232_putchar( value - 0x80 ); |
} |
} |
int wi232_putchar( char x ) |
{ |
wi232_tx_q.put( x ); |
// enable the "data register empty" interupt |
// (it may already be enabled in which case no harm is done) |
UCSR0B |= _BV( UDRIE0 ); |
// return -1 if overflow is true, otherwise return 0 |
// return wi232_tx_q.overflow() ? -1 : 0; |
return 0; // for now, screw overflow - just ignore it |
} |
int wi232_getchar() |
{ |
// wait until the queue is no longer empty |
while ( wi232_rx_q.is_empty() ); |
char x = wi232_rx_q.get(); |
return x; |
} |
uint16_t wi232_data_available() |
{ |
return wi232_rx_q.length(); |
} |
bool wi232_is_empty() |
{ |
return wi232_rx_q.is_empty(); |
} |
// returns true when CTS is low, |
// i.e. it is true when it is okay to send data |
inline bool _cts() |
{ |
return !(PINE & _cts_pin_c); |
} |
// we received some data on USART0 |
// put this data into the received data queue |
SIGNAL( SIG_UART0_RECV ) |
{ |
wi232_rx_q.put( UDR0 ); |
} |
// the USART is ready to queue another byte to send |
SIGNAL( SIG_UART0_DATA ) |
{ |
if ( !wi232_tx_q.is_empty() ) |
{ |
if ( !_cts() ) |
{ |
sei(); |
// wait until CTS is true |
while ( !_cts() ); |
} |
// if the queue is not empty, put the next character in the buffer |
// this also resets the interupt flag automatically |
UDR0 = wi232_tx_q.get(); |
} |
else |
{ |
// disable the interupt |
UCSR0B &= ~_BV( UDRIE0 ); |
} |
} |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/wi232/Wi232.c |
---|
0,0 → 1,621 |
/***************************************************************************** |
* Copyright (C) 2008 Thomas Kaiser, thomas@ft-fanpage.de * |
* Copyright (C) 2009 Peter "woggle" Mack, mac@denich.net * |
* Copyright (C) 2011 Christian "Cebra" Brandtner, brandtner@brandtner.net * |
* Copyright (C) 2011 Harald Bongartz * |
* * |
* This program is free software; you can redistribute it and/or modify * |
* it under the terms of the GNU General Public License as published by * |
* the Free Software Foundation; either version 2 of the License. * |
* * |
* This program is distributed in the hope that it will be useful, * |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
* GNU General Public License for more details. * |
* * |
* You should have received a copy of the GNU General Public License * |
* along with this program; if not, write to the * |
* Free Software Foundation, Inc., * |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
* * |
* * |
* Credits to: * |
* Holger Buss & Ingo Busker from mikrokopter.de for the MK project + SVN * |
* http://www.mikrokopter.de * |
* Gregor "killagreg" Stobrawa for his version of the MK code * |
* Thomas Kaiser "thkais" for the original project. See * |
* http://www.ft-fanpage.de/mikrokopter/ * |
* http://forum.mikrokopter.de/topic-4061-1.html * |
* Claas Anders "CaScAdE" Rathje for providing the font and his C-OSD code * |
* http://www.mylifesucks.de/oss/c-osd/ * |
* Harald Bongartz "HaraldB" for providing his Ideas and Code for usibility* |
*****************************************************************************/ |
#include "../cpu.h" |
#include <avr/io.h> |
#include <avr/pgmspace.h> |
#include <util/delay.h> |
#include <stdlib.h> |
#include <string.h> |
#include "../lcd/lcd.h" |
#include "../uart/usart.h" |
#include "../uart/uart1.h" |
#include "../main.h" |
#include "../wi232/Wi232.h" |
#include "../timer/timer.h" |
#include "../eeprom/eeprom.h" |
#include "../setup/setup.h" |
#if defined HWVERSION1_3W || defined HWVERSION3_9 || defined HWVERSION1_2W |
uint8_t Wi232_hardware = 0; |
uint8_t InitErr=0; |
uint8_t Wi232_Baudrate = 0; //Merkzelle für aktuelle Baudrate |
uint8_t Wi232_New_Baudrate = 0; //Merkzelle für zu setzende Baudrate |
uint16_t SearchWi232(uint8_t Baudrate) // Suche Wi232 mit entsprechender Baudrate |
// Return = 0, Wi232 not found |
{ |
int16_t RegisterWi232; |
SetBaudUart0(Baudrate); |
lcd_printpns_at (0, 1, PSTR(" with Baud"),0); |
switch (Baudrate) |
{ |
case Baud_2400: lcd_printpns_at (6, 1, PSTR(" 2400"),0);break; |
case Baud_9600: lcd_printpns_at (6, 1, PSTR(" 9600"),0);break; |
case Baud_19200: lcd_printpns_at (6, 1, PSTR(" 19200"),0);break; |
case Baud_38400: lcd_printpns_at (6, 1, PSTR(" 38400"),0);break; |
case Baud_57600: lcd_printpns_at (6, 1, PSTR(" 57600"),0);break; |
case Baud_115200:lcd_printpns_at (6, 1, PSTR("115200"),0);break; |
break; |
} |
RegisterWi232 = ReadWi232(regDiscover); |
lcd_print_hex_at(0,2,RegisterWi232,0); |
if (RegisterWi232 > 0 && RegisterWi232 < 0xFF) |
{ Wi232_hardware = 2; |
Wi232_Baudrate = Baudrate; |
} |
return RegisterWi232; |
} |
/************************************************************************* |
Function: discoverWI232() |
Purpose: check if Wi232 available |
Returns: Version or 0 = timeout |
**************************************************************************/ |
void discoverWi232(uint8_t DiscBaudrate) |
{ |
int16_t RegisterWi232=0; |
SwitchToWi232(); /* Serielle Kanäle Wi232 mit USB verbinden*/ |
set_WI232CMD(); |
_delay_ms(200); |
lcd_cls(); |
SetBaudUart0( DiscBaudrate); |
lcd_printpns_at (0, 0, PSTR("search Wi.232 Modul"),0); |
{ |
while (RegisterWi232==0) |
{ |
RegisterWi232=SearchWi232(DiscBaudrate); if (RegisterWi232 !=0) {Wi232_hardware = 1; continue;} |
RegisterWi232=SearchWi232(Baud_2400); if (RegisterWi232 !=0) continue; |
RegisterWi232=SearchWi232(Baud_9600); if (RegisterWi232 !=0) continue; |
RegisterWi232=SearchWi232(Baud_19200); if (RegisterWi232 !=0) continue; |
RegisterWi232=SearchWi232(Baud_38400); if (RegisterWi232 !=0) continue; |
RegisterWi232=SearchWi232(Baud_57600); if (RegisterWi232 !=0) continue; |
RegisterWi232=SearchWi232(Baud_115200); if (RegisterWi232 !=0) continue; |
break; |
} |
// _delay_ms(1000); |
} |
if (RegisterWi232 == 0) |
{ |
lcd_cls(); |
lcd_printpns_at (0, 0, PSTR("no Wi.232 found"),0); |
Wi232_hardware = 0; |
_delay_ms(2000); |
} |
if (RegisterWi232 == 0xFF) |
{ |
lcd_cls(); |
lcd_printpns_at (0, 0, PSTR("Wi.232 Sytaxerror "),0); |
set_beep ( 1000, 0x0040, BeepNormal); |
_delay_ms(2000); |
RegisterWi232 = 0; |
} |
if (RegisterWi232 > 0 && RegisterWi232 < 0xFF) |
{ |
lcd_cls(); |
SetBaudUart0(Wi232_Baudrate); |
if (Wi232_hardware ==1) // alles ok , Baudrate Wi232 passt |
lcd_printpns_at (0, 0, PSTR("Wi.232 found "),0); |
if (Wi232_hardware ==2) // Wi232 gefunden, aber falsche Baudrate |
{ |
Config.WiIsSet= false; //wenn hier 2400 gefunden wurde, ist Wi232 nicht initialisiert |
lcd_printpns_at (0, 0, PSTR("Wi.232 wrong Baudrate"),0); |
if (WriteWi232(regNVDATARATE,Config.PKT_Baudrate)!=0) /* NV-Ram auf PKT-Baudrate setzen*/ |
{ |
lcd_printpns_at (0, 1, PSTR("Error set NV-RAM"),0); |
set_beep ( 1000, 0x0040, BeepNormal); |
_delay_ms(2000); |
} |
// else |
// { |
//// _delay_ms(1000); |
// lcd_printpns_at (0, 1, PSTR("NV-RAM is set to "),0); |
// lcd_printpns_at (0, 2, PSTR("given Baudrate"),0); |
// _delay_ms(2000); |
// } |
if (WriteWi232(regDATARATE,Config.PKT_Baudrate)!=0) /* Ram auf PKT_Baudrate setzen*/ |
{ |
lcd_printpns_at (0, 3, PSTR("Error set RAM "),0); |
set_beep ( 1000, 0x0040, BeepNormal); |
_delay_ms(2000); |
} |
// else |
// { |
//// _delay_ms(1000); |
// lcd_printpns_at (0, 1, PSTR("RAM is set to "),0); |
// lcd_printpns_at (0, 2, PSTR("given Baudrate"),0); |
// _delay_ms(2000); |
// } |
SetBaudUart0(Config.PKT_Baudrate); |
Old_Baudrate = Config.PKT_Baudrate; |
} |
lcd_cls_line (0,1,21); |
lcd_printpns_at (0, 1, PSTR("Version:"),0); |
lcd_print_hex_at(9,1,RegisterWi232,0); |
} |
clr_WI232CMD(); |
} |
/************************************************************************* |
Function: InitWI232() |
Purpose: set Wi232Register for Mikrokopter |
Returns: 0 = ACK, FF = NAK |
**************************************************************************/ |
void InitWi232(uint8_t InitBaudrate) |
{ |
uint8_t i = 0; |
#ifdef HWVERSION3_9 |
Change_Output(Uart02Wi); // Verbindung zu Wi232 herstellen |
#endif |
discoverWi232(Old_Baudrate); // Check if Wi232 available |
if (Wi232_hardware != 0) |
{ |
lcd_printpns_at (0, 2, PSTR("Init Wi232 wait...."),0); |
set_WI232CMD(); |
_delay_ms(200); |
SwitchToWi232(); /* Serielle Kanäle Wi232 mit USB verbinden*/ |
if (WriteWi232(regNETGRP,126)!=0) /*damit Wi232 nix mehr vom Kopter schickt erstmal Networkgroup ins Nirwana setzen */ |
lcd_printpns_at (i++,4,PSTR("."),0); |
// InitErr =12; |
// Grund: |
//If RF packets are received while the CMD line is active, |
//they are still processed and presented to the module’s UART for transmission. |
// wenn sich ein EEPROM-Wert ändert wird auch das Ram beschrieben damit die Änderung sofort wirksam wird |
if (WriteWi232(regNVTXCHANNEL,Config.WiTXRXChannel)!=0) |
InitErrorWi232(1); /*TX Channel*/ |
lcd_printpns_at (i++,4,PSTR("."),0); |
if (WriteWi232(regTXCHANNEL,Config.WiTXRXChannel)!=0) |
InitErrorWi232(2);/*TX Channel*/ |
lcd_printpns_at (i++,4,PSTR("."),0); |
if (WriteWi232(regNVRXCHANNEL,Config.WiTXRXChannel)!=0) |
InitErrorWi232(3);/* RX Channel*/ |
lcd_printpns_at (i++,4,PSTR("."),0); |
if (WriteWi232(regRXCHANNEL,Config.WiTXRXChannel)!=0) |
InitErrorWi232(4);/* RX Channel*/ |
lcd_printpns_at (i++,4,PSTR("."),0); |
if (WriteWi232(regNVSLPMODE ,Sleep_Awake)!=0) |
InitErrorWi232(5);/* Sleepmode*/ |
lcd_printpns_at (i++,4,PSTR("."),0); |
if (WriteWi232(regNVPWRMODE,WbModeP15)!=0) |
InitErrorWi232(6);/* Transceiver Mode/Powermode */ |
lcd_printpns_at (i++,4,PSTR("."),0); |
if (WriteWi232(regNVTXTO,Config.WiTXTO)!=0) |
InitErrorWi232(7);/* UART Timeout */ |
lcd_printpns_at (i++,4,PSTR("."),0); |
if (WriteWi232(regTXTO,Config.WiTXTO)!=0) |
InitErrorWi232(8);/* UART Timeout */ |
lcd_printpns_at (i++,4,PSTR("."),0); |
if (WriteWi232(regNVUARTMTU,Config.WiUartMTU)!=0) |
InitErrorWi232(9);/* UART Buffer*/ |
lcd_printpns_at (i++,4,PSTR("."),0); |
if (WriteWi232(regUARTMTU,Config.WiUartMTU)!=0) |
InitErrorWi232(10);/* UART Buffer*/ |
lcd_printpns_at (i++,4,PSTR("."),0); |
if (WriteWi232(regNVNETMODE,Config.WiNetworkMode)!=0) |
InitErrorWi232(11);/* Networkmode*/ |
lcd_printpns_at (i++,4,PSTR("."),0); |
if (WriteWi232(regNETMODE,Config.WiNetworkMode)!=0) |
InitErrorWi232(12);/* Networkmode*/ |
lcd_printpns_at (i++,4,PSTR("."),0); |
if (WriteWi232(regNVUSECRC ,CRC_Enable)!=0) |
InitErrorWi232(13);/* CRC*/ |
lcd_printpns_at (i++,4,PSTR("."),0); |
if (WriteWi232(regNVCSMAMODE,CSMA_En)!=0) |
InitErrorWi232(14);/* CSMA*/ |
lcd_printpns_at (i++,4,PSTR("."),0); |
if (WriteWi232(regNVNETGRP,Config.WiNetworkGroup)!=0) |
InitErrorWi232(15);/* Networkgroup */ |
lcd_printpns_at (i++,4,PSTR("."),0); |
if (WriteWi232(regNETGRP,Config.WiNetworkGroup)!=0) |
InitErrorWi232(15);/* Networkgroup */ |
lcd_printpns_at (i++,4,PSTR("."),0); |
if (WriteWi232(regNVDATARATE,InitBaudrate)!=0) |
InitErrorWi232(16);/* Baudrate*/ |
lcd_printpns_at (i++,4,PSTR("."),0); |
_delay_ms(200); |
if (WriteWi232(regDATARATE,InitBaudrate)!=0) |
InitErrorWi232(17);/* Baudrate*/ |
lcd_printpns_at (i++,4,PSTR("."),0); |
clr_WI232CMD(); |
if (InitErr !=0) |
{ |
lcd_printpns_at (0, 2, PSTR("Wi232 InitError "),0); |
lcd_print_hex(InitErr,0); |
set_beep ( 1000, 0x0040, BeepNormal); |
_delay_ms(2000); |
} |
else |
{ |
lcd_printpns_at (0, 2, PSTR("Wi232 Init ok...."),0); |
WriteWiInitFlag(); // Init merken |
lcd_print_hex(InitBaudrate,0); |
} |
SetBaudUart0(InitBaudrate); |
_delay_ms(2000); |
} |
} |
/************************************************************************* |
Function: InitErrorWI232() |
Purpose: Show Wi232 Error, Value |
Returns: |
**************************************************************************/ |
void InitErrorWi232(uint8_t Error) |
{ |
lcd_printpns_at (0, 3, PSTR("Wi232 InitError "),0); |
lcd_print_hex(Error,0); |
InitErr=Error; |
set_beep ( 500, 0x0040, BeepNormal); |
_delay_ms(500); |
} |
/************************************************************************* |
Function: WriteWI232() |
Purpose: set Register to Wi232, Register, Value |
Returns: 0 = ACK, FF = NAK |
ACHTUNG nur für Value <0x80 |
**************************************************************************/ |
int16_t WriteWi232(uint8_t Wi232Register, uint8_t RegisterValue) |
{ |
uint8_t timeout=10; |
uint8_t tc=0; |
unsigned int v; |
if ( RegisterValue < 0x80 ) |
{ |
USART_putc(0xff); |
USART_putc(0x02); |
USART_putc(Wi232Register); |
USART_putc(RegisterValue); |
} |
else // RegisterValue >= 0x80 |
{ |
USART_putc(0xff); |
USART_putc(0x03); |
USART_putc(Wi232Register); |
USART_putc(0xfe); |
USART_putc(RegisterValue - 0x80); |
} |
do |
{ |
v = USART_getc(); /*ACK erwartet*/ |
_delay_ms(100); |
tc ++; |
} |
while (v==0 && tc!=timeout); |
// lcd_print_hex(v,0); |
if (v != 0x06) |
{ |
lcd_printpns_at (0, 2, PSTR("Wi.232 NAK"),0); |
set_beep ( 1000, 0x0040, BeepNormal); |
_delay_ms(2000); |
return 0xFF; |
} |
if (v==0x06) |
return 0; |
return 0xFF; |
} |
/************************************************************************* |
Function: ReadWI232() |
Purpose: send Readcommand to Wi232, |
Returns: Registervalue, 0 = timeout 0xFF = Syntaxerror |
**************************************************************************/ |
int16_t ReadWi232(uint16_t Wi232Register) |
{ |
uint8_t timeout=10; |
uint8_t tc=0; |
unsigned int v; |
v = USART_getc(); /*Zeichen löschen*/ |
USART_putc(0xff); |
USART_putc(0x02); |
USART_putc(0xfe); |
USART_putc(Wi232Register); |
_delay_ms(50); |
// lcd_printpns_at (0, 2, PSTR("read Wi232"),0); |
do |
{ |
v = USART_getc(); /*ACK erwartet*/ |
_delay_ms(100); |
tc ++; |
} |
while (v==0 && tc!=timeout); |
if (tc == timeout) |
return 0; /* Timeout*/ |
if (v != 0x06) |
return 0xFF; /* Syntaxerror*/ |
// lcd_print_hex(v,0); |
// v = USART_getc(); /*Register*/ |
// lcd_print_hex(v,0); |
// v = USART_getc(); /*Value*/ |
// lcd_print_hex(v,0); |
return v; |
} |
///************************************************************************* |
//Function: EscapeString() |
//Purpose: |
//Returns: |
//Quelle: Radiotronix Wi.232 Manual |
//**************************************************************************/ |
// |
// |
//int EscapeString(char *src, char src_len, char *dest) |
//{ |
// // The following function copies and encodes the first |
// // src_len characters from *src into *dest. This |
// // encoding is necessary for Wi.232 command formats. |
// // The resulting string is null terminated. The size |
// // of this string is the function return value. |
// // --------------------------------------------------- |
// uint8_t src_idx, dest_idx; |
// // Save space for the command header and size bytes |
// // ------------------------------------------------ |
// dest_idx = 2; |
// // Loop through source string and copy/encode |
// // ------------------------------------------ |
// for (src_idx = 0; src_idx < src_len; src_idx++) |
// { |
// if (src[src_idx] > 127) |
// { |
// dest[dest_idx++] = 0xFE; |
// } |
// dest[dest_idx++] = (src[src_idx] & 0x7F); |
// } |
// // Add null terminator |
// // ------------------- |
// dest[dest_idx] = 0; |
// // Add command header |
// // ------------------ |
// dest[0] = 0xFF; |
// dest[1] = dest_idx-2; |
// |
// // Return escape string size |
// // ------------------------- |
// return dest_idx; |
//} |
//#if defined HWVERSION1_3W || defined HWVERSION3_9 |
///************************************************************************* |
//Function: Wi232USB() |
//Purpose: Connect Wi232 Programmmode to PKT USB, |
//Returns: |
// |
//**************************************************************************/ |
//void Wi232_USB(void) |
// |
// |
//{ |
// unsigned int c0,c1; |
// |
// if (Wi232_hardware==1) |
// { |
//// USART_Init (UART_BAUD_SELECT(57600,F_CPU)); |
//// uart1_init( UART_BAUD_SELECT(57600,F_CPU) ); |
//// USART_Init (UART_BAUD_SELECT(2400,F_CPU)); |
//// uart1_init( UART_BAUD_SELECT(2400,F_CPU) ); |
// } |
// |
// if (Wi232_hardware==2) |
// { |
// USART_Init (UART_BAUD_SELECT(2400,F_CPU)); |
// uart1_init( UART_BAUD_SELECT(2400,F_CPU) ); |
// } |
// |
// lcd_cls (); |
//// SwitchToWi232(); /* Serielle Kanäle Wi232 mit USB verbinden*/ |
// |
// set_WI232CMD(); |
// |
// lcd_printpns_at (0, 0, PSTR("Wi.232 Konfiguration "),0); |
// lcd_printpns_at (0, 1, PSTR("PC mit USB verbinden"),0); |
// lcd_printpns_at (0, 2, PSTR("Wi.232"),0); |
// lcd_printpns_at (0, 3, PSTR("Programm starten"),0); |
// lcd_printpns_at (17, 7, PSTR("Exit"),0); |
// |
// c1 = 0; |
// |
// for(;;) |
// { |
// c0 = uart1_getc(); /* from USB*/ |
// if ( c0 & UART_NO_DATA ) |
// { |
// c1 = USART_getc(); |
// |
// if (c1 == 0) |
// {} |
// else |
// { |
//// lcd_print_hex(c1,0); |
// uart1_putc (c1); /*to USB*/; |
// } |
// } |
// else |
// { |
// USART_putc(c0 ); /* to Wi232*/ |
//// lcd_print_hex(c0,0); |
//// _delay_ms(1); |
// } |
// |
// if ((get_key_press (1 << KEY_ENTER))) |
// { |
// clr_WI232CMD(); |
//// uart1_init( UART_BAUD_SELECT(57600,F_CPU) ); |
//// USART_Init( UART_BAUD_SELECT(57600,F_CPU) ); |
//// SwitchToFC(); |
// return; |
// } |
// |
// } |
//} |
///************************************************************************* |
//Function: Wi232_FC() |
//Purpose: Connect Wi232 to PKT USB, Transparent |
//Returns: |
// |
//**************************************************************************/ |
//void Wi232_FC(void) |
// |
// |
//{ |
// unsigned int c0,c1; |
// |
// |
//// USART_Init (UART_BAUD_SELECT(PKT_Baudrate,F_CPU)); |
//// uart1_init( UART_BAUD_SELECT(PKT_Baudrate,F_CPU) ); |
// SetBaudUart0(Config.PKT_Baudrate); |
// SetBaudUart1(Config.PKT_Baudrate); |
// |
// |
// lcd_cls (); |
//// SwitchToWi232(); /* Serielle Kanäle Wi232 mit USB verbinden*/ |
// |
// |
// lcd_printpns_at (0, 0, PSTR("Wi.232 to FC "),0); |
// lcd_printpns_at (0, 1, PSTR("PC mit USB verbinden"),0); |
// lcd_printpns_at (0, 2, PSTR("und Mikrokoptertool"),0); |
// lcd_printpns_at (0, 3, PSTR("starten"),0); |
// lcd_printpns_at (17, 7, PSTR("Exit"),0); |
// |
// c1 = 0; |
// |
// for(;;) |
// { |
// c0 = uart1_getc(); /* from USB*/ |
// if ( c0 & UART_NO_DATA ) |
// { |
// c1 = USART_getc(); |
// if (c1 == 0) |
// {} |
// else |
// { |
//// lcd_print_hex(c1,0); |
// uart1_putc (c1); /*to USB*/; |
// |
// } |
// } |
// else |
// { |
// USART_putc(c0 ); /* to Wi232*/ |
//// lcd_print_hex(c0,0); |
//// _delay_ms(1); |
// } |
// |
// if ((get_key_press (1 << KEY_ENTER))) |
// { |
// return; |
// } |
// } |
//} |
#endif |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b/wi232/Wi232.h |
---|
0,0 → 1,178 |
/***************************************************************************** |
* Copyright (C) 2008 Thomas Kaiser, thomas@ft-fanpage.de * |
* Copyright (C) 2009 Peter "woggle" Mack, mac@denich.net * |
* Copyright (C) 2011 Christian "Cebra" Brandtner, brandtner@brandtner.net * |
* Copyright (C) 2011 Harald Bongartz * |
* * |
* This program is free software; you can redistribute it and/or modify * |
* it under the terms of the GNU General Public License as published by * |
* the Free Software Foundation; either version 2 of the License. * |
* * |
* This program is distributed in the hope that it will be useful, * |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
* GNU General Public License for more details. * |
* * |
* You should have received a copy of the GNU General Public License * |
* along with this program; if not, write to the * |
* Free Software Foundation, Inc., * |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
* * |
* * |
* Credits to: * |
* Holger Buss & Ingo Busker from mikrokopter.de for the MK project + SVN * |
* http://www.mikrokopter.de * |
* Gregor "killagreg" Stobrawa for his version of the MK code * |
* Thomas Kaiser "thkais" for the original project. See * |
* http://www.ft-fanpage.de/mikrokopter/ * |
* http://forum.mikrokopter.de/topic-4061-1.html * |
* Claas Anders "CaScAdE" Rathje for providing the font and his C-OSD code * |
* http://www.mylifesucks.de/oss/c-osd/ * |
* Harald Bongartz "HaraldB" for providing his Ideas and Code for usibility* |
*****************************************************************************/ |
#ifndef WI232_H_ |
#define WI232_H_ |
void discoverWi232(uint8_t Baudrate); |
void InitWi232(uint8_t Baudrate); |
int16_t WriteWi232(uint8_t Wi232Register, uint8_t RegisterValue); |
int16_t ReadWi232(uint16_t Wi232Register); |
void InitErrorWi232(uint8_t Error); |
extern uint8_t Wi232_hardware; |
extern uint8_t Wi232_New_Baudrate; //Merkzelle für zu setzende Baudrate |
// Non-volatile Registers |
// Name Address Description Default |
#define regNVTXCHANNEL 0x00 // Transmit channel setting ## 0 ## |
#define regNVRXCHANNEL 0x01 // Receive channel setting ## 0 ## |
#define regNVPWRMODE 0x02 // Operating mode settings ## +13 dBm widebandmode ## |
#define regNVDATARATE 0x03 // UART data rate ## 2400bps ## |
#define regNVNETMODE 0x04 // Network mode (Normal/Slave) ## Normal ## |
#define regNVTXTO 0x05 // Transmit wait timeout ## ~16ms ## |
#define regNVNETGRP 0x06 // Network group ID ## 0x00 ## |
#define regNVUSECRC 0x08 // Enable/Disable CRC ## Enabled ## |
#define regNVUARTMTU 0x09 // Minimum transmission unit. ## 64 bytes ## |
#define regNVSHOWVER 0x0A // Enable/Disable start-up message ## Enabled ## |
#define regNVCSMAMODE 0x0B // Enable/Disable CSMA ## Enabled ## |
#define regNVSLPMODE 0x0D // Power state of module ## Awake ## |
#define regNVACKONWAKE 0x0E // Send ACK character to host on wake |
// Non-volatile Read Only Registers |
// Name Address Description |
#define regMAC0 0x22 // These registers form the unique 48-bit MAC address. |
#define regMAC1 0x23 // MAC |
#define regMAC2 0x24 // MAC |
#define regOUI0 0x25 // MAC |
#define regOUI1 0x26 // MAC |
#define regOUI2 0x27 // MAC |
#define regDiscover 0x78 // Versionsregister |
// Volatile Read/Write Registers |
// Name Address Description |
#define regTXCHANNEL 0x4B // Transmit channel setting |
#define regRXCHANNEL 0x4C // Receive channel setting |
#define regPWRMODE 0x4D // Operating mode settings |
#define regDATARATE 0x4E // UART data rate |
#define regNETMODE 0x4F // Network mode (Normal or Slave) |
#define regTXTO 0x50 // Transmit wait timeout |
#define regNETGRP 0x51 // Network group ID |
#define regUSECRC 0x53 // Enable/Disable CRC |
#define regUARTMTU 0x54 // Minimum transmission unit. |
#define regSHOWVER 0x55 // Enable/Disable start-up message |
#define regCSMAMODE 0x56 // Enable/disable CSMA |
#define regSLPMODE 0x58 // Power state of module |
#define regACKONWAKE 0x59 // Send ACK character to host on wake |
// Wideband Channels |
// regNVTXCHAN (0x00) regTXCHAN (0x4B) |
// Channel Number Frequency |
#define wChan0 0x00 // 868.300 MHz |
#define wChan1 0x01 // 868.95 MHz ## MK ## |
// Narrowband Channels |
// regNVRXCHAN (0x01) regRXCHAN (0x4C) |
// Channel Number Frequency |
#define nChan0 0x00 // 868.225 MHz |
#define nChan1 0x01 // 868.375 MHz ## MK ## |
#define nChan2 0x02 // 868.850 MHz |
#define nChan3 0x03 // 869.050 MHz |
#define nChan4 0x04 // 869.525 MHz |
#define nChan5 0x05 // 869.850 MHz |
// Power Mode |
// regNVPWRMODE (0x02) regPWRMODE (0x4D) |
// PM1 PM1 PM0 Mode |
#define NbModeN0 0x00 // 0 0 0 Narrowband Mode 0dBm power setting (typical) |
#define WbModeP5 0x01 // 0 0 1 Wideband Mode +5dBm power setting (typical) |
#define WbModeP10 0x02 // 0 1 0 Wideband Mode +10dBm power setting (typical) |
#define WbModeP15 0x03 // 0 1 1 Wideband Mode +15dBm power setting (typical) ## MK ## |
#define WbModeN0 0x04 // 1 0 0 Wideband Mode 0dBm power setting (typical) |
#define NbModeP5 0x05 // 1 0 1 Narrowband Mode +5dBm power setting (typical) |
#define NbModeP10 0x06 // 1 1 0 Narrowband Mode +10dBm power setting (typical) |
#define NbModeP15 0x07 // 1 1 1 Narrowband Mode +15dBm power setting (typical) |
// Wi232 UART Baudrate |
// regNVDATARATE (0x03) regDATARATE (0x4E) |
// Baud Rate BR2 BR1 BR0 |
#define Wi232_2400 Baud_2400 // 0 0 0* (default 2400) |
#define Wi232_9600 Baud_9600 // 0 0 1 |
#define Wi232_19200 Baud_19200 // 0 1 0 |
#define Wi232_38400 Baud_38400 // 0 1 1 |
#define Wi232_57600 Baud_57600 // 1 0 0 ## MK ## |
#define Wi232_115200 Baud_115200 // 1 0 1 |
#define Wi232_10400 0x06 // 1 1 0 |
#define Wi232_31250 0x07 // 1 1 1 |
// NetworkMode |
// regNVNETMODE (0x04) regNETMODE (0x4F) |
#define NetMode_Slave 0x00 // Slavemode |
#define NetMode_Normal 0x01 // Normalmode (default) |
// Transmit Wait Timeout |
// regNVTXTO (0x05) regTXTO (0x50) |
#define TWaitTimeFull 0x00 // full Buffer required |
#define TWaitTime16 0x10 // 16 ms Delay (default) |
// Network Group |
// regNVNETGRP (0x06) regNETGRP (0x51) |
#define NetWorkGroup 66 // default = 0, valid 0-127 ## MK = 66 ## |
// CRC Control |
// regNVUSECRC (0x08) regUSECRC (0x53) |
#define CRC_Disable 0x00 // no CRC check |
#define CRC_Enable 0x01 // CRC check (default) |
// UART minimum transmission unit |
// regNVUARTMTU (0x09) regUARTMTU (0x54) |
#define UartMTU64 64 // default=64, valid 1-144 |
// Verbose mode |
// regNVSHOWVER (0x0A) |
#define ShowVers_Dis 0x00 // do not show Startupmessage ## MK = 66 ## |
#define ShowVers_En 0x01 // show Startupmessage (default) |
// CSMA enable |
// regNVCSMAMODE (0x0B) regCSMAMODE (0x56) |
#define CSMA_Dis 0x00 // disable CSMA Carrier-sense multiple access |
#define CSMA_En 0x01 // enable CSMA (default) |
// Sleep control |
// regNVSLPMODE (0x0D) regSLPMODE (0x58) |
#define Sleep_Awake 0x00 // Sleepmode = Awake (default) |
#define Sleep 0x01 // Sleepmode = Sleep |
#define Sleep_Stby 0x02 // Sleepmode = Standby |
// ACK on Wake |
// regNVACKONWAKE (0x0D) regACKONWAKE (0x59) |
#define ACKwake_Dis 0x00 // disable ACK on Wake |
#define ACKwake_En 0x01 // enable ACK on Wake (default) |
#endif // WI232_H_ |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/Transportables_Koptertool/branch/PKT/branch/GPL_PKT_V3_6_7f_FC090b |
---|
Property changes: |
Added: svn:ignore |
+Debug |
+ |
+Koptertool 3.9 |
+ |
+Resourcen |
+ |
+PKT3.6.7f.zip |
+ |
+PKT367d.zip |