Compare commits

...

3 Commits

6 changed files with 133 additions and 122 deletions

View File

@@ -9,7 +9,7 @@ namespace {
typedef void (*jmp_fn)() __attribute__((noreturn)); typedef void (*jmp_fn)() __attribute__((noreturn));
jmp_fn boot = reinterpret_cast<jmp_fn>(0x0000); jmp_fn boot = reinterpret_cast<jmp_fn>(0x0000);
jmp_fn bootloader = reinterpret_cast<jmp_fn>(0x7E00 / 2); jmp_fn bootloader = reinterpret_cast<jmp_fn>(0x7800 / 2);
} // namespace } // namespace
@@ -31,7 +31,7 @@ void Bootloader::reset()
bool Bootloader::check() bool Bootloader::check()
{ {
if (pgm_read_byte(reinterpret_cast<uint16_t>(bootloader) * 2) == 0xF8) if (pgm_read_byte(reinterpret_cast<uint16_t>(bootloader) * 2) != 0xFF)
return true; return true;
return false; return false;

View File

@@ -1,6 +1,6 @@
#pragma once #pragma once
#define F_CPU 16000000 #define F_CPU 16'000'000
#include <util/delay.h> #include <util/delay.h>
#include <stdint.h> #include <stdint.h>

View File

@@ -81,6 +81,21 @@
</ToolNumber> </ToolNumber>
<ToolName>Custom Programming Tool</ToolName> <ToolName>Custom Programming Tool</ToolName>
</custom> </custom>
<AAFDebugger>
<AAFDebugFiles>
<DebugFile>
<path>\Debug\fantemp.lss</path>
<AAFSetting>
<Label>Lss Files</Label>
<Extention>.lss</Extention>
<Regex>^\s*(?&lt;address&gt;[a-f0-9]*):\s*.*$</Regex>
<DebugEnabled>true</DebugEnabled>
<RegexGroups>address</RegexGroups>
<DebuggerExpression>$pc</DebuggerExpression>
</AAFSetting>
</DebugFile>
</AAFDebugFiles>
</AAFDebugger>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' "> <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<ToolchainSettings> <ToolchainSettings>
@@ -126,11 +141,9 @@
<avrgcccpp.compiler.warnings.AllWarnings>True</avrgcccpp.compiler.warnings.AllWarnings> <avrgcccpp.compiler.warnings.AllWarnings>True</avrgcccpp.compiler.warnings.AllWarnings>
<avrgcccpp.compiler.warnings.Pedantic>True</avrgcccpp.compiler.warnings.Pedantic> <avrgcccpp.compiler.warnings.Pedantic>True</avrgcccpp.compiler.warnings.Pedantic>
<avrgcccpp.compiler.miscellaneous.OtherFlags>-fno-threadsafe-statics -Wextra -std=c++17</avrgcccpp.compiler.miscellaneous.OtherFlags> <avrgcccpp.compiler.miscellaneous.OtherFlags>-fno-threadsafe-statics -Wextra -std=c++17</avrgcccpp.compiler.miscellaneous.OtherFlags>
<avrgcccpp.linker.general.UseVprintfLibrary>True</avrgcccpp.linker.general.UseVprintfLibrary>
<avrgcccpp.linker.libraries.Libraries> <avrgcccpp.linker.libraries.Libraries>
<ListValues> <ListValues>
<Value>libm</Value> <Value>libm</Value>
<Value>libprintf_flt</Value>
</ListValues> </ListValues>
</avrgcccpp.linker.libraries.Libraries> </avrgcccpp.linker.libraries.Libraries>
<avrgcccpp.assembler.general.IncludePaths> <avrgcccpp.assembler.general.IncludePaths>
@@ -138,7 +151,7 @@
<Value>%24(PackRepoDir)\Atmel\ATmega_DFP\1.4.346\include</Value> <Value>%24(PackRepoDir)\Atmel\ATmega_DFP\1.4.346\include</Value>
</ListValues> </ListValues>
</avrgcccpp.assembler.general.IncludePaths> </avrgcccpp.assembler.general.IncludePaths>
</AvrGccCpp> </AvrGccCpp>
</ToolchainSettings> </ToolchainSettings>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
@@ -187,11 +200,9 @@
<avrgcccpp.compiler.warnings.AllWarnings>True</avrgcccpp.compiler.warnings.AllWarnings> <avrgcccpp.compiler.warnings.AllWarnings>True</avrgcccpp.compiler.warnings.AllWarnings>
<avrgcccpp.compiler.warnings.Pedantic>True</avrgcccpp.compiler.warnings.Pedantic> <avrgcccpp.compiler.warnings.Pedantic>True</avrgcccpp.compiler.warnings.Pedantic>
<avrgcccpp.compiler.miscellaneous.OtherFlags>-fno-threadsafe-statics -Wextra -std=c++17</avrgcccpp.compiler.miscellaneous.OtherFlags> <avrgcccpp.compiler.miscellaneous.OtherFlags>-fno-threadsafe-statics -Wextra -std=c++17</avrgcccpp.compiler.miscellaneous.OtherFlags>
<avrgcccpp.linker.general.UseVprintfLibrary>True</avrgcccpp.linker.general.UseVprintfLibrary>
<avrgcccpp.linker.libraries.Libraries> <avrgcccpp.linker.libraries.Libraries>
<ListValues> <ListValues>
<Value>libm</Value> <Value>libm</Value>
<Value>libprintf_flt</Value>
</ListValues> </ListValues>
</avrgcccpp.linker.libraries.Libraries> </avrgcccpp.linker.libraries.Libraries>
<avrgcccpp.assembler.general.IncludePaths> <avrgcccpp.assembler.general.IncludePaths>
@@ -200,7 +211,7 @@
</ListValues> </ListValues>
</avrgcccpp.assembler.general.IncludePaths> </avrgcccpp.assembler.general.IncludePaths>
<avrgcccpp.assembler.debugging.DebugLevel>Default (-Wa,-g)</avrgcccpp.assembler.debugging.DebugLevel> <avrgcccpp.assembler.debugging.DebugLevel>Default (-Wa,-g)</avrgcccpp.assembler.debugging.DebugLevel>
</AvrGccCpp> </AvrGccCpp>
</ToolchainSettings> </ToolchainSettings>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@@ -2,7 +2,7 @@
#include <ctype.h> #include <ctype.h>
#include <stdint.h> #include <stdint.h>
#include <stdio.h> #include <stdlib.h>
#include <avr/pgmspace.h> #include <avr/pgmspace.h>
@@ -26,7 +26,7 @@ GF(RESET_CMD, "reset");
GF(HISTOGRAM_CMD, "histogram"); GF(HISTOGRAM_CMD, "histogram");
GF(VERSION_CMD, "version"); GF(VERSION_CMD, "version");
GF(VERSION, "1.6"); GF(VERSION, "1.7");
static inline bool substringEquals(const char *str, const ::detail::FlashString *flashStr, const size_t &size) static inline bool substringEquals(const char *str, const ::detail::FlashString *flashStr, const size_t &size)
{ {
@@ -191,11 +191,11 @@ class Terminal {
if (Controller::m_dataAvailable) { if (Controller::m_dataAvailable) {
char floatBuffer[16]; char floatBuffer[16];
sprintf(floatBuffer, "%.2f", Controller::m_adcSample); dtostrf(Controller::m_adcSample, 0, 2, floatBuffer);
m_serial << F("ADC value ...: ") << floatBuffer << F(" / 1023") << detail::ENDL; m_serial << F("ADC value ...: ") << floatBuffer << F(" / 1023") << detail::ENDL;
sprintf(floatBuffer, "%.2f", Controller::m_resistance); dtostrf(Controller::m_resistance, 0, 2, floatBuffer);
m_serial << F("Resistance ..: ") << floatBuffer << F(" Ohm") << detail::ENDL; m_serial << F("Resistance ..: ") << floatBuffer << F(" Ohm") << detail::ENDL;
sprintf(floatBuffer, "%.2f", Controller::m_temperature); dtostrf(Controller::m_temperature, 0, 2, floatBuffer);
m_serial << F("Temperature .: ") << floatBuffer << F(" C") << detail::ENDL; m_serial << F("Temperature .: ") << floatBuffer << F(" C") << detail::ENDL;
m_serial << F("Fan speed ...: ") << Controller::m_fanSpeed << F("%") << detail::ENDL; m_serial << F("Fan speed ...: ") << Controller::m_fanSpeed << F("%") << detail::ENDL;
} else { } else {
@@ -295,7 +295,7 @@ class Terminal {
m_serial << detail::ENDL; m_serial << detail::ENDL;
} }
} else { } else {
m_serial << "There is no data yet!" << detail::ENDL; m_serial << F("There is no data yet!") << detail::ENDL;
} }
} }