Skip to content

Commit

Permalink
Merge pull request #88 from Lyr3x/refactor-configuration
Browse files Browse the repository at this point in the history
Add Zone and Configuration
  • Loading branch information
Lyr3x authored Jan 15, 2022
2 parents 4a64a17 + 8e1c403 commit 9a6a04b
Show file tree
Hide file tree
Showing 24 changed files with 1,940 additions and 1,327 deletions.
137 changes: 137 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
Language: Cpp
AccessModifierOffset: -1
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: DontAlign
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: MultiLine
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Attach
BreakBeforeInheritanceComma: false
BreakInheritanceList: BeforeColon
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeColon
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 120
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^<ext/.*\.h>'
Priority: 2
- Regex: '^<.*\.h>'
Priority: 1
- Regex: '^<.*'
Priority: 2
- Regex: '.*'
Priority: 3
IncludeIsMainRegex: '([-_](test|unittest))?$'
IndentCaseLabels: true
IndentPPDirectives: None
IndentWidth: 2
IndentWrappedFunctionNames: false
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 1
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 2000
PointerAlignment: Right
RawStringFormats:
- Language: Cpp
Delimiters:
- cc
- CC
- cpp
- Cpp
- CPP
- 'c++'
- 'C++'
CanonicalDelimiter: ''
BasedOnStyle: google
- Language: TextProto
Delimiters:
- pb
- PB
- proto
- PROTO
EnclosingFunctions:
- EqualsProto
- EquivToProto
- PARSE_PARTIAL_TEXT_PROTO
- PARSE_TEST_PROTO
- PARSE_TEXT_PROTO
- ParseTextOrDie
- ParseTextProtoOrDie
CanonicalDelimiter: ''
BasedOnStyle: google
ReflowComments: true
SortIncludes: false
SortUsingDeclarations: false
SpaceAfterCStyleCast: true
SpaceAfterTemplateKeyword: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
SpacesInAngles: false
SpacesInContainerLiterals: false
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Auto
TabWidth: 2
UseTab: Never
11 changes: 4 additions & 7 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,13 @@ jobs:
uses: actions/setup-python@master
with:
python-version: '3.x'
- name: Install Platform IO
- name: Install ESPHome
run: |
python -m pip install --upgrade pip
pip install -U esphome
- name: Validate ESP8266 Config
run: esphome config peopleCounter.yaml
- name: Build ESP8266
run: esphome compile peopleCounter.yaml
pip install -U pillow
- name: Validate ESP32 Config
run: esphome config peopleCounter32.yaml
run: esphome config peopleCounter32Dev.yaml
- name: Build ESP32
run: esphome compile peopleCounter32.yaml
run: esphome compile peopleCounter32Dev.yaml

1 change: 1 addition & 0 deletions Documents/Roode.drawio
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<mxfile host="app.diagrams.net" modified="2022-01-01T23:22:03.972Z" agent="5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36" etag="PNkA6cBDneeHHznyMX9h" version="16.1.2" type="device"><diagram name="Page-1" id="c4acf3e9-155e-7222-9cf6-157b1a14988f">7ZpdT9swFIZ/TS6Z8tH045IUyqSBmFqJXbuJm1g4duS4pOXX7zixk4YUUSag2RZUofj18bF9/Ng5mFrePN3dCJQldzzC1HLtaGd5V5brzkZj+K2EfSX401klxIJEleQ0woo8Yy3aWt2SCOctQ8k5lSRriyFnDIeypSEheNE223Da7jVDMe4IqxDRrvqLRDKp1KlvN/p3TOLE9OzYumaNwsdY8C3T/THOcFWTIuNGm+YJinhxIHnXljcXnMvqKd3NMVVRNRGr2i1eqa2HLDCTJzWYoHCN/Mloin1vNl5fmIE9IbrVcVhyWFk9XLk30ckLklIEE/OCRKYURAceN5zJlTayoRwmhEa3aM+3aji5hMiYUpBwQZ7BHpnGUC2k5sAdK2+E0jmnXIBQBvGw0Uo5090InEOzn2baTi3dolyaoXBKUZaTdTk4ZZIiERMWcCl5qo3MrBYHPVuutyl/lFe1qjgy1mb1Kv8pCfUzRWtMgxqDF3PIpeCPNVMmbAuUEqq2ygMWEWLIRLOKh6PcIkpiBoUQponBYdBdbk3AExYS7w4kvfw3mKdYij2Y6NqJX7XQm3Sq179oiHfGWkvatOudpndZXHtucIMHTdyp9Dkd+iw3UJuXYLV7L9UZsM+6NMJkZZvEKsgvIn8EKBNTijfKgwocgTPgUsuSZ8pZhkLC4tvS5mrUKEsdESUVCZF4BboaUwFHImgc/G1oyUhCogizkiGJJFrXeyTjhMkyin4AH4jr3P7mWz7Maw5lpynDR5kLOecM5odIueoYGC+w4vwYD69u8LcJ0Ui449OQMHYfS8RoIKJ3RPjuOYkYD0T0jojJ9IxEeN2cBSa/IfFWIEk4G3KXfzR3qbOVj0xedG9L+JMCsRgC/q7u7BOgRxQiwJDEgQpw3mG/nugfbochifrsA9L7u5Iozx2I6B0RZ02iPG8gondEfGUSdTN62Dw6i/DH/ez+OclTvxgtL7ovjvsMVznU3XAH1Os8qkPZkdTq1Dsg1/vKS6CjJA4vrA84nt5g4vUjoBdZzNHhDa+tXnLxlbnM0eENt4S95OLsGY0/ZDT/ZUbz8qqmBynNcG19piPK73dKMxm46CMXZ09ppgMXfeTiE1MaKDbf/Kn+E9B8scq7/g0=</diagram></mxfile>
51 changes: 51 additions & 0 deletions Documents/diagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
@startuml
class Roode {
+ void setup()
+ void update()
+ void loop()
+ void dump_config()
+ void getZoneDistance()
+ void sendCounter(uint16_t counter)
+ void recalibration()
+ bool handleSensorStatus()
+ uint16_t getDistance()
+ VL53L1_Error sensor_status = VL53L1_ERROR_NONE
+ VL53L1_Error last_sensor_status = VL53L1_ERROR_NONE
# VL53L1X_ULD distanceSensor
}

class Configuration {
+ Zone getZoneConfigraution(uint8_t zone)
+ int getTimingBudget()
# void setCorrectDistanceSettings(float average_entry_zone_distance, float average_exit_zone_distance)
# void publishSensorConfiguration(int DIST_THRESHOLD_ARR[2], bool isMax)
# void setSensorMode(int sensor_mode, int timing_budget = 0)
}

class Zone {
+ Zone(Configuration *configuration)
+ void calibrateThreshold(VL53L1X_ULD distanceSensor)
+ void calibrateRoi(VL53L1X_ULD distanceSensor)
+ uint16_t getMaxThreshold()
+ uint16_t getMinThreshold()
+ uint16_t getROIWidth()
+ uint16_t getROIHeight()
+ uint8_t getROICenter()
# int getOptimizedValues(int *values, int sum, int size)
# int getSum(int *values, int size)
}

class PersistedNumber {
+ float get_setup_priority() const override { return setup_priority::HARDWARE; }
+ void set_restore_value(bool restore) { this->restore_value_ = restore; }
+ void setup() override;
# void control(float value) override
# bool restore_value_{false}
# ESPPreferenceObject pref_
}

Roode --> "<<instantiate>>" Configuration
Roode --> "<<instantiate>>" Zone
Roode --> "<<instantiate>>" PersistedNumber

@enduml
Loading

0 comments on commit 9a6a04b

Please sign in to comment.