-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(aquadbg): another troubleshooting tool
- Loading branch information
Showing
20 changed files
with
634 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
# Configured for clang-format-9 | ||
# If You want to test some setting, try https://zed0.co.uk/clang-format-configurator/ | ||
# Integration helpers, see here: https://clang.llvm.org/docs/ClangFormat.html | ||
|
||
Language: Cpp | ||
BasedOnStyle: Google | ||
AccessModifierOffset: -4 | ||
AllowAllConstructorInitializersOnNextLine: false | ||
AllowAllArgumentsOnNextLine : false | ||
AlignAfterOpenBracket: AlwaysBreak | ||
AlignConsecutiveAssignments: true | ||
AlignConsecutiveDeclarations: true | ||
AlignEscapedNewlines: Left | ||
AlignOperands: true | ||
AlignTrailingComments: true | ||
AlignConsecutiveMacros: true | ||
AllowAllParametersOfDeclarationOnNextLine: false | ||
AllowShortBlocksOnASingleLine: false | ||
AllowShortCaseLabelsOnASingleLine: false | ||
AllowShortFunctionsOnASingleLine: None | ||
AllowShortIfStatementsOnASingleLine: false | ||
AllowShortLoopsOnASingleLine: false | ||
AlwaysBreakAfterDefinitionReturnType: None | ||
AlwaysBreakAfterReturnType: None | ||
AlwaysBreakBeforeMultilineStrings: false | ||
AlwaysBreakTemplateDeclarations: true | ||
BinPackArguments: false | ||
BinPackParameters: false | ||
BreakBeforeBraces: Custom | ||
BraceWrapping: | ||
AfterClass: true | ||
AfterControlStatement: true | ||
AfterEnum: true | ||
AfterFunction: true | ||
AfterNamespace: true | ||
AfterObjCDeclaration: false | ||
AfterStruct: true | ||
AfterUnion: true | ||
AfterExternBlock: false | ||
BeforeCatch: true | ||
BeforeElse: true | ||
IndentBraces: false | ||
SplitEmptyFunction: true | ||
SplitEmptyRecord: true | ||
SplitEmptyNamespace: true | ||
AfterCaseLabel: true | ||
BreakBeforeBinaryOperators: NonAssignment | ||
BreakBeforeInheritanceComma: false | ||
BreakBeforeTernaryOperators: true | ||
BreakConstructorInitializers: BeforeComma | ||
BreakAfterJavaFieldAnnotations: false | ||
BreakStringLiterals: true | ||
BreakInheritanceList: BeforeComma | ||
ColumnLimit: 119 | ||
CompactNamespaces: false | ||
ConstructorInitializerAllOnOneLineOrOnePerLine: true | ||
ConstructorInitializerIndentWidth: 4 | ||
ContinuationIndentWidth: 8 | ||
Cpp11BracedListStyle: false | ||
DerivePointerAlignment: false | ||
DisableFormat: false | ||
ExperimentalAutoDetectBinPacking: false | ||
FixNamespaceComments: true | ||
ForEachMacros: | ||
- foreach | ||
- Q_FOREACH | ||
- BOOST_FOREACH | ||
- std::for_each | ||
IncludeBlocks: Regroup | ||
IncludeCategories: | ||
|
||
- Regex: '^<(gmock|gtest|Poco|rapidjson|eb)\/([A-Z0-9.\/-_])+' | ||
Priority: 4 | ||
|
||
- Regex: '^<([A-Z0-9\/-_])+>' | ||
Priority: 3 | ||
|
||
- Regex: '^<.*/.*\.hpp>' | ||
Priority: 5 | ||
|
||
- Regex: '^<.*.h>' | ||
Priority: 1 | ||
|
||
- Regex: '^<.*/.*\.h>' | ||
Priority: 2 | ||
|
||
- Regex: '^".*/.*\.hpp"' | ||
Priority: 6 | ||
|
||
- Regex: '^"([A-Z0-9.-_])+"' | ||
Priority: 7 | ||
|
||
IncludeIsMainRegex: '(_test)?$' | ||
IndentCaseLabels: true | ||
IndentPPDirectives: AfterHash | ||
IndentWidth: 4 | ||
IndentWrappedFunctionNames: true | ||
JavaScriptQuotes: Leave | ||
JavaScriptWrapImports: true | ||
KeepEmptyLinesAtTheStartOfBlocks: true | ||
MacroBlockBegin: '' | ||
MacroBlockEnd: '' | ||
MaxEmptyLinesToKeep: 1 | ||
NamespaceIndentation: None | ||
ObjCBlockIndentWidth: 4 | ||
ObjCSpaceAfterProperty: false | ||
ObjCSpaceBeforeProtocolList: false | ||
PointerAlignment: Left | ||
RawStringFormats: | ||
- Language: TextProto | ||
BasedOnStyle: google | ||
Delimiters: - pb | ||
ReflowComments: true | ||
SortIncludes: true | ||
SortUsingDeclarations: true | ||
SpaceAfterCStyleCast: true | ||
SpaceAfterTemplateKeyword: true | ||
SpaceBeforeAssignmentOperators: true | ||
SpaceBeforeParens: ControlStatements | ||
SpaceInEmptyParentheses: false | ||
SpacesBeforeTrailingComments: 2 | ||
SpacesInAngles: false | ||
SpacesInContainerLiterals: false | ||
SpacesInCStyleCastParentheses: false | ||
SpacesInParentheses: false | ||
SpacesInSquareBrackets: false | ||
Standard: Cpp11 | ||
TabWidth: 4 | ||
UseTab: Never | ||
|
||
PenaltyBreakAssignment: 200 | ||
PenaltyBreakBeforeFirstCallParameter: 1 | ||
PenaltyBreakComment: 300 | ||
PenaltyBreakFirstLessLess: 120 | ||
PenaltyBreakString: 1000 | ||
PenaltyExcessCharacter: 1000000 | ||
PenaltyReturnTypeOnItsOwnLine: 200 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.pio | ||
include/config/CustomConfiguration.h |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# AquaDebug | ||
|
||
AquaDebug is a simple serial bus debugging application meant to be flashed on the AquaMQTT Board for troubleshooting the | ||
heat-pumps serial protocol. | ||
|
||
- AquaDebug is sniffing the serial protocol without altering or interpreting any data | ||
- AquaDebug expects the AquaMQTT Board to be configured as LISTENER | ||
- AquaDebug reads the heat-pumps serial protocol and provides raw data to MQTT | ||
- A python script running on any machine collects the data from MQTT and writes the data into files | ||
|
||
In case you suspect that your heat-pump is incompatible with the existing AquaMQTT implementation, due to a different | ||
protocol, CRC or any other reason, you may try AquaDebug and provide a trace from your heat-pump communication as an | ||
github issue. | ||
|
||
## Getting Started | ||
|
||
Refer to the [AquaMQTT README](./../../AquaMQTT/README.md) for installation and configuration instructions. | ||
|
||
## Debugging / Troubleshooting | ||
|
||
As soon as AquaDebug has been flashed, it will publish mqtt messages to `$prefix/aquadbg/debug` in case values have been | ||
read from the Serial port. | ||
|
||
These data is collected by a little python script and stored on your machine. | ||
|
||
### Create the python environment | ||
|
||
``` | ||
python3 -m venv venv | ||
source venv/bin/activate | ||
pip install paho-mqtt | ||
``` | ||
|
||
### Run the python script | ||
|
||
``` | ||
source venv/bin/activate | ||
python3 collect.py | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import os | ||
import time | ||
import datetime | ||
import paho.mqtt.client as mqtt | ||
|
||
last_payloads = {} | ||
|
||
def on_message(client, userdata, message): | ||
topic = message.topic | ||
payload = message.payload | ||
|
||
hex_file_name = topic.replace('/', '_') + '_hex.csv' | ||
dec_file_name = topic.replace('/', '_') + '_dec.csv' | ||
|
||
hex_payload = payload.decode('utf-8') | ||
|
||
if topic in last_payloads and last_payloads[topic] == hex_payload: | ||
return | ||
|
||
timestamp = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S.%f') | ||
|
||
with open(hex_file_name, 'a') as hex_file: | ||
hex_file.write(timestamp + ',' + hex_payload + '\n') | ||
|
||
dec_payload = ' '.join([str(int(payload[i:i+2], 16)) for i in range(0, len(payload), 2)]) | ||
|
||
with open(dec_file_name, 'a') as dec_file: | ||
dec_file.write(timestamp + ',' + dec_payload + '\n') | ||
|
||
last_payloads[topic] = hex_payload | ||
|
||
client = mqtt.Client() | ||
client.username_pw_set(username='your-broker-user', password='your-broker-pass') | ||
client.connect('your-broker-addr', 1883) | ||
|
||
client.subscribe('your-prefix/aquadbg/debug') | ||
|
||
client.on_message = on_message | ||
|
||
client.loop_start() | ||
|
||
while True: | ||
time.sleep(1) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#ifndef AQUAMQTT_CONFIGURATION_H | ||
#define AQUAMQTT_CONFIGURATION_H | ||
|
||
/** | ||
* Possibility to include your own configuration file (added to .gitignore) | ||
*/ | ||
//#define CUSTOM_CONFIGURATION | ||
|
||
#ifdef CUSTOM_CONFIGURATION | ||
# include "CustomConfiguration.h" | ||
#else | ||
# include "ExampleConfiguration.h" | ||
#endif | ||
|
||
namespace aquamqtt | ||
{ | ||
namespace config | ||
{ | ||
/** | ||
* Defines the network name of your esp32 device in your network | ||
*/ | ||
constexpr char networkName[] = "aquamqtt"; | ||
|
||
/** | ||
* Self explanatory internal settings: most probably you don't want to change them. | ||
*/ | ||
constexpr uint8_t WATCHDOG_TIMEOUT_S = 60; | ||
constexpr uint8_t MQTT_MAX_TOPIC_SIZE = 80; | ||
constexpr uint8_t MQTT_MAX_PAYLOAD_SIZE = 255; | ||
|
||
/** | ||
* Pin assignments for AquaMQTT Board Rev 1.0 | ||
*/ | ||
constexpr uint8_t GPIO_MAIN_RX = 2; | ||
constexpr uint8_t GPIO_MAIN_TX = 3; | ||
constexpr uint8_t GPIO_HMI_RX = 4; | ||
constexpr uint8_t GPIO_HMI_TX = 5; | ||
constexpr uint8_t GPIO_SDA_RTC = A4; | ||
constexpr uint8_t GPIO_SCL_RTC = A5; | ||
|
||
} // namespace config | ||
} // namespace aquamqtt | ||
|
||
#endif // AQUAMQTT_CONFIGURATION_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#ifndef AQUAMQTT_EXAMPLECONFIGURATION_H | ||
#define AQUAMQTT_EXAMPLECONFIGURATION_H | ||
|
||
namespace aquamqtt | ||
{ | ||
namespace config | ||
{ | ||
|
||
constexpr char ssid[] = "ExampleSSID"; | ||
constexpr char psk[] = "ExamplePSK"; | ||
constexpr char brokerAddr[] = "192.168.188.1"; | ||
constexpr uint16_t brokerPort = 1883; | ||
constexpr char brokerClientId[] = "aquamqtt"; | ||
// leave blank if your broker does not require a username/password | ||
constexpr char brokerUser[] = ""; | ||
constexpr char brokerPassword[] = ""; | ||
constexpr char mqttPrefix[] = ""; | ||
|
||
} // namespace config | ||
} // namespace aquamqtt | ||
|
||
#endif // AQUAMQTT_EXAMPLECONFIGURATION_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#ifndef AQUAMQTT_OTA_H | ||
#define AQUAMQTT_OTA_H | ||
|
||
namespace aquamqtt | ||
{ | ||
class OTAHandler | ||
{ | ||
public: | ||
OTAHandler() = default; | ||
|
||
virtual ~OTAHandler() = default; | ||
|
||
void setup(); | ||
|
||
void loop(); | ||
}; | ||
} // namespace aquamqtt | ||
|
||
#endif // AQUAMQTT_OTA_H |
Oops, something went wrong.