Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ab6c0a0828 | ||
|
|
d7ddf665ba
|
||
|
|
d7b5a679fa
|
||
|
|
aabd0f4956
|
||
|
|
c5a2b41fdb
|
||
|
|
4a99a21a21
|
||
|
|
183dd8fb0d
|
||
|
|
04297ed019
|
||
|
|
7832c1968e
|
||
|
|
e7ae3d3ee8
|
||
|
|
ccf49de07b
|
||
|
|
c90f4b843d
|
||
|
|
feff689e33
|
||
|
|
5416c3a041
|
||
|
|
b54e5ef8a5
|
||
|
|
1ec2e15de8
|
||
|
|
23dbad1a53
|
||
|
|
6d98e23202
|
||
|
|
8e48a5f4c5
|
||
|
|
bbeb1d8fab
|
||
|
|
c0d3ba51a2
|
||
|
|
7b1d31fdef | ||
|
|
0ea8767a8b
|
||
|
|
f1904e03fe
|
||
|
|
101bde7463 | ||
|
|
85fb527020
|
||
|
|
4fe99744e1
|
||
|
|
8dd68d74a6
|
||
|
|
72558f93f3
|
||
|
|
fabf38f1bc
|
||
|
|
00786c683d
|
||
|
|
c5464994ed
|
||
|
|
f1b2d085d5
|
||
|
|
ac6e59044d
|
||
|
|
3850025e63
|
||
|
|
dc5919ac6f
|
||
|
|
3e1756697f
|
||
|
|
62f73f8c6c
|
No files matched your search
+17
-11
@@ -9,16 +9,22 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Compile firmware
|
- name: Compile firmware
|
||||||
run: |
|
run: |
|
||||||
chmod +x compile-with-docker.sh
|
chmod +x compile-with-docker.sh
|
||||||
./compile-with-docker.sh
|
./compile-with-docker.sh custom
|
||||||
|
|
||||||
- name: Upload firmware artifact
|
- name: Debug files
|
||||||
uses: actions/upload-artifact@v4
|
run: ls -lah
|
||||||
with:
|
|
||||||
name: firmware-artifact
|
- name: Debug compiled firmware
|
||||||
path: compiled-firmware/f4hwn.packed.bin
|
run: ls -lah compiled-firmware
|
||||||
|
|
||||||
|
- name: Upload firmware artifact
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: firmware-artifact
|
||||||
|
path: compiled-firmware/*
|
||||||
+14
@@ -9,3 +9,17 @@ compile_commands.json
|
|||||||
.vscode
|
.vscode
|
||||||
/docs
|
/docs
|
||||||
k5_eeprom.raw
|
k5_eeprom.raw
|
||||||
|
eeprom-main-calib.bin
|
||||||
|
eeprom-mine-calib.bin
|
||||||
|
eeprom-mine-full.bin
|
||||||
|
eeprom-minede-full.bin
|
||||||
|
eeprom-minemde-full.bin
|
||||||
|
eeprom-second-calib.bin
|
||||||
|
eeprom-second-full.bin
|
||||||
|
eeprom-seconddd-calib.bin
|
||||||
|
K5TOOL.exe
|
||||||
|
K5TOOL.log
|
||||||
|
K5TOOL.log.bak
|
||||||
|
f4hwn
|
||||||
|
f4hwn.bin
|
||||||
|
f4hwn.packed.bin
|
||||||
Generated
+8
@@ -0,0 +1,8 @@
|
|||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
|
# Editor-based HTTP Client requests
|
||||||
|
/httpRequests/
|
||||||
|
# Datasource local storage ignored files
|
||||||
|
/dataSources/
|
||||||
|
/dataSources.local.xml
|
||||||
Generated
+7
@@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="DiscordProjectSettings">
|
||||||
|
<option name="show" value="ASK" />
|
||||||
|
<option name="description" value="" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
Generated
+346
@@ -0,0 +1,346 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="BackendCodeEditorSettings">
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CDeclarationWithImplicitIntType/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CommentTypo/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=ConstevalIfIsAlwaysConstant/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppAbstractClassWithoutSpecifier/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppAbstractFinalClass/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppAbstractVirtualFunctionCallInCtor/@EntryIndexedValue" value="ERROR" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppAccessSpecifierWithNoDeclarations/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppAwaiterTypeIsNotClass/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBooleanIncrementExpression/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBoostFormatBadCode/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBoostFormatLegacyCode/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBoostFormatMixedArgs/@EntryIndexedValue" value="ERROR" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBoostFormatTooFewArgs/@EntryIndexedValue" value="ERROR" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBoostFormatTooManyArgs/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppCStyleCast/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppCVQualifierCanNotBeAppliedToReference/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppClassCanBeFinal/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppClassIsIncomplete/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppClassNeedsConstructorBecauseOfUninitializedMember/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppClassNeverUsed/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppCompileTimeConstantCanBeReplacedWithBooleanConstant/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppConceptNeverUsed/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppConditionalExpressionCanBeSimplified/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppConstParameterInDeclaration/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppConstValueFunctionReturnType/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppCoroutineCallResolveError/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAArrayIndexOutOfBounds/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAConstantConditions/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAConstantFunctionResult/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAConstantParameter/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFADeletedPointer/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAEndlessLoop/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAInfiniteRecursion/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAInvalidatedMemory/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFALocalValueEscapesFunction/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFALocalValueEscapesScope/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFALoopConditionNotUpdated/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAMemoryLeak/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFANotInitializedField/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFANullDereference/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFATimeOver/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAUnreachableCode/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAUnreachableFunctionCall/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAUnreadVariable/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAUnusedValue/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeclarationHidesLocal/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeclarationHidesUncapturedLocal/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeclarationSpecifierWithoutDeclarators/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeclaratorDisambiguatedAsFunction/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeclaratorNeverUsed/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeclaratorUsedBeforeInitialization/@EntryIndexedValue" value="ERROR" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDefaultCaseNotHandledInSwitchStatement/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDefaultInitializationWithNoUserConstructor/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDefaultIsUsedAsIdentifier/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDefaultedSpecialMemberFunctionIsImplicitlyDeleted/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDefinitionsOrder/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeletingVoidPointer/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDependentTemplateWithoutTemplateKeyword/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDependentTypeWithoutTypenameKeyword/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeprecatedEntity/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeprecatedOverridenMethod/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeprecatedRegisterStorageClassSpecifier/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDereferenceOperatorLimitExceeded/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDiscardedPostfixOperatorResult/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDoxygenSyntaxError/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDoxygenUndocumentedParameter/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDoxygenUnresolvedReference/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEmptyDeclaration/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceCVQualifiersOrder/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceCVQualifiersPlacement/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceDoStatementBraces/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceForStatementBraces/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceFunctionDeclarationStyle/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceIfStatementBraces/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceNestedNamespacesStyle/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceOverridingDestructorStyle/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceOverridingFunctionStyle/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceTypeAliasCodeStyle/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceWhileStatementBraces/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEntityAssignedButNoRead/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEntityUsedOnlyInUnevaluatedContext/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnumeratorNeverUsed/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEqualOperandsInBinaryExpression/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEvaluationFailure/@EntryIndexedValue" value="ERROR" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppExplicitSpecializationInNonNamespaceScope/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppExpressionWithoutSideEffects/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppFinalFunctionInFinalClass/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppFinalNonOverridingVirtualFunction/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppForLoopCanBeReplacedWithWhile/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppForwardEnumDeclarationWithoutUnderlyingType/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppFunctionDoesntReturnValue/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppFunctionIsNotImplemented/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppFunctionResultShouldBeUsed/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppFunctionalStyleCast/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppHeaderHasBeenAlreadyIncluded/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppHiddenFunction/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppHidingFunction/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppIdenticalOperandsInBinaryExpression/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppIfCanBeReplacedByConstexprIf/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppImplicitDefaultConstructorNotAvailable/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppIncompatiblePointerConversion/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppIncompleteSwitchStatement/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppInconsistentNaming/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppIntegralToPointerConversion/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppInvalidLineContinuation/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppJoinDeclarationAndAssignment/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppLambdaCaptureNeverUsed/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppLocalVariableMayBeConst/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppLocalVariableMightNotBeInitialized/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppLocalVariableWithNonTrivialDtorIsNeverUsed/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppLongFloat/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMemberFunctionMayBeConst/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMemberFunctionMayBeStatic/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMemberInitializersOrder/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMismatchedClassTags/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMissingIncludeGuard/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMissingKeywordThrow/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppModulePartitionWithSeveralPartitionUnits/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMsExtAddressOfClassRValue/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMsExtBindingRValueToLvalueReference/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMsExtCopyElisionInCopyInitDeclarator/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMsExtDoubleUserConversionInCopyInit/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMsExtNotInitializedStaticConstLocalVar/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMsExtReinterpretCastFromNullptr/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMultiCharacterLiteral/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMultiCharacterWideLiteral/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMustBePublicVirtualToImplementInterface/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMutableSpecifierOnReferenceMember/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNoDiscardExpression/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNodiscardFunctionWithoutReturnValue/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNonExceptionSafeResourceAcquisition/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNonExplicitConversionOperator/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNonExplicitConvertingConstructor/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNonInlineFunctionDefinitionInHeaderFile/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNonInlineVariableDefinitionInHeaderFile/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNotAllPathsReturnValue/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppObjectMemberMightNotBeInitialized/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppOutParameterMustBeWritten/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppOverrideWithDifferentVisibility/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppParameterMayBeConst/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppParameterMayBeConstPtrOrRef/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppParameterNamesMismatch/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppParameterNeverUsed/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPassValueParameterByConstReference/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPointerConversionDropsQualifiers/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPointerToIntegralConversion/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPolymorphicClassWithNonVirtualPublicDestructor/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPossiblyErroneousEmptyStatements/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPossiblyUninitializedMember/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPossiblyUnintendedObjectSlicing/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrecompiledHeaderIsNotIncluded/@EntryIndexedValue" value="ERROR" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrecompiledHeaderNotFound/@EntryIndexedValue" value="ERROR" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrintfBadFormat/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrintfExtraArg/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrintfMissedArg/@EntryIndexedValue" value="ERROR" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrintfRiskyFormat/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrivateSpecialMemberFunctionIsNotImplemented/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRangeBasedForIncompatibleReference/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedefinitionOfDefaultArgumentInOverrideFunction/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantAccessSpecifier/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantBaseClassAccessSpecifier/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantBaseClassInitializer/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantBooleanExpressionArgument/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantCastExpression/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantComplexityInComparison/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantConditionalExpression/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantConstSpecifier/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantControlFlowJump/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantDereferencingAndTakingAddress/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantElaboratedTypeSpecifier/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantElseKeyword/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantElseKeywordInsideCompoundStatement/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantEmptyDeclaration/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantEmptyStatement/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantExportKeyword/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantFwdClassOrEnumSpecifier/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantInlineSpecifier/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantLambdaParameterList/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantMemberInitializer/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantNamespaceDefinition/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantParentheses/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantQualifier/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantQualifierADL/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantStaticSpecifierOnMemberAllocationFunction/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantStaticSpecifierOnThreadLocalLocalVariable/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantTemplateArguments/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantTemplateKeyword/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantTypenameKeyword/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantVoidArgumentList/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantZeroInitializerInAggregateInitialization/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppReinterpretCastFromVoidPtr/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRemoveRedundantBraces/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppReplaceMemsetWithZeroInitialization/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppReplaceTieWithStructuredBinding/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppReturnNoValueInNonVoidFunction/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppSmartPointerVsMakeFunction/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppSomeObjectMembersMightNotBeInitialized/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppSpecialFunctionWithoutNoexceptSpecification/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppStaticAssertFailure/@EntryIndexedValue" value="ERROR" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppStaticDataMemberInUnnamedStruct/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppStaticSpecifierOnAnonymousNamespaceMember/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppStringLiteralToCharPointerConversion/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTabsAreDisallowed/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTemplateArgumentsCanBeDeduced/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTemplateParameterNeverUsed/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTemplateParameterShadowing/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppThrowExpressionCanBeReplacedWithRethrow/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTooWideScope/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTooWideScopeInitStatement/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTypeAliasNeverUsed/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUninitializedDependentBaseClass/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUninitializedNonStaticDataMember/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnionMemberOfReferenceType/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnmatchedPragmaEndRegionDirective/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnmatchedPragmaRegionDirective/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnnamedNamespaceInHeaderFile/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnnecessaryWhitespace/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnsignedZeroComparison/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnusedIncludeDirective/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseAlgorithmWithCount/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseAssociativeContains/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseAuto/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseAutoForNumeric/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseElementsView/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseEraseAlgorithm/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseFamiliarTemplateSyntaxForGenericLambdas/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseRangeAlgorithm/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseStdSize/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseStructuredBinding/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseTypeTraitAlias/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUserDefinedLiteralSuffixDoesNotStartWithUnderscore/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUsingResultOfAssignmentAsCondition/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppVariableCanBeMadeConstexpr/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppVirtualFunctionCallInsideCtor/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppVirtualFunctionInFinalClass/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppVolatileParameterInDeclaration/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppWarningDirective/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppWrongIncludesOrder/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppWrongSlashesInIncludeDirective/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppZeroConstantCanBeReplacedWithNullptr/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppZeroValuedExpressionUsedAsNullPointer/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=IdentifierTypo/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=IfStdIsConstantEvaluatedCanBeReplaced/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=StdIsConstantEvaluatedWillAlwaysEvaluateToConstant/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=StringLiteralTypo/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppClangFormat/EnableClangFormatSupport/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_ARGUMENT/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_BINARY_EXPRESSIONS_CHAIN/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_CALLS_CHAIN/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_EXPRESSION/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_EXTENDS_LIST/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_FOR_STMT/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_PARAMETER/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_TYPE_ARGUMENT/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_TYPE_PARAMETER/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTIPLE_DECLARATION/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_TERNARY/@EntryValue" value="ALIGN_ALL" type="string" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ANONYMOUS_METHOD_DECLARATION_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/BLANK_LINES_AROUND_CLASS_DEFINITION/@EntryValue" value="1" type="int" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/BLANK_LINES_AROUND_DECLARATIONS/@EntryValue" value="0" type="int" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/BLANK_LINES_AROUND_FUNCTION_DECLARATION/@EntryValue" value="1" type="int" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/BLANK_LINES_AROUND_FUNCTION_DEFINITION/@EntryValue" value="1" type="int" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/BREAK_TEMPLATE_DECLARATION/@EntryValue" value="LINE_BREAK" type="string" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/CASE_BLOCK_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/CONTINUOUS_LINE_INDENT/@EntryValue" value="Double" type="string" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_ACCESS_SPECIFIERS_FROM_CLASS/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_CASE_FROM_SWITCH/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_CLASS_MEMBERS_FROM_ACCESS_SPECIFIERS/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_COMMENT/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_SIZE/@EntryValue" value="4" type="int" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_STYLE/@EntryValue" value="Space" type="string" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INITIALIZER_BRACES/@EntryValue" value="END_OF_LINE_NO_SPACE" type="string" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INT_ALIGN_EQ/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INVOCABLE_DECLARATION_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/KEEP_BLANK_LINES_IN_CODE/@EntryValue" value="2" type="int" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/KEEP_BLANK_LINES_IN_DECLARATIONS/@EntryValue" value="2" type="int" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/KEEP_USER_LINEBREAKS/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/LINE_BREAK_AFTER_COLON_IN_MEMBER_INITIALIZER_LISTS/@EntryValue" value="ON_SINGLE_LINE" type="string" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/MEMBER_INITIALIZER_LIST_STYLE/@EntryValue" value="DO_NOT_CHANGE" type="string" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/NAMESPACE_DECLARATION_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/NAMESPACE_INDENTATION/@EntryValue" value="All" type="string" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/OTHER_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/PLACE_CATCH_ON_NEW_LINE/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/PLACE_ELSE_ON_NEW_LINE/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/PLACE_NAMESPACE_DEFINITIONS_ON_SAME_LINE/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/PLACE_WHILE_ON_NEW_LINE/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SIMPLE_BLOCK_STYLE/@EntryValue" value="DO_NOT_CHANGE" type="string" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_CAST_EXPRESSION_PARENTHESES/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_COLON_IN_BITFIELD_DECLARATOR/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_COMMA_IN_TEMPLATE_ARGS/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_COMMA_IN_TEMPLATE_PARAMS/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_EXTENDS_COLON/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_FOR_COLON/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_FOR_SEMICOLON/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_PTR_IN_DATA_MEMBER/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_PTR_IN_DATA_MEMBERS/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_PTR_IN_METHOD/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_PTR_IN_NESTED_DECLARATOR/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_REF_IN_DATA_MEMBER/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_REF_IN_DATA_MEMBERS/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_REF_IN_METHOD/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_UNARY_OPERATOR/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_COLON_IN_BITFIELD_DECLARATOR/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_EXTENDS_COLON/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_FOR_COLON/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_FOR_SEMICOLON/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_PTR_IN_ABSTRACT_DECL/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_PTR_IN_DATA_MEMBER/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_PTR_IN_DATA_MEMBERS/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_PTR_IN_METHOD/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_REF_IN_ABSTRACT_DECL/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_REF_IN_DATA_MEMBER/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_REF_IN_DATA_MEMBERS/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_REF_IN_METHOD/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_TEMPLATE_ARGS/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_TEMPLATE_PARAMS/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BETWEEN_CLOSING_ANGLE_BRACKETS_IN_TEMPLATE_ARGS/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_ARRAY_ACCESS_BRACKETS/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_CAST_EXPRESSION_PARENTHESES/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_DECLARATION_PARENTHESES/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_EMPTY_BLOCKS/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_EMPTY_INITIALIZER_BRACES/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_EMPTY_METHOD_PARENTHESES/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_EMPTY_TEMPLATE_PARAMS/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_INITIALIZER_BRACES/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_TEMPLATE_ARGS/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_TEMPLATE_PARAMS/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPECIAL_ELSE_IF_TREATMENT/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/TAB_WIDTH/@EntryValue" value="4" type="int" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/TYPE_DECLARATION_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_AFTER_BINARY_OPSIGN/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_AFTER_DECLARATION_LPAR/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_AFTER_INVOCATION_LPAR/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_ARGUMENTS_STYLE/@EntryValue" value="WRAP_IF_LONG" type="string" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_BEFORE_DECLARATION_LPAR/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_BEFORE_DECLARATION_RPAR/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_BEFORE_INVOCATION_LPAR/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_BEFORE_INVOCATION_RPAR/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_BEFORE_TERNARY_OPSIGNS/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_PARAMETERS_STYLE/@EntryValue" value="WRAP_IF_LONG" type="string" />
|
||||||
|
<option name="/Default/CodeStyle/EditorConfig/EnableClangFormatSupport/@EntryValue" value="false" type="bool" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
Generated
+18
@@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||||
|
<component name="MakefileSettings">
|
||||||
|
<option name="linkedExternalProjectsSettings">
|
||||||
|
<MakefileProjectSettings>
|
||||||
|
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||||
|
<option name="modules">
|
||||||
|
<set>
|
||||||
|
<option value="$PROJECT_DIR$" />
|
||||||
|
</set>
|
||||||
|
</option>
|
||||||
|
<option name="version" value="2" />
|
||||||
|
</MakefileProjectSettings>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
<component name="MakefileWorkspace" PROJECT_DIR="$PROJECT_DIR$" />
|
||||||
|
</project>
|
||||||
Generated
+6
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
@@ -11,13 +11,27 @@ ENABLE_NOAA ?= 0
|
|||||||
ENABLE_VOICE ?= 0
|
ENABLE_VOICE ?= 0
|
||||||
ENABLE_VOX ?= 0
|
ENABLE_VOX ?= 0
|
||||||
ENABLE_ALARM ?= 0
|
ENABLE_ALARM ?= 0
|
||||||
ENABLE_TX1750 ?= 1
|
ENABLE_TX1750 ?= 0
|
||||||
ENABLE_PWRON_PASSWORD ?= 0
|
ENABLE_PWRON_PASSWORD ?= 0
|
||||||
ENABLE_DTMF_CALLING ?= 0
|
|
||||||
ENABLE_FLASHLIGHT ?= 1
|
ENABLE_FLASHLIGHT ?= 1
|
||||||
|
|
||||||
|
# Bandscope edition: make BANDSCOPE=1
|
||||||
|
# The spectrum and the FM radio do not fit in the flash together, so this build
|
||||||
|
# swaps the FM radio for the spectrum (and drops the POCSAG debug log).
|
||||||
|
ifeq ($(BANDSCOPE),1)
|
||||||
|
ENABLE_SPECTRUM := 1
|
||||||
|
ENABLE_FMRADIO := 0
|
||||||
|
ENABLE_POCSAG_DEBUG := 0
|
||||||
|
EXTRA_CFLAGS += -finline-limit=1
|
||||||
|
endif
|
||||||
|
|
||||||
# ---- CUSTOM MODS ----
|
# ---- CUSTOM MODS ----
|
||||||
ENABLE_SPECTRUM ?= 1
|
ENABLE_SPECTRUM ?= 0
|
||||||
|
# ---- BRN-POCSAG components ----
|
||||||
|
ENABLE_POCSAG ?= 1
|
||||||
|
ENABLE_POCSAG_DEBUG ?= 1
|
||||||
|
ENABLE_POCSAG_DEV_TUNING ?= 0
|
||||||
|
ENABLE_OOK_SENDER ?= 1
|
||||||
ENABLE_BIG_FREQ ?= 0
|
ENABLE_BIG_FREQ ?= 0
|
||||||
ENABLE_SMALL_BOLD ?= 0
|
ENABLE_SMALL_BOLD ?= 0
|
||||||
ENABLE_CUSTOM_MENU_LAYOUT ?= 1
|
ENABLE_CUSTOM_MENU_LAYOUT ?= 1
|
||||||
@@ -38,7 +52,7 @@ ENABLE_AUDIO_BAR ?= 1
|
|||||||
ENABLE_COPY_CHAN_TO_VFO ?= 1
|
ENABLE_COPY_CHAN_TO_VFO ?= 1
|
||||||
ENABLE_REDUCE_LOW_MID_TX_POWER ?= 1
|
ENABLE_REDUCE_LOW_MID_TX_POWER ?= 1
|
||||||
ENABLE_BYP_RAW_DEMODULATORS ?= 1
|
ENABLE_BYP_RAW_DEMODULATORS ?= 1
|
||||||
ENABLE_BLMIN_TMP_OFF ?= 1
|
ENABLE_BLMIN_TMP_OFF ?= 0
|
||||||
ENABLE_SCAN_RANGES ?= 1
|
ENABLE_SCAN_RANGES ?= 1
|
||||||
ENABLE_FEAT_F4HWN ?= 1
|
ENABLE_FEAT_F4HWN ?= 1
|
||||||
ENABLE_FEAT_F4HWN_SCREENSHOT ?= 0
|
ENABLE_FEAT_F4HWN_SCREENSHOT ?= 0
|
||||||
@@ -47,9 +61,8 @@ ENABLE_FEAT_F4HWN_RX_TX_TIMER ?= 0
|
|||||||
ENABLE_FEAT_F4HWN_CHARGING_C ?= 0
|
ENABLE_FEAT_F4HWN_CHARGING_C ?= 0
|
||||||
ENABLE_FEAT_F4HWN_SLEEP ?= 1
|
ENABLE_FEAT_F4HWN_SLEEP ?= 1
|
||||||
ENABLE_FEAT_F4HWN_RESUME_STATE ?= 1
|
ENABLE_FEAT_F4HWN_RESUME_STATE ?= 1
|
||||||
ENABLE_FEAT_F4HWN_NARROWER ?= 1
|
ENABLE_FEAT_F4HWN_INV ?= 1
|
||||||
ENABLE_FEAT_F4HWN_INV ?= 0
|
ENABLE_FEAT_F4HWN_CTR ?= 0
|
||||||
ENABLE_FEAT_F4HWN_CTR ?= 1
|
|
||||||
ENABLE_FEAT_F4HWN_RESCUE_OPS ?= 0
|
ENABLE_FEAT_F4HWN_RESCUE_OPS ?= 0
|
||||||
ENABLE_FEAT_F4HWN_VOL ?= 1
|
ENABLE_FEAT_F4HWN_VOL ?= 1
|
||||||
ENABLE_FEAT_F4HWN_RESET_CHANNEL ?= 0
|
ENABLE_FEAT_F4HWN_RESET_CHANNEL ?= 0
|
||||||
@@ -67,7 +80,7 @@ ENABLE_UART_RW_BK_REGS ?= 0
|
|||||||
# ---- COMPILER/LINKER OPTIONS ----
|
# ---- COMPILER/LINKER OPTIONS ----
|
||||||
ENABLE_CLANG ?= 0
|
ENABLE_CLANG ?= 0
|
||||||
ENABLE_SWD ?= 0
|
ENABLE_SWD ?= 0
|
||||||
ENABLE_OVERLAY ?= 0
|
ENABLE_OVERLAY ?= 1
|
||||||
ENABLE_LTO ?= 1
|
ENABLE_LTO ?= 1
|
||||||
|
|
||||||
#############################################################
|
#############################################################
|
||||||
@@ -139,6 +152,13 @@ OBJS += app/chFrScanner.o
|
|||||||
OBJS += app/common.o
|
OBJS += app/common.o
|
||||||
OBJS += app/dtmf.o
|
OBJS += app/dtmf.o
|
||||||
OBJS += app/fskmodem.o
|
OBJS += app/fskmodem.o
|
||||||
|
ifeq ($(ENABLE_POCSAG),1)
|
||||||
|
OBJS += app/pocsag.o
|
||||||
|
endif
|
||||||
|
OBJS += app/messages.o
|
||||||
|
ifeq ($(ENABLE_OOK_SENDER),1)
|
||||||
|
OBJS += app/ooksender.o
|
||||||
|
endif
|
||||||
ifeq ($(ENABLE_REGA),1)
|
ifeq ($(ENABLE_REGA),1)
|
||||||
OBJS += app/rega.o
|
OBJS += app/rega.o
|
||||||
endif
|
endif
|
||||||
@@ -177,6 +197,10 @@ OBJS += settings.o
|
|||||||
ifeq ($(ENABLE_AIRCOPY),1)
|
ifeq ($(ENABLE_AIRCOPY),1)
|
||||||
OBJS += ui/aircopy.o
|
OBJS += ui/aircopy.o
|
||||||
endif
|
endif
|
||||||
|
OBJS += ui/messages.o
|
||||||
|
ifeq ($(ENABLE_OOK_SENDER),1)
|
||||||
|
OBJS += ui/ooksender.o
|
||||||
|
endif
|
||||||
OBJS += ui/battery.o
|
OBJS += ui/battery.o
|
||||||
ifeq ($(ENABLE_FMRADIO),1)
|
ifeq ($(ENABLE_FMRADIO),1)
|
||||||
OBJS += ui/fmradio.o
|
OBJS += ui/fmradio.o
|
||||||
@@ -235,7 +259,7 @@ ifeq ($(ENABLE_FEAT_F4HWN),1)
|
|||||||
|
|
||||||
EDITION_STRING ?= Custom
|
EDITION_STRING ?= Custom
|
||||||
|
|
||||||
AUTHOR_STRING ?= $(AUTHOR_STRING_1)+$(AUTHOR_STRING_2)
|
AUTHOR_STRING ?= BRN-POCSAG
|
||||||
VERSION_STRING ?= $(VERSION_STRING_2)
|
VERSION_STRING ?= $(VERSION_STRING_2)
|
||||||
|
|
||||||
SQL_TONE ?= 550 # For SA818, use 600 and python3 sa818.py --port /dev/ttyS2 radio --frequency 434.975 --ctcss 71.9 --tail Open
|
SQL_TONE ?= 550 # For SA818, use 600 and python3 sa818.py --port /dev/ttyS2 radio --frequency 434.975 --ctcss 71.9 --tail Open
|
||||||
@@ -287,6 +311,8 @@ endif
|
|||||||
|
|
||||||
# catch any and all warnings
|
# catch any and all warnings
|
||||||
CFLAGS += -Wextra
|
CFLAGS += -Wextra
|
||||||
|
# extra compiler flags from the command line, e.g. make EXTRA_CFLAGS=-DPOCSAG_DEBUG_UART=0
|
||||||
|
CFLAGS += $(EXTRA_CFLAGS)
|
||||||
#CFLAGS += -Wpedantic
|
#CFLAGS += -Wpedantic
|
||||||
|
|
||||||
CFLAGS += -DPRINTF_INCLUDE_CONFIG_H
|
CFLAGS += -DPRINTF_INCLUDE_CONFIG_H
|
||||||
@@ -394,24 +420,26 @@ endif
|
|||||||
ifeq ($(ENABLE_REDUCE_LOW_MID_TX_POWER),1)
|
ifeq ($(ENABLE_REDUCE_LOW_MID_TX_POWER),1)
|
||||||
CFLAGS += -DENABLE_REDUCE_LOW_MID_TX_POWER
|
CFLAGS += -DENABLE_REDUCE_LOW_MID_TX_POWER
|
||||||
endif
|
endif
|
||||||
ifeq ($(ENABLE_BYP_RAW_DEMODULATORS),1)
|
|
||||||
CFLAGS += -DENABLE_BYP_RAW_DEMODULATORS
|
|
||||||
endif
|
|
||||||
ifeq ($(ENABLE_BLMIN_TMP_OFF),1)
|
ifeq ($(ENABLE_BLMIN_TMP_OFF),1)
|
||||||
CFLAGS += -DENABLE_BLMIN_TMP_OFF
|
CFLAGS += -DENABLE_BLMIN_TMP_OFF
|
||||||
endif
|
endif
|
||||||
ifeq ($(ENABLE_SCAN_RANGES),1)
|
ifeq ($(ENABLE_SCAN_RANGES),1)
|
||||||
CFLAGS += -DENABLE_SCAN_RANGES
|
CFLAGS += -DENABLE_SCAN_RANGES
|
||||||
endif
|
endif
|
||||||
ifeq ($(ENABLE_DTMF_CALLING),1)
|
|
||||||
CFLAGS += -DENABLE_DTMF_CALLING
|
|
||||||
endif
|
|
||||||
ifeq ($(ENABLE_REGA),1)
|
ifeq ($(ENABLE_REGA),1)
|
||||||
CFLAGS += -DENABLE_REGA
|
CFLAGS += -DENABLE_REGA
|
||||||
endif
|
endif
|
||||||
ifeq ($(ENABLE_AGC_SHOW_DATA),1)
|
ifeq ($(ENABLE_AGC_SHOW_DATA),1)
|
||||||
CFLAGS += -DENABLE_AGC_SHOW_DATA
|
CFLAGS += -DENABLE_AGC_SHOW_DATA
|
||||||
endif
|
endif
|
||||||
|
ifeq ($(ENABLE_POCSAG),1)
|
||||||
|
CFLAGS += -DENABLE_POCSAG
|
||||||
|
endif
|
||||||
|
CFLAGS += -DPOCSAG_DEBUG_UART=$(ENABLE_POCSAG_DEBUG) -DPOCSAG_DEVIATION_TUNING=$(ENABLE_POCSAG_DEV_TUNING)
|
||||||
|
ifeq ($(ENABLE_OOK_SENDER),1)
|
||||||
|
CFLAGS += -DENABLE_OOK_SENDER
|
||||||
|
endif
|
||||||
ifeq ($(ENABLE_FLASHLIGHT),1)
|
ifeq ($(ENABLE_FLASHLIGHT),1)
|
||||||
CFLAGS += -DENABLE_FLASHLIGHT
|
CFLAGS += -DENABLE_FLASHLIGHT
|
||||||
endif
|
endif
|
||||||
@@ -449,9 +477,6 @@ endif
|
|||||||
ifeq ($(ENABLE_FEAT_F4HWN_RESUME_STATE),1)
|
ifeq ($(ENABLE_FEAT_F4HWN_RESUME_STATE),1)
|
||||||
CFLAGS += -DENABLE_FEAT_F4HWN_RESUME_STATE
|
CFLAGS += -DENABLE_FEAT_F4HWN_RESUME_STATE
|
||||||
endif
|
endif
|
||||||
ifeq ($(ENABLE_FEAT_F4HWN_NARROWER),1)
|
|
||||||
CFLAGS += -DENABLE_FEAT_F4HWN_NARROWER
|
|
||||||
endif
|
|
||||||
ifeq ($(ENABLE_FEAT_F4HWN_INV),1)
|
ifeq ($(ENABLE_FEAT_F4HWN_INV),1)
|
||||||
CFLAGS += -DENABLE_FEAT_F4HWN_INV
|
CFLAGS += -DENABLE_FEAT_F4HWN_INV
|
||||||
endif
|
endif
|
||||||
@@ -527,7 +552,7 @@ else ifneq (,$(HAS_CRCMOD))
|
|||||||
$(info )
|
$(info )
|
||||||
else
|
else
|
||||||
ifeq ($(ENABLE_FEAT_F4HWN),1)
|
ifeq ($(ENABLE_FEAT_F4HWN),1)
|
||||||
-$(MY_PYTHON) fw-pack.py $<.bin $(AUTHOR_STRING_2) $(VERSION_STRING_2) $<.packed.bin
|
-$(MY_PYTHON) fw-pack.py $<.bin BRN-POCSAG $(VERSION_STRING_2) $<.packed.bin
|
||||||
else
|
else
|
||||||
-$(MY_PYTHON) fw-pack.py $<.bin $(AUTHOR_STRING) $(VERSION_STRING) $<.packed.bin
|
-$(MY_PYTHON) fw-pack.py $<.bin $(AUTHOR_STRING) $(VERSION_STRING) $<.packed.bin
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -24,12 +24,369 @@ Anyway, have fun.
|
|||||||
>
|
>
|
||||||
> _FR - Je recommande de sauvegarder votre eeprom avec [k5prog](https://github.com/sq5bpf/k5prog) avant de jouer avec des firmwares alternatifs. C'est un bon réflexe à avoir._
|
> _FR - Je recommande de sauvegarder votre eeprom avec [k5prog](https://github.com/sq5bpf/k5prog) avant de jouer avec des firmwares alternatifs. C'est un bon réflexe à avoir._
|
||||||
|
|
||||||
|
## User guide (this build)
|
||||||
|
|
||||||
|
This firmware is **BRN-POCSAG**: F4HWN / egzumer with POCSAG paging, SMS, an OOK remote sender and 171 memory channels. This section describes the firmware as built from this repository with the default `Makefile` options: FM broadcast radio, flashlight, UART and the F4HWN features are on; VOX, NOAA, AirCopy, alarm/1750 Hz, voice prompts and the spectrum analyser are off. The spectrum and the FM radio do not fit in the flash together: `make BANDSCOPE=1` builds the bandscope edition with the spectrum (F + 5) instead of the FM radio. If you enable or disable features, some keys and menu items change.
|
||||||
|
|
||||||
|
### Conventions
|
||||||
|
|
||||||
|
| Term | Meaning |
|
||||||
|
|---|---|
|
||||||
|
| **short** | press and release |
|
||||||
|
| **long** | press and hold for about 1 second |
|
||||||
|
| **F + key** | press and release **F** (the `#` key; an **F** appears in the status bar), then press the key |
|
||||||
|
| **SK1 / SK2** | side key 1 (upper, below PTT) / side key 2 (lower) |
|
||||||
|
| **M** | the **MENU** key |
|
||||||
|
|
||||||
|
### UI tree
|
||||||
|
|
||||||
|
```
|
||||||
|
Power on ─ Main screen (VFO A / VFO B)
|
||||||
|
├─ M ──────────────── Menu ─────── item list ── M ── value ── M (confirm) / EXIT (cancel)
|
||||||
|
├─ F + M ──────────── Messages (SMS / POCSAG)
|
||||||
|
│ ├─ M / PTT ── destination (RIC) ── M ── text ── M / PTT (send)
|
||||||
|
│ └─ * ──────── OOK sender
|
||||||
|
├─ F + 7 / long 7 ── OOK sender ── protocol list ── M ── fields ── PTT / M (send)
|
||||||
|
├─ F + 0 / long 0 ─── FM broadcast radio
|
||||||
|
├─ F + 5 ──────────── Spectrum (bandscope edition)
|
||||||
|
├─ F + 4 / long 4 ─── Frequency scanner ("close call")
|
||||||
|
├─ F + * ──────────── CTCSS / DCS scanner
|
||||||
|
├─ long * ─────────── Channel / range scan (on the main screen)
|
||||||
|
├─ * ─────────────── DTMF entry (on the main screen)
|
||||||
|
└─ long F ─────────── Keypad lock / unlock
|
||||||
|
```
|
||||||
|
|
||||||
|
### Main screen
|
||||||
|
|
||||||
|
| Key | Short | Long | F + key |
|
||||||
|
|---|---|---|---|
|
||||||
|
| **0** | type digit 0 | FM radio | FM radio |
|
||||||
|
| **1** | type digit 1 | VFO: next band. Channel: copy channel to VFO | same as long |
|
||||||
|
| **2** | type digit 2 | swap VFO A / B | same as long |
|
||||||
|
| **3** | type digit 3 | toggle VFO / channel (memory) mode | same as long |
|
||||||
|
| **4** | type digit 4 | frequency scanner | same as long |
|
||||||
|
| **5** | type digit 5 | channel: cycle the channel's scan lists (1, 2, 3 combinations). VFO: set / clear the scan range between VFO A and VFO B frequency | spectrum (bandscope edition only) |
|
||||||
|
| **6** | type digit 6 | cycle TX power | same as long |
|
||||||
|
| **7** | type digit 7 | OOK sender (the VOX key; VOX is not built) | OOK sender |
|
||||||
|
| **8** | type digit 8 | frequency reverse (swap RX / TX of a repeater pair) | backlight on demand (stays on; press again to restore) |
|
||||||
|
| **9** | type digit 9 | go to the "1 Call" channel | backlight back to the normal timer |
|
||||||
|
| **UP / DOWN** | next / previous channel or frequency step (hold to repeat) | repeat | squelch +1 / -1 |
|
||||||
|
| **M** | open the menu | programmable action (menu `ML`) | Messages screen |
|
||||||
|
| **EXIT** | delete the last typed digit; stop scanning | cancel any typed input | cancel F |
|
||||||
|
| **\*** | DTMF entry | start / stop scanning | CTCSS / DCS scanner |
|
||||||
|
| **F** | arm F for the next key | keypad lock / unlock | - |
|
||||||
|
| **SK1** | programmable (menu `F1S`, default MONI) | programmable (menu `F1L`, default NONE) | step size + |
|
||||||
|
| **SK2** | programmable (menu `F2S`, default SCAN) | programmable (menu `F2L`, default NONE) | step size - |
|
||||||
|
| **PTT** | transmit (hold, or toggle with `SPTT` = TOG) | - | transmit (cancels F) |
|
||||||
|
|
||||||
|
**Typing digits:**
|
||||||
|
- **Channel mode:** type a channel number. Three digits jump immediately; shorter numbers jump after a short pause.
|
||||||
|
- **VFO mode:** type the frequency in kHz without a decimal point; missing trailing digits become zeros. Example: `433920` → 433.920 MHz. Above 1 GHz the input has 7 digits.
|
||||||
|
|
||||||
|
**While scanning:**
|
||||||
|
|
||||||
|
| Key | Action |
|
||||||
|
|---|---|
|
||||||
|
| **0 – 5** | select the scan list: 0 = no list, 1 / 2 / 3 = list 1 / 2 / 3, 4 = lists 1+2+3, 5 = all |
|
||||||
|
| **UP / DOWN** | skip to the next channel / frequency in that direction |
|
||||||
|
| **M** short | stop scanning (resume on the found channel) |
|
||||||
|
| **M** long | exclude the current channel from this scan session |
|
||||||
|
| **EXIT** | stop scanning and go back to where the scan started |
|
||||||
|
| **long \*** | stop scanning |
|
||||||
|
|
||||||
|
**DTMF entry (after a short \*):**
|
||||||
|
- **Characters:** digits type 0–9; **M** = A, **UP** = B, **DOWN** = C, **EXIT** = D, **\*** = \*, **F** = \#.
|
||||||
|
- **SK1** deletes the last character.
|
||||||
|
- **PTT** sends the string.
|
||||||
|
|
||||||
|
**Keypad lock (long F):** while locked, every key only gives the "locked" beep, except **long F** (unlock) and **long M** (its programmable action). PTT is blocked too. Menu `KeyLck` locks the keypad automatically after a delay.
|
||||||
|
|
||||||
|
### Programmable keys (menus F1S, F1L, F2S, F2L, ML)
|
||||||
|
|
||||||
|
| Action | What it does |
|
||||||
|
|---|---|
|
||||||
|
| NONE | nothing |
|
||||||
|
| FLASH | flashlight: on → blink → SOS → off |
|
||||||
|
| PWR | cycle TX power |
|
||||||
|
| MON | monitor (open squelch) while active |
|
||||||
|
| SCAN | start / stop scanning |
|
||||||
|
| WFM | FM broadcast radio on / off |
|
||||||
|
| LOCK KEY | keypad lock |
|
||||||
|
| VFO A/B | swap VFO A / B |
|
||||||
|
| VFO MEM | toggle VFO / channel mode |
|
||||||
|
| MODE | cycle the demodulation (FM, AM, USB, …) |
|
||||||
|
| RX MOD | alternately toggle dual watch and cross band |
|
||||||
|
| PTT | toggle the PTT mode (hold / toggle) for this session |
|
||||||
|
| WIDE NAR | cycle the bandwidth (wide / narrow / narrower) |
|
||||||
|
| MUTE | mute / unmute the speaker |
|
||||||
|
|
||||||
|
### Menu
|
||||||
|
|
||||||
|
**Keys inside the menu:**
|
||||||
|
|
||||||
|
| Key | In the item list | Editing a value |
|
||||||
|
|---|---|---|
|
||||||
|
| **UP / DOWN** | previous / next item | previous / next value |
|
||||||
|
| **0 – 9** | type the item number (two digits) to jump | type the value directly |
|
||||||
|
| **M** | edit the value | confirm (some items ask twice) |
|
||||||
|
| **EXIT** | leave the menu | cancel / delete the last typed digit |
|
||||||
|
| **\*** | - | in `RCTCS` / `RDCS`: start / stop scanning the received tone / code |
|
||||||
|
| **PTT** | transmit | transmit |
|
||||||
|
| **long F** | keypad lock | keypad lock |
|
||||||
|
|
||||||
|
**Editing a channel name (`ChName`):**
|
||||||
|
1. **M** starts editing.
|
||||||
|
2. Change the character under the cursor with **UP / DOWN**, or type a digit; **\*** inserts `-`, **F** inserts a space.
|
||||||
|
3. **M** moves to the next character.
|
||||||
|
4. After the 10th character, confirm with **M**.
|
||||||
|
|
||||||
|
**All items, in menu order:**
|
||||||
|
|
||||||
|
| Item | Values | Description |
|
||||||
|
|---|---|---|
|
||||||
|
| STP | 0.01 kHz … 500 kHz | frequency step |
|
||||||
|
| PWR | <.02 W, .125, .25, .5, 1, 2, 5 W | TX power |
|
||||||
|
| RDCS | OFF, D023N … (normal and inverted) | receive DCS code |
|
||||||
|
| RCTCS | OFF, 67.0 … 254.1 Hz | receive CTCSS tone |
|
||||||
|
| TDCS | as RDCS | transmit DCS code |
|
||||||
|
| TCTCS | as RCTCS | transmit CTCSS tone |
|
||||||
|
| TxODir | OFF, +, - | repeater offset direction |
|
||||||
|
| TxOffs | frequency | repeater offset |
|
||||||
|
| WID | WIDE, NARR, NAR+, FSKQ | bandwidth. FSKQ is the FSK width: the modem sets the filter it needs (POCSAG: 25 kHz mode, 7.5 kHz filter) |
|
||||||
|
| SCR | OFF, frequency | voice scrambler |
|
||||||
|
| BusyL | OFF, ON | busy channel lockout (no TX when the channel is busy) |
|
||||||
|
| COMP | OFF, TX, RX, TX/RX | compander |
|
||||||
|
| Mod | FM, AM, USB, BYP, RAW, ALM, BEE, CTC, FSA, UN4–UN9 | demodulation. Everything after USB is an experimental raw / test mode |
|
||||||
|
| ScAdd1 / ScAdd2 / ScAdd3 | OFF, ON | channel is in scan list 1 / 2 / 3 |
|
||||||
|
| ChSave | channel number (1–171) | save the current VFO to a channel |
|
||||||
|
| ChDele | channel number | delete a channel |
|
||||||
|
| ChName | channel number | edit a channel name |
|
||||||
|
| SList | 0 no list, 1, 2, 3, 4 lists 1+2+3, 5 all | scan list used by the channel scan |
|
||||||
|
| SList1 / SList2 / SList3 | channel | browse the channels in scan list 1 / 2 / 3 |
|
||||||
|
| ScnRev | STOP, CARRIER 0.25–20 s, TIMEOUT 5 s–2 min | scan resume mode |
|
||||||
|
| F1S / F1L / F2S / F2L / ML | see *Programmable keys* | SK1 short / long, SK2 short / long, M long |
|
||||||
|
| KeyLck | OFF, 15 s … 10 min | automatic keypad lock |
|
||||||
|
| TXTime | OFF, 10 s … 15 min | transmit timeout |
|
||||||
|
| BatSav | OFF, 1:1 … 1:5 | battery saver (receiver sleep ratio). Turn it off for POCSAG / FSK receive |
|
||||||
|
| BatTxt | NONE, VLT, PRC | battery voltage / percentage in the status bar |
|
||||||
|
| Mic | 0–4 (shown in dB) | microphone gain |
|
||||||
|
| MicBar | OFF, ON | microphone level bar while transmitting |
|
||||||
|
| ChDisp | FREQ, CHNUM, NAME, NAME+FREQ | what a channel shows on the main screen |
|
||||||
|
| FSKMod | 450, 700, 1200, 2400, A1200, A2400, NOAA, PCS1200, PCS512, PCS2400 | data modem. The first seven are the SMS FSK modes; PCSxxx is POCSAG at 1200 / 512 / 2400 baud |
|
||||||
|
| FSKSRC | SMS: 0–99999999. POCSAG: 0–2097151 | this radio's address. In POCSAG modes this is its own RIC (capcode) |
|
||||||
|
| PocMon | OFF, ON | POCSAG monitor: receive, store and alert on pages for every RIC |
|
||||||
|
| BLTime | OFF, 5 s … 5 min, ON | backlight timeout |
|
||||||
|
| BLMin / BLMax | 0–9 / 1–10 | backlight dimmed / full brightness |
|
||||||
|
| BLTxRx | OFF, TX, RX, TX/RX | backlight on while transmitting / receiving |
|
||||||
|
| Beep | OFF, ON | key beep |
|
||||||
|
| Roger | OFF, RGR, MDC | end-of-transmission tone |
|
||||||
|
| STE | OFF, ON | squelch tail elimination |
|
||||||
|
| RP STE | OFF, 100 ms … 1 s | repeater squelch tail elimination |
|
||||||
|
| 1 Call | channel | channel used by long 9 |
|
||||||
|
| UPCode / DNCode | DTMF string | DTMF codes sent at the start / end of a transmission |
|
||||||
|
| PTT ID | OFF, UP CODE, DN CODE, UP+DN CODE, APOLLO | when the DTMF codes / Apollo tone are sent |
|
||||||
|
| L DTMF | OFF, ON | hear the DTMF you send (side tone) |
|
||||||
|
| D Prel | 30–990 ms | DTMF preload time |
|
||||||
|
| D Live | OFF, ON | show received DTMF live |
|
||||||
|
| RxMode | MAIN, RESP, XBAND, DMON | MAIN only, dual watch and respond, cross band, dual monitor |
|
||||||
|
| Sql | 0–9 | squelch level (also F + UP / DOWN) |
|
||||||
|
| SPTT | HOL, TOG | PTT hold to talk / toggle |
|
||||||
|
| SInv | OFF, ON | inverted display |
|
||||||
|
| STmr | OFF, ON | show the RX / TX timer |
|
||||||
|
| SOff | OFF, 1 min … 2 h | automatic power off (sleep) |
|
||||||
|
| SVol | OFF, 1–63 | audio volume gain |
|
||||||
|
| F Lock | 137-174/400-470, DIS ALL, UNL ALL | TX band lock: default bands, TX disabled everywhere, TX allowed everywhere |
|
||||||
|
| FrCali | -50 … +50 | reference crystal frequency calibration |
|
||||||
|
| BatCal | 1600–2200 | battery voltage calibration |
|
||||||
|
| BatTyp | 1600, 2200, 3500 mAh | battery type |
|
||||||
|
| Reset | VFO, ALL | reset VFO settings / everything |
|
||||||
|
|
||||||
|
### Scanners (F + 4, F + \*)
|
||||||
|
|
||||||
|
**F + 4 (frequency scanner):** hold the scanner close to a transmitter. It finds the frequency, then the tone or code.
|
||||||
|
|
||||||
|
**F + \* (CTCSS / DCS scanner):** finds the tone or code on the current frequency.
|
||||||
|
|
||||||
|
| Key | Action |
|
||||||
|
|---|---|
|
||||||
|
| **M** | after a hit: save the result. Channel mode asks for the channel number first (type it or UP / DOWN, then M); M again confirms |
|
||||||
|
| **UP / DOWN** | choose the target channel while saving |
|
||||||
|
| **0 – 9** | type the target channel number (3 digits) |
|
||||||
|
| **\*** | restart the scan |
|
||||||
|
| **EXIT** | delete a digit / leave the save prompt / leave the scanner |
|
||||||
|
|
||||||
|
### FM broadcast radio (F + 0)
|
||||||
|
|
||||||
|
| Key | Action |
|
||||||
|
|---|---|
|
||||||
|
| **0 – 9** | type a frequency (4 digits, e.g. `1043` = 104.3 MHz), or a 2-digit preset number in preset mode |
|
||||||
|
| **UP / DOWN** | tune / next preset (hold to repeat; while scanning: move the scan) |
|
||||||
|
| **M** | frequency mode: save the station to a preset (UP / DOWN chooses the slot, M confirms). Preset mode: delete the preset (M confirms) |
|
||||||
|
| **\*** short / F + \* or long \* | manual scan / automatic scan that fills the presets |
|
||||||
|
| **F + 0** or **EXIT** | leave the FM radio |
|
||||||
|
| **F + 1** | next FM band |
|
||||||
|
| **F + 3** | toggle frequency / preset mode |
|
||||||
|
| **F + 4** | toggle FM AGC |
|
||||||
|
| **F + 5** | cycle de-emphasis |
|
||||||
|
| **F + 6** | cycle stereo blend |
|
||||||
|
|
||||||
|
### Spectrum / bandscope (F + 5, bandscope edition only)
|
||||||
|
|
||||||
|
**Scanning view:**
|
||||||
|
|
||||||
|
| Key | Action |
|
||||||
|
|---|---|
|
||||||
|
| **UP / DOWN** | move the centre / start frequency |
|
||||||
|
| **1 / 7** | scan step + / - |
|
||||||
|
| **2 / 8** | frequency change step + / - (what UP / DOWN move by) |
|
||||||
|
| **3 / 9** | display dB maximum + / - |
|
||||||
|
| **4** | number of scan steps (span) |
|
||||||
|
| **5** | type a frequency (digits, \* = decimal point, M confirms, EXIT deletes / cancels) |
|
||||||
|
| **0** | cycle the listening modulation |
|
||||||
|
| **6** | cycle the listening bandwidth |
|
||||||
|
| **\* / F** | RSSI trigger level + / - |
|
||||||
|
| **SK1** | blacklist the current peak frequency |
|
||||||
|
| **SK2** | backlight on / off |
|
||||||
|
| **PTT** | listen to the peak (still view) |
|
||||||
|
| **EXIT** | leave the spectrum (settings are saved) |
|
||||||
|
|
||||||
|
**Still view (after PTT):**
|
||||||
|
|
||||||
|
| Key | Action |
|
||||||
|
|---|---|
|
||||||
|
| **UP / DOWN** | tune; with a register selected: change the register value |
|
||||||
|
| **3 / 9** | display dB maximum + / - |
|
||||||
|
| **5 / 0 / 6** | frequency input / modulation / bandwidth |
|
||||||
|
| **\* / F** | RSSI trigger level + / - |
|
||||||
|
| **M** | select the next BK4819 register to adjust (LNA, mixer, PGA, …) |
|
||||||
|
| **SK1** | monitor (open squelch) on / off |
|
||||||
|
| **SK2** | backlight on / off |
|
||||||
|
| **EXIT** | leave the register selection / back to the scanning view |
|
||||||
|
|
||||||
|
### Messages: SMS and POCSAG (F + M)
|
||||||
|
|
||||||
|
The modem in `FSKMod` decides what is sent:
|
||||||
|
- **SMS modes:** this firmware's own FSK SMS. Up to 20 characters, with acknowledgement, retries and relay.
|
||||||
|
- **PCS modes:** standard POCSAG alphanumeric pages. Up to 40 characters, to any pager or POCSAG receiver. The radio stores the last 26 messages.
|
||||||
|
|
||||||
|
**Message list:**
|
||||||
|
|
||||||
|
| Key | Action |
|
||||||
|
|---|---|
|
||||||
|
| **UP / DOWN** | previous / next page (2 messages per page, newest on the last page) |
|
||||||
|
| **M** or **PTT** | write a new message |
|
||||||
|
| **2 / 8** | only in builds with `POCSAG_DEVIATION_TUNING=1`, POCSAG modes: TX deviation + / - (a popup shows the value; not saved) |
|
||||||
|
| **\*** | OOK sender |
|
||||||
|
| **EXIT** | back to the main screen |
|
||||||
|
|
||||||
|
**Writing:**
|
||||||
|
1. **Destination:** type the address with the digits (POCSAG: the pager's RIC, 0–2097151); **EXIT** deletes a digit. **M** continues.
|
||||||
|
2. **Text:** multi-tap keys (table below). Pressing the same key again cycles through its characters; holding it cycles backwards. A different key moves to the next character. **EXIT** deletes, **long EXIT** cancels the message.
|
||||||
|
3. **M** or **PTT** sends.
|
||||||
|
|
||||||
|
| Key | Characters |
|
||||||
|
|---|---|
|
||||||
|
| 1 | `, . ? & ! space - _ 1` |
|
||||||
|
| 2 | `a b c A B C [ ] 2` |
|
||||||
|
| 3 | `d e f D E F @ % 3` |
|
||||||
|
| 4 | `g h i G H I ~ $ 4` |
|
||||||
|
| 5 | `j k l J K L \| * 5` |
|
||||||
|
| 6 | `m n o M N O { } 6` |
|
||||||
|
| 7 | `p q r s P Q R S 7` |
|
||||||
|
| 8 | `t u v T U V " ' 8` |
|
||||||
|
| 9 | `w x y z W X Y Z 9` |
|
||||||
|
| 0 | `# ( ) ; : < > / 0` |
|
||||||
|
|
||||||
|
**Receiving** happens in the background on any screen. A received message is stored, the radio jumps to the message list with a popup, the LED flashes yellow and, once the reception has ended, a double beep plays.
|
||||||
|
|
||||||
|
#### POCSAG quick start
|
||||||
|
|
||||||
|
1. `FSKMod` = **PCS1200** (or PCS512 / PCS2400, to match the network).
|
||||||
|
2. `FSKSRC` = this radio's own RIC.
|
||||||
|
3. `WID` = **FSKQ** on the VFO / channel, on the paging frequency.
|
||||||
|
4. `BatSav` = OFF and `RxMode` = MAIN, so no preamble is missed.
|
||||||
|
5. Optional: `PocMon` = ON to see pages for every RIC.
|
||||||
|
|
||||||
|
Pages are standard POCSAG alphanumeric (function 3, 576-bit preamble, two batches). They decode with multimon-ng, PDW, MMDVM / DAPNET receivers and pagers. Developers can watch receive over the programming cable (`picocom -b 38400 /dev/ttyUSB0`), which logs:
|
||||||
|
- `PS`: locked onto the preamble,
|
||||||
|
- `PF` / `PD`: capture size / raw bytes,
|
||||||
|
- `PR` / `PO` / `PX`: decoded for us / for another RIC / nothing.
|
||||||
|
|
||||||
|
Build with `-DPOCSAG_DEBUG_UART=0` to switch the log off.
|
||||||
|
|
||||||
|
### OOK sender (F + 7, long 7, or \* in the message list)
|
||||||
|
|
||||||
|
Sends 433 MHz style remote control codes (garage doors, sockets, doorbells) by keying the carrier on and off on the current VFO frequency, usually 433.920 MHz. The frequency must be TX-allowed (`F Lock`). Otherwise the radio beeps and does not transmit.
|
||||||
|
|
||||||
|
**Protocol list:** **UP / DOWN** choose, **M** selects, **EXIT** leaves.
|
||||||
|
|
||||||
|
| Protocol | Fields | Notes |
|
||||||
|
|---|---|---|
|
||||||
|
| PT2262 | Code: keys 0 / 1 / 2 (= F), up to 12 trits | classic tri-state remotes, 350 µs |
|
||||||
|
| EV1527 | ID (0–1048575), Key (0–15) | learning-code remotes, 24 bits = ID × 16 + key |
|
||||||
|
| RC-SW | Code (decimal), Bits (1–32), Proto (1–7) | the rc-switch protocols. Choosing a protocol loads its pulse length. Protocol 6 is HT6P20B |
|
||||||
|
| INTECH | ID (26 bit), Unit (0–15), On (0 / 1) | Intertechno / KlikAanKlikUit self-learning |
|
||||||
|
| MANCH | Code, Bits, Half (half-bit time in µs) | raw Manchester: 1 = on/off, 0 = off/on |
|
||||||
|
|
||||||
|
Every protocol also has **Pulse** (base pulse in µs, prefilled) and **Repeat** (default 10).
|
||||||
|
|
||||||
|
**Fields screen:**
|
||||||
|
|
||||||
|
| Key | Action |
|
||||||
|
|---|---|
|
||||||
|
| **UP / DOWN** | previous / next field (`>` marks the selected field) |
|
||||||
|
| **0 – 9** | type into the field (beeps if the value is out of range) |
|
||||||
|
| **EXIT** | delete a digit; on an empty field, back to the protocol list |
|
||||||
|
| **PTT** or **M** | send |
|
||||||
|
|
||||||
|
### Build options
|
||||||
|
|
||||||
|
**Make toggles** (`make ENABLE_POCSAG=0 …`):
|
||||||
|
|
||||||
|
| Toggle | Default | Effect |
|
||||||
|
|---|---|---|
|
||||||
|
| `ENABLE_POCSAG` | 1 | POCSAG modem modes (PCS1200 / 512 / 2400) and `PocMon`; off leaves only the SMS FSK modes |
|
||||||
|
| `ENABLE_POCSAG_DEBUG` | 1 | POCSAG receive log on the UART (off in the bandscope edition) |
|
||||||
|
| `ENABLE_POCSAG_DEV_TUNING` | 0 | keys 2 / 8 in the message list tune the POCSAG deviation |
|
||||||
|
| `ENABLE_OOK_SENDER` | 1 | OOK remote sender (F + 7, \* in the message list) |
|
||||||
|
| `BANDSCOPE` | 0 | 1 = bandscope edition: spectrum on, FM radio off; fits with only a few bytes to spare |
|
||||||
|
| `ENABLE_FMRADIO`, `ENABLE_SPECTRUM`, `ENABLE_FLASHLIGHT`, … | | the usual F4HWN / egzumer feature toggles at the top of the `Makefile` |
|
||||||
|
|
||||||
|
**Defines** (`make EXTRA_CFLAGS="-DNAME=value"`):
|
||||||
|
|
||||||
|
| Define | Default | Effect |
|
||||||
|
|---|---|---|
|
||||||
|
| `POCSAG_MAX_MESSAGE_LENGTH` | 40 | longest POCSAG message and stored message text (max 45, two batches) |
|
||||||
|
| `MESSAGES_COUNT` | as many as fit (26) | number of stored messages; the build fails if the store would reach the calibration data at `0x1E00` |
|
||||||
|
| `POCSAG_DEVIATION` | 963 | POCSAG TX deviation (REG_40) |
|
||||||
|
| `POCSAG_TONE2_GAIN` | 127 | POCSAG FSK TX level |
|
||||||
|
| `POCSAG_INVERT` | 1 | POCSAG bit polarity (1 = standard: logical 1 is the lower frequency) |
|
||||||
|
|
||||||
|
Changing `POCSAG_MAX_MESSAGE_LENGTH` or `MESSAGES_COUNT` moves the message slots in EEPROM, so messages stored before read back as garbage.
|
||||||
|
|
||||||
|
### EEPROM layout and CHIRP
|
||||||
|
|
||||||
|
This firmware reports itself as **BRN-POCSAG** and uses its own EEPROM layout, so other UV-K5 CHIRP drivers (stock, egzumer, F4HWN) do not accept it. Use `chirp/uvk5_brnpocsag.py` (CHIRP → *Help* → *Developer mode*, then *File* → *Load Module*). It covers all 171 channels, the 14 VFOs, the settings and the message store (read, edit, delete all).
|
||||||
|
|
||||||
|
| Address | Contents |
|
||||||
|
|---|---|
|
||||||
|
| `0x0000` | channels 1–114, 32 bytes each: frequency, offset, codes, flags, 10-character name, 16-bit scrambler |
|
||||||
|
| `0x0E40` | settings (FM presets, menu settings, DTMF codes, scan lists, POCSAG / SMS address) |
|
||||||
|
| `0x0F50` | channel attributes (band, compander, scan lists 1–3) |
|
||||||
|
| `0x1020` | VFOs, 7 bands × A / B |
|
||||||
|
| `0x11E0` | channels 115–171 |
|
||||||
|
| `0x1900` | message counters, then 26 messages × 48 bytes (40 characters) |
|
||||||
|
| `0x1E00` | calibration (only written with *upload calibration*); `0x1FF0` F4HWN settings (written on every upload) |
|
||||||
|
|
||||||
|
**Upgrading from an older build:** the channel layout changed (24-byte records before, 16 bytes in stock / F4HWN). Stored channels and messages from older builds do not carry over. After flashing, do a `Reset` → `ALL` (or upload a fresh CHIRP image), then program the channels again with the driver above.
|
||||||
|
|
||||||
# Donations
|
# Donations
|
||||||
|
|
||||||
Special thanks to Jean-Cyrille F6IWW (2 times), Fabrice 14RC123, David F4BPP, Olivier 14RC206, Frédéric F4ESO, Stéphane F5LGW, Jorge Ornelas (4 times), Laurent F4AXK, Christophe Morel, Clayton W0LED, Pierre Antoine F6FWB, Jean-Claude 14FRS3306, Thierry F4GVO, Eric F1NOU, PricelessToolkit, Ady M6NYJ, Tom McGovern (3 times), Joseph Roth, Pierre-Yves Colin, Frank DJ7FG, Marcel Testaz, Brian Frobisher, Yannick F4JFO, Paolo Bussola, Dirk DL8DF, Levente Szőke (2 times), Bernard-Michel Herrera, Jérôme Saintespes, Paul Davies, RS, Johan F4WAT, Robert Wörle, Rafael Sundorf, Paul Harker, Peter Fintl, Pascal F4ICR (2 times), Mike DL2MF, Eric KI1C (2 times), Phil G0ELM, Jérôme Lambert, Meinhard Frank Günther, Eliot Vedel, Alfonso EA7KDF, Jean-François F1EVM and Robert DC1RDB for their [donations](https://www.paypal.com/paypalme/F4HWN). That’s so kind of them. Thanks so much 🙏🏻
|
Special thanks to Jean-Cyrille F6IWW (2 times), Fabrice 14RC123, David F4BPP, Olivier 14RC206, Frédéric F4ESO, Stéphane F5LGW, Jorge Ornelas (4 times), Laurent F4AXK, Christophe Morel, Clayton W0LED, Pierre Antoine F6FWB, Jean-Claude 14FRS3306, Thierry F4GVO, Eric F1NOU, PricelessToolkit, Ady M6NYJ, Tom McGovern (3 times), Joseph Roth, Pierre-Yves Colin, Frank DJ7FG, Marcel Testaz, Brian Frobisher, Yannick F4JFO, Paolo Bussola, Dirk DL8DF, Levente Szőke (2 times), Bernard-Michel Herrera, Jérôme Saintespes, Paul Davies, RS, Johan F4WAT, Robert Wörle, Rafael Sundorf, Paul Harker, Peter Fintl, Pascal F4ICR (2 times), Mike DL2MF, Eric KI1C (2 times), Phil G0ELM, Jérôme Lambert, Meinhard Frank Günther, Eliot Vedel, Alfonso EA7KDF, Jean-François F1EVM and Robert DC1RDB for their [donations](https://www.paypal.com/paypalme/F4HWN). That’s so kind of them. Thanks so much 🙏🏻
|
||||||
|
|
||||||
## Table of Contents
|
## Table of Contents
|
||||||
|
|
||||||
|
* [User guide (this build)](#user-guide-this-build)
|
||||||
* [My Features](#main-features)
|
* [My Features](#main-features)
|
||||||
* [Main Features from Egzumer](#main-features-from-egzumer)
|
* [Main Features from Egzumer](#main-features-from-egzumer)
|
||||||
* [Manual](#manual)
|
* [Manual](#manual)
|
||||||
@@ -145,7 +502,6 @@ Special thanks to Jean-Cyrille F6IWW (2 times), Fabrice 14RC123, David F4BPP, Ol
|
|||||||
* no more PWM noise,
|
* no more PWM noise,
|
||||||
* and more...
|
* and more...
|
||||||
* enabled AIR COPY
|
* enabled AIR COPY
|
||||||
* disabled ENABLE_DTMF_CALLING,
|
|
||||||
* disabled SCRAMBLER,
|
* disabled SCRAMBLER,
|
||||||
* remove 200Tx, 350Tx and 500Tx,
|
* remove 200Tx, 350Tx and 500Tx,
|
||||||
* unlock TX on all bands needs only to be repeat 3 times,
|
* unlock TX on all bands needs only to be repeat 3 times,
|
||||||
|
|||||||
+14
-58
@@ -42,6 +42,9 @@
|
|||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "ui/inputbox.h"
|
#include "ui/inputbox.h"
|
||||||
#include "ui/ui.h"
|
#include "ui/ui.h"
|
||||||
|
#include "driver/st7565.h"
|
||||||
|
#include "ui/menu.h"
|
||||||
|
|
||||||
#ifdef ENABLE_REGA
|
#ifdef ENABLE_REGA
|
||||||
#include "app/rega.h"
|
#include "app/rega.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -110,7 +113,6 @@ void (*action_opt_table[])(void) = {
|
|||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN
|
#ifdef ENABLE_FEAT_F4HWN
|
||||||
[ACTION_OPT_RXMODE] = &ACTION_RxMode,
|
[ACTION_OPT_RXMODE] = &ACTION_RxMode,
|
||||||
[ACTION_OPT_MAINONLY] = &ACTION_MainOnly,
|
|
||||||
[ACTION_OPT_PTT] = &ACTION_Ptt,
|
[ACTION_OPT_PTT] = &ACTION_Ptt,
|
||||||
[ACTION_OPT_WN] = &ACTION_Wn,
|
[ACTION_OPT_WN] = &ACTION_Wn,
|
||||||
[ACTION_OPT_BACKLIGHT] = &ACTION_BackLight,
|
[ACTION_OPT_BACKLIGHT] = &ACTION_BackLight,
|
||||||
@@ -119,10 +121,6 @@ void (*action_opt_table[])(void) = {
|
|||||||
#else
|
#else
|
||||||
[ACTION_OPT_MUTE] = &FUNCTION_NOP,
|
[ACTION_OPT_MUTE] = &FUNCTION_NOP,
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
|
||||||
[ACTION_OPT_POWER_HIGH] = &ACTION_Power_High,
|
|
||||||
[ACTION_OPT_REMOVE_OFFSET] = &ACTION_Remove_Offset,
|
|
||||||
#endif
|
|
||||||
#else
|
#else
|
||||||
[ACTION_OPT_RXMODE] = &FUNCTION_NOP,
|
[ACTION_OPT_RXMODE] = &FUNCTION_NOP,
|
||||||
#endif
|
#endif
|
||||||
@@ -136,8 +134,9 @@ static_assert(ARRAY_SIZE(action_opt_table) == ACTION_OPT_LEN);
|
|||||||
|
|
||||||
void ACTION_Power(void)
|
void ACTION_Power(void)
|
||||||
{
|
{
|
||||||
if (++gTxVfo->OUTPUT_POWER > OUTPUT_POWER_HIGH)
|
gTxVfo->OUTPUT_POWER++;
|
||||||
gTxVfo->OUTPUT_POWER = OUTPUT_POWER_LOW1;
|
if (gTxVfo->OUTPUT_POWER >= ARRAY_SIZE(gSubMenu_TXP))
|
||||||
|
gTxVfo->OUTPUT_POWER = 0;
|
||||||
|
|
||||||
gRequestSaveChannel = 1;
|
gRequestSaveChannel = 1;
|
||||||
|
|
||||||
@@ -207,9 +206,6 @@ void ACTION_Scan(bool bRestart)
|
|||||||
// not scanning
|
// not scanning
|
||||||
gMonitor = false;
|
gMonitor = false;
|
||||||
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
DTMF_clear_RX();
|
|
||||||
#endif
|
|
||||||
gDTMF_RX_live_timeout = 0;
|
gDTMF_RX_live_timeout = 0;
|
||||||
memset(gDTMF_RX_live, 0, sizeof(gDTMF_RX_live));
|
memset(gDTMF_RX_live, 0, sizeof(gDTMF_RX_live));
|
||||||
|
|
||||||
@@ -440,7 +436,7 @@ static void ACTION_Scan_FM(bool bRestart)
|
|||||||
static void ACTION_AlarmOr1750(const bool b1750)
|
static void ACTION_AlarmOr1750(const bool b1750)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(gEeprom.KEY_LOCK && gEeprom.KEY_LOCK_PTT)
|
if(gEeprom.KEY_LOCK)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#if defined(ENABLE_ALARM)
|
#if defined(ENABLE_ALARM)
|
||||||
@@ -552,40 +548,12 @@ void ACTION_Ptt(void)
|
|||||||
|
|
||||||
void ACTION_Wn(void)
|
void ACTION_Wn(void)
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_FEAT_F4HWN_NARROWER
|
|
||||||
bool narrower = 0;
|
|
||||||
if (FUNCTION_IsRx())
|
if (FUNCTION_IsRx())
|
||||||
{
|
{
|
||||||
gRxVfo->CHANNEL_BANDWIDTH = (gRxVfo->CHANNEL_BANDWIDTH == 0) ? 1: 0;
|
gRxVfo->CHANNEL_BANDWIDTH++;
|
||||||
if(gRxVfo->CHANNEL_BANDWIDTH == BANDWIDTH_NARROW && gSetting_set_nfm == 1)
|
if (gRxVfo->CHANNEL_BANDWIDTH > BK4819_FILTER_BW_NARROWER) {
|
||||||
{
|
gRxVfo->CHANNEL_BANDWIDTH = BK4819_FILTER_BW_WIDE;
|
||||||
narrower = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_AM_FIX
|
|
||||||
BK4819_SetFilterBandwidth(gRxVfo->CHANNEL_BANDWIDTH + narrower, true);
|
|
||||||
#else
|
|
||||||
BK4819_SetFilterBandwidth(gRxVfo->CHANNEL_BANDWIDTH + narrower, false);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
gTxVfo->CHANNEL_BANDWIDTH = (gTxVfo->CHANNEL_BANDWIDTH == 0) ? 1: 0;
|
|
||||||
if(gTxVfo->CHANNEL_BANDWIDTH == BANDWIDTH_NARROW && gSetting_set_nfm == 1)
|
|
||||||
{
|
|
||||||
narrower = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef ENABLE_AM_FIX
|
|
||||||
BK4819_SetFilterBandwidth(gTxVfo->CHANNEL_BANDWIDTH, true);
|
|
||||||
#else
|
|
||||||
BK4819_SetFilterBandwidth(gTxVfo->CHANNEL_BANDWIDTH, false);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
if (FUNCTION_IsRx())
|
|
||||||
{
|
|
||||||
gRxVfo->CHANNEL_BANDWIDTH = (gRxVfo->CHANNEL_BANDWIDTH == 0) ? 1: 0;
|
|
||||||
#ifdef ENABLE_AM_FIX
|
#ifdef ENABLE_AM_FIX
|
||||||
BK4819_SetFilterBandwidth(gRxVfo->CHANNEL_BANDWIDTH, true);
|
BK4819_SetFilterBandwidth(gRxVfo->CHANNEL_BANDWIDTH, true);
|
||||||
#else
|
#else
|
||||||
@@ -594,14 +562,16 @@ void ACTION_Wn(void)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gTxVfo->CHANNEL_BANDWIDTH = (gTxVfo->CHANNEL_BANDWIDTH == 0) ? 1: 0;
|
gRxVfo->CHANNEL_BANDWIDTH++;
|
||||||
|
if (gRxVfo->CHANNEL_BANDWIDTH > BK4819_FILTER_BW_NARROWER) {
|
||||||
|
gRxVfo->CHANNEL_BANDWIDTH = BK4819_FILTER_BW_WIDE;
|
||||||
|
}
|
||||||
#ifdef ENABLE_AM_FIX
|
#ifdef ENABLE_AM_FIX
|
||||||
BK4819_SetFilterBandwidth(gTxVfo->CHANNEL_BANDWIDTH, true);
|
BK4819_SetFilterBandwidth(gTxVfo->CHANNEL_BANDWIDTH, true);
|
||||||
#else
|
#else
|
||||||
BK4819_SetFilterBandwidth(gTxVfo->CHANNEL_BANDWIDTH, false);
|
BK4819_SetFilterBandwidth(gTxVfo->CHANNEL_BANDWIDTH, false);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ACTION_BackLight(void)
|
void ACTION_BackLight(void)
|
||||||
@@ -657,18 +627,4 @@ void ACTION_BackLightOnDemand(void)
|
|||||||
gUpdateStatus = true;
|
gUpdateStatus = true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
|
||||||
void ACTION_Power_High(void)
|
|
||||||
{
|
|
||||||
gPowerHigh = !gPowerHigh;
|
|
||||||
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ACTION_Remove_Offset(void)
|
|
||||||
{
|
|
||||||
gRemoveOffset = !gRemoveOffset;
|
|
||||||
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
@@ -45,10 +45,6 @@ void ACTION_SwitchDemodul(void);
|
|||||||
#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
|
#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
|
||||||
void ACTION_Mute(void);
|
void ACTION_Mute(void);
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
|
||||||
void ACTION_Power_High(void);
|
|
||||||
void ACTION_Remove_Offset(void);
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void ACTION_Handle(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld);
|
void ACTION_Handle(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld);
|
||||||
|
|||||||
@@ -29,6 +29,7 @@
|
|||||||
#include "app/chFrScanner.h"
|
#include "app/chFrScanner.h"
|
||||||
#include "app/dtmf.h"
|
#include "app/dtmf.h"
|
||||||
|
|
||||||
|
#include "../ui/fmradio.h"
|
||||||
#ifdef ENABLE_FLASHLIGHT
|
#ifdef ENABLE_FLASHLIGHT
|
||||||
|
|
||||||
#include "app/flashlight.h"
|
#include "app/flashlight.h"
|
||||||
@@ -90,6 +91,10 @@
|
|||||||
#include "ui/menu.h"
|
#include "ui/menu.h"
|
||||||
#include "ui/status.h"
|
#include "ui/status.h"
|
||||||
#include "ui/ui.h"
|
#include "ui/ui.h"
|
||||||
|
#include "messages.h"
|
||||||
|
#ifdef ENABLE_OOK_SENDER
|
||||||
|
#include "ooksender.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
static bool flagSaveVfo;
|
static bool flagSaveVfo;
|
||||||
static bool flagSaveSettings;
|
static bool flagSaveSettings;
|
||||||
@@ -102,6 +107,10 @@ void (*ProcessKeysFunctions[])(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
|||||||
[DISPLAY_MAIN] = &MAIN_ProcessKeys,
|
[DISPLAY_MAIN] = &MAIN_ProcessKeys,
|
||||||
[DISPLAY_MENU] = &MENU_ProcessKeys,
|
[DISPLAY_MENU] = &MENU_ProcessKeys,
|
||||||
[DISPLAY_SCANNER] = &SCANNER_ProcessKeys,
|
[DISPLAY_SCANNER] = &SCANNER_ProcessKeys,
|
||||||
|
[DISPLAY_MESSAGES] = &MESSAGES_ProcessKeys,
|
||||||
|
#ifdef ENABLE_OOK_SENDER
|
||||||
|
[DISPLAY_OOKSENDER] = &OOKSENDER_ProcessKeys,
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_FMRADIO
|
#ifdef ENABLE_FMRADIO
|
||||||
[DISPLAY_FM] = &FM_ProcessKeys,
|
[DISPLAY_FM] = &FM_ProcessKeys,
|
||||||
@@ -183,10 +192,6 @@ static void CheckForIncoming(void) {
|
|||||||
|
|
||||||
static void HandleIncoming(void) {
|
static void HandleIncoming(void) {
|
||||||
if (!g_SquelchLost) { // squelch is closed
|
if (!g_SquelchLost) { // squelch is closed
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
if (gDTMF_RX_index > 0)
|
|
||||||
DTMF_clear_RX();
|
|
||||||
#endif
|
|
||||||
if (gCurrentFunction != FUNCTION_FOREGROUND) {
|
if (gCurrentFunction != FUNCTION_FOREGROUND) {
|
||||||
FUNCTION_Select(FUNCTION_FOREGROUND);
|
FUNCTION_Select(FUNCTION_FOREGROUND);
|
||||||
gUpdateDisplay = true;
|
gUpdateDisplay = true;
|
||||||
@@ -214,30 +219,6 @@ static void HandleIncoming(void) {
|
|||||||
} else if (!bFlag)
|
} else if (!bFlag)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
if (gScanStateDir == SCAN_OFF && (gRxVfo->DTMF_DECODING_ENABLE)) {
|
|
||||||
|
|
||||||
// DTMF DCD is enabled
|
|
||||||
DTMF_HandleRequest();
|
|
||||||
if (gDTMF_CallState == DTMF_CALL_STATE_NONE) {
|
|
||||||
if (gRxReceptionMode != RX_MODE_DETECTED) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
gDualWatchCountdown_10ms = dual_watch_count_after_1_10ms;
|
|
||||||
gScheduleDualWatch = false;
|
|
||||||
|
|
||||||
gRxReceptionMode = RX_MODE_LISTENING;
|
|
||||||
|
|
||||||
// let the user see DW is not active
|
|
||||||
gDualWatchActive = false;
|
|
||||||
gUpdateStatus = true;
|
|
||||||
|
|
||||||
gUpdateDisplay = true;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
APP_StartListening(gMonitor ? FUNCTION_MONITOR : FUNCTION_RECEIVE);
|
APP_StartListening(gMonitor ? FUNCTION_MONITOR : FUNCTION_RECEIVE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -552,7 +533,7 @@ uint32_t APP_SetFreqByStepAndLimits(VFO_Info_t *pInfo, int8_t direction, uint32_
|
|||||||
#ifdef ENABLE_FEAT_F4HWN
|
#ifdef ENABLE_FEAT_F4HWN
|
||||||
if (Frequency > upper)
|
if (Frequency > upper)
|
||||||
#else
|
#else
|
||||||
if (Frequency >= upper)
|
if (Frequency >= upper)
|
||||||
#endif
|
#endif
|
||||||
Frequency = lower;
|
Frequency = lower;
|
||||||
|
|
||||||
@@ -667,21 +648,6 @@ static void CheckRadioInterrupts(void) {
|
|||||||
gUpdateDisplay = true;
|
gUpdateDisplay = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
if (gRxVfo->DTMF_DECODING_ENABLE) {
|
|
||||||
if (gDTMF_RX_index >= sizeof(gDTMF_RX) - 1) { // make room
|
|
||||||
memmove(&gDTMF_RX[0], &gDTMF_RX[1], sizeof(gDTMF_RX) - 1);
|
|
||||||
gDTMF_RX_index--;
|
|
||||||
}
|
|
||||||
gDTMF_RX[gDTMF_RX_index++] = c;
|
|
||||||
gDTMF_RX[gDTMF_RX_index] = 0;
|
|
||||||
gDTMF_RX_timeout = DTMF_RX_timeout_500ms; // time till we delete it
|
|
||||||
gDTMF_RX_pending = true;
|
|
||||||
|
|
||||||
SYSTEM_DelayMs(3);//fix DTMF not reply@Yurisu
|
|
||||||
DTMF_HandleRequest();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -758,6 +724,7 @@ static void CheckRadioInterrupts(void) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
FSK_HANDLE_IRQ(interrupts.__raw);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -830,9 +797,6 @@ static void HandleVox(void) {
|
|||||||
FUNCTION_Select(FUNCTION_FOREGROUND);
|
FUNCTION_Select(FUNCTION_FOREGROUND);
|
||||||
|
|
||||||
if (gCurrentFunction != FUNCTION_TRANSMIT && !SerialConfigInProgress()) {
|
if (gCurrentFunction != FUNCTION_TRANSMIT && !SerialConfigInProgress()) {
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
gDTMF_ReplyState = DTMF_REPLY_NONE;
|
|
||||||
#endif
|
|
||||||
RADIO_PrepareTX();
|
RADIO_PrepareTX();
|
||||||
gUpdateDisplay = true;
|
gUpdateDisplay = true;
|
||||||
}
|
}
|
||||||
@@ -849,43 +813,6 @@ void APP_Update(void) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN
|
|
||||||
if (gCurrentFunction == FUNCTION_TRANSMIT && (gTxTimeoutReachedAlert || SerialConfigInProgress())) {
|
|
||||||
if (gSetting_set_tot >= 2) {
|
|
||||||
if (gEeprom.BACKLIGHT_TIME == 0) {
|
|
||||||
if (gBlinkCounter == 0 || gBlinkCounter == 250) {
|
|
||||||
GPIO_FlipBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (gBlinkCounter == 0) {
|
|
||||||
//BACKLIGHT_TurnOn();
|
|
||||||
BACKLIGHT_SetBrightness(gEeprom.BACKLIGHT_MAX);
|
|
||||||
} else if (gBlinkCounter == 15000) {
|
|
||||||
//BACKLIGHT_TurnOff();
|
|
||||||
BACKLIGHT_SetBrightness(gEeprom.BACKLIGHT_MIN);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
gBlinkCounter++;
|
|
||||||
|
|
||||||
if (
|
|
||||||
(gSetting_set_tot == 3 && gEeprom.BACKLIGHT_TIME != 0 && gBlinkCounter > 74000) ||
|
|
||||||
(gSetting_set_tot == 3 && gEeprom.BACKLIGHT_TIME == 0 && gBlinkCounter > 79000) ||
|
|
||||||
(gSetting_set_tot != 3 && gBlinkCounter > 76000)
|
|
||||||
) // try to calibrate 10 times
|
|
||||||
{
|
|
||||||
gBlinkCounter = 0;
|
|
||||||
|
|
||||||
if (gSetting_set_tot == 1 || gSetting_set_tot == 3) {
|
|
||||||
BK4819_DisableScramble();
|
|
||||||
BK4819_PlaySingleTone(gTxTimeoutToneAlert, 30, 1, true);
|
|
||||||
gTxTimeoutToneAlert += 100;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (gCurrentFunction == FUNCTION_TRANSMIT &&
|
if (gCurrentFunction == FUNCTION_TRANSMIT &&
|
||||||
(gTxTimeoutReached || SerialConfigInProgress())) { // transmitter timed out or must de-key
|
(gTxTimeoutReached || SerialConfigInProgress())) { // transmitter timed out or must de-key
|
||||||
gTxTimeoutReached = false;
|
gTxTimeoutReached = false;
|
||||||
@@ -969,14 +896,11 @@ void APP_Update(void) {
|
|||||||
&& gScanStateDir == SCAN_OFF
|
&& gScanStateDir == SCAN_OFF
|
||||||
&& !gPttIsPressed
|
&& !gPttIsPressed
|
||||||
&& gCurrentFunction != FUNCTION_POWER_SAVE
|
&& gCurrentFunction != FUNCTION_POWER_SAVE
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
&& gVoiceWriteIndex == 0
|
&& gVoiceWriteIndex == 0
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_FMRADIO
|
#ifdef ENABLE_FMRADIO
|
||||||
&& !gFmRadioMode
|
&& !gFmRadioMode
|
||||||
#endif
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
&& gDTMF_CallState == DTMF_CALL_STATE_NONE
|
|
||||||
#endif
|
#endif
|
||||||
) {
|
) {
|
||||||
DualwatchAlternate(); // toggle between the two VFO's
|
DualwatchAlternate(); // toggle between the two VFO's
|
||||||
@@ -1011,11 +935,8 @@ void APP_Update(void) {
|
|||||||
|| gScanStateDir != SCAN_OFF
|
|| gScanStateDir != SCAN_OFF
|
||||||
|| gCssBackgroundScan
|
|| gCssBackgroundScan
|
||||||
|| gScreenToDisplay != DISPLAY_MAIN
|
|| gScreenToDisplay != DISPLAY_MAIN
|
||||||
#ifdef ENABLE_FMRADIO
|
#ifdef ENABLE_FMRADIO
|
||||||
|| gFmRadioMode
|
|| gFmRadioMode
|
||||||
#endif
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
|| gDTMF_CallState != DTMF_CALL_STATE_NONE
|
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_NOAA
|
||||||
|| (gIsNoaaMode && (IS_NOAA_CHANNEL(gEeprom.ScreenChannel[0]) || IS_NOAA_CHANNEL(gEeprom.ScreenChannel[1])))
|
|| (gIsNoaaMode && (IS_NOAA_CHANNEL(gEeprom.ScreenChannel[0]) || IS_NOAA_CHANNEL(gEeprom.ScreenChannel[1])))
|
||||||
@@ -1168,10 +1089,9 @@ static void CheckKeys(void) {
|
|||||||
gPttDebounceCounter = 0;
|
gPttDebounceCounter = 0;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if (gPttIsPressed)
|
if (gPttIsPressed) {
|
||||||
{
|
if (GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT) ||
|
||||||
if (GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT) || SerialConfigInProgress())
|
SerialConfigInProgress()) { // PTT released or serial comms config in progress
|
||||||
{ // PTT released or serial comms config in progress
|
|
||||||
if (++gPttDebounceCounter >= 3 || SerialConfigInProgress()) // 30ms
|
if (++gPttDebounceCounter >= 3 || SerialConfigInProgress()) // 30ms
|
||||||
{ // stop transmitting
|
{ // stop transmitting
|
||||||
ProcessKey(KEY_PTT, false, false);
|
ProcessKey(KEY_PTT, false, false);
|
||||||
@@ -1179,21 +1099,17 @@ static void CheckKeys(void) {
|
|||||||
if (gKeyReading1 != KEY_INVALID)
|
if (gKeyReading1 != KEY_INVALID)
|
||||||
gPttWasReleased = true;
|
gPttWasReleased = true;
|
||||||
}
|
}
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
gPttDebounceCounter = 0;
|
gPttDebounceCounter = 0;
|
||||||
}
|
} else if (!GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT) && !SerialConfigInProgress()) { // PTT pressed
|
||||||
else if (!GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT) && !SerialConfigInProgress())
|
|
||||||
{ // PTT pressed
|
|
||||||
if (++gPttDebounceCounter >= 3) // 30ms
|
if (++gPttDebounceCounter >= 3) // 30ms
|
||||||
{ // start transmitting
|
{ // start transmitting
|
||||||
boot_counter_10ms = 0;
|
boot_counter_10ms = 0;
|
||||||
gPttDebounceCounter = 0;
|
gPttDebounceCounter = 0;
|
||||||
gPttIsPressed = true;
|
gPttIsPressed = true;
|
||||||
ProcessKey(KEY_PTT, true, false);
|
ProcessKey(KEY_PTT, true, false);
|
||||||
}
|
}
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
gPttDebounceCounter = 0;
|
gPttDebounceCounter = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -1309,11 +1225,9 @@ void APP_TimeSlice10ms(void) {
|
|||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(ENABLE_FEAT_F4HWN) || defined(ENABLE_FEAT_F4HWN_RESCUE_OPS)
|
|
||||||
#ifdef ENABLE_FLASHLIGHT
|
#ifdef ENABLE_FLASHLIGHT
|
||||||
FlashlightTimeSlice();
|
FlashlightTimeSlice();
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef ENABLE_VOX
|
#ifdef ENABLE_VOX
|
||||||
if (gVoxResumeCountdown > 0)
|
if (gVoxResumeCountdown > 0)
|
||||||
@@ -1394,6 +1308,10 @@ void APP_TimeSlice10ms(void) {
|
|||||||
|
|
||||||
SCANNER_TimeSlice10ms();
|
SCANNER_TimeSlice10ms();
|
||||||
|
|
||||||
|
// if (gEnteringSMS == SMS_NOT_ENTERING) {
|
||||||
|
// MSG_FSKReceiveData();
|
||||||
|
// }
|
||||||
|
|
||||||
#ifdef ENABLE_AIRCOPY
|
#ifdef ENABLE_AIRCOPY
|
||||||
if (gScreenToDisplay == DISPLAY_AIRCOPY && gAircopyState == AIRCOPY_TRANSFER && gAirCopyIsSendMode == 1) {
|
if (gScreenToDisplay == DISPLAY_AIRCOPY && gAircopyState == AIRCOPY_TRANSFER && gAirCopyIsSendMode == 1) {
|
||||||
if (!AIRCOPY_SendMessage()) {
|
if (!AIRCOPY_SendMessage()) {
|
||||||
@@ -1470,11 +1388,6 @@ void APP_TimeSlice500ms(void) {
|
|||||||
if (--gMenuCountdown == 0)
|
if (--gMenuCountdown == 0)
|
||||||
exit_menu = (gScreenToDisplay == DISPLAY_MENU); // exit menu mode
|
exit_menu = (gScreenToDisplay == DISPLAY_MENU); // exit menu mode
|
||||||
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
if (gDTMF_RX_timeout > 0)
|
|
||||||
if (--gDTMF_RX_timeout == 0)
|
|
||||||
DTMF_clear_RX();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Skipped authentic device check
|
// Skipped authentic device check
|
||||||
|
|
||||||
@@ -1485,6 +1398,9 @@ void APP_TimeSlice500ms(void) {
|
|||||||
if (gFmRadioMode) // 1of11
|
if (gFmRadioMode) // 1of11
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (gScreenToDisplay == DISPLAY_FM) {
|
||||||
|
UI_UpdateFMThings(false);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (gBacklightCountdown_500ms > 0 && !gAskToSave && !gCssBackgroundScan
|
if (gBacklightCountdown_500ms > 0 && !gAskToSave && !gCssBackgroundScan
|
||||||
@@ -1628,7 +1544,7 @@ void APP_TimeSlice500ms(void) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (disp == DISPLAY_INVALID
|
if (disp == DISPLAY_INVALID
|
||||||
#ifdef ENABLE_NO_CODE_SCAN_TIMEOUT
|
#ifdef ENABLE_NO_CODE_SCAN_TIMEOUT
|
||||||
&& !SCANNER_IsScanning()
|
&& !SCANNER_IsScanning()
|
||||||
#endif
|
#endif
|
||||||
) {
|
) {
|
||||||
@@ -1654,35 +1570,10 @@ void APP_TimeSlice500ms(void) {
|
|||||||
|
|
||||||
BATTERY_TimeSlice500ms();
|
BATTERY_TimeSlice500ms();
|
||||||
SCANNER_TimeSlice500ms();
|
SCANNER_TimeSlice500ms();
|
||||||
|
MESSAGES_TimeSlice500ms();
|
||||||
|
FSKModem_TimeSlice500ms();
|
||||||
UI_MAIN_TimeSlice500ms();
|
UI_MAIN_TimeSlice500ms();
|
||||||
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
if (gCurrentFunction != FUNCTION_TRANSMIT) {
|
|
||||||
if (gDTMF_DecodeRingCountdown_500ms > 0) {
|
|
||||||
// make "ring-ring" sound
|
|
||||||
gDTMF_DecodeRingCountdown_500ms--;
|
|
||||||
AUDIO_PlayBeep(BEEP_880HZ_200MS);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
gDTMF_DecodeRingCountdown_500ms = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gDTMF_CallState != DTMF_CALL_STATE_NONE && gCurrentFunction != FUNCTION_TRANSMIT
|
|
||||||
&& gCurrentFunction != FUNCTION_RECEIVE && gDTMF_auto_reset_time_500ms > 0
|
|
||||||
&& --gDTMF_auto_reset_time_500ms == 0) {
|
|
||||||
gUpdateDisplay = true;
|
|
||||||
if (gDTMF_CallState == DTMF_CALL_STATE_RECEIVED && gEeprom.DTMF_auto_reset_time >= DTMF_HOLD_MAX) {
|
|
||||||
gDTMF_CallState = DTMF_CALL_STATE_RECEIVED_STAY; // keep message on-screen till a key is pressed
|
|
||||||
} else {
|
|
||||||
gDTMF_CallState = DTMF_CALL_STATE_NONE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gDTMF_IsTx && gDTMF_TxStopCountdown_500ms > 0 && --gDTMF_TxStopCountdown_500ms == 0) {
|
|
||||||
gDTMF_IsTx = false;
|
|
||||||
gUpdateDisplay = true;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)
|
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)
|
||||||
@@ -1798,35 +1689,12 @@ static void ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) {
|
|||||||
if (gScreenToDisplay == DISPLAY_MENU) // 1of11
|
if (gScreenToDisplay == DISPLAY_MENU) // 1of11
|
||||||
gMenuCountdown = menu_timeout_500ms;
|
gMenuCountdown = menu_timeout_500ms;
|
||||||
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
if (gDTMF_DecodeRingCountdown_500ms > 0) { // cancel the ringing
|
|
||||||
gDTMF_DecodeRingCountdown_500ms = 0;
|
|
||||||
|
|
||||||
AUDIO_PlayBeep(BEEP_1KHZ_60MS_OPTIONAL);
|
|
||||||
|
|
||||||
if (Key != KEY_PTT) {
|
|
||||||
gPttWasReleased = true;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool lowBatPopup = gLowBattery && !gLowBatteryConfirmed && gScreenToDisplay == DISPLAY_MAIN;
|
bool lowBatPopup = gLowBattery && !gLowBatteryConfirmed && gScreenToDisplay == DISPLAY_MAIN;
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN // Disable PTT if KEY_LOCK
|
if ((gEeprom.KEY_LOCK || lowBatPopup) &&
|
||||||
bool lck_condition = false;
|
gCurrentFunction != FUNCTION_TRANSMIT) { // keyboard is locked or low battery popup
|
||||||
|
|
||||||
if (gSetting_set_lck)
|
|
||||||
lck_condition = (gEeprom.KEY_LOCK || lowBatPopup) && gCurrentFunction != FUNCTION_TRANSMIT;
|
|
||||||
else
|
|
||||||
lck_condition = (gEeprom.KEY_LOCK || lowBatPopup) && gCurrentFunction != FUNCTION_TRANSMIT && Key != KEY_PTT;
|
|
||||||
|
|
||||||
if (lck_condition)
|
|
||||||
#else
|
|
||||||
if ((gEeprom.KEY_LOCK || lowBatPopup) && gCurrentFunction != FUNCTION_TRANSMIT && Key != KEY_PTT)
|
|
||||||
#endif
|
|
||||||
{ // keyboard is locked or low battery popup
|
|
||||||
|
|
||||||
// close low battery popup
|
// close low battery popup
|
||||||
if (Key == KEY_EXIT && bKeyPressed && lowBatPopup) {
|
if (Key == KEY_EXIT && bKeyPressed && lowBatPopup) {
|
||||||
@@ -1850,8 +1718,7 @@ static void ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) {
|
|||||||
// KEY_MENU has a special treatment here, because we want to pass hold event to ACTION_Handle
|
// KEY_MENU has a special treatment here, because we want to pass hold event to ACTION_Handle
|
||||||
// but we don't want it to complain when initial press happens
|
// but we don't want it to complain when initial press happens
|
||||||
// we want to react on realese instead
|
// we want to react on realese instead
|
||||||
else if (Key != KEY_SIDE1 && Key != KEY_SIDE2 && // pass side buttons
|
else if (!(Key == KEY_MENU && bKeyHeld)) // pass KEY_MENU held
|
||||||
!(Key == KEY_MENU && bKeyHeld)) // pass KEY_MENU held
|
|
||||||
{
|
{
|
||||||
if ((!bKeyPressed || bKeyHeld || (Key == KEY_MENU && bKeyPressed)) &&
|
if ((!bKeyPressed || bKeyHeld || (Key == KEY_MENU && bKeyPressed)) &&
|
||||||
// prevent released or held, prevent KEY_MENU pressed
|
// prevent released or held, prevent KEY_MENU pressed
|
||||||
@@ -1896,7 +1763,7 @@ static void ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) {
|
|||||||
#ifdef ENABLE_FEAT_F4HWN // For F + SIDE1 or F + SIDE2
|
#ifdef ENABLE_FEAT_F4HWN // For F + SIDE1 or F + SIDE2
|
||||||
if (gWasFKeyPressed && (Key == KEY_PTT || Key == KEY_EXIT)) {
|
if (gWasFKeyPressed && (Key == KEY_PTT || Key == KEY_EXIT)) {
|
||||||
#else
|
#else
|
||||||
if (gWasFKeyPressed && (Key == KEY_PTT || Key == KEY_EXIT || Key == KEY_SIDE1 || Key == KEY_SIDE2)) {
|
if (gWasFKeyPressed && (Key == KEY_PTT || Key == KEY_EXIT || Key == KEY_SIDE1 || Key == KEY_SIDE2)) {
|
||||||
#endif
|
#endif
|
||||||
// cancel the F-key
|
// cancel the F-key
|
||||||
gWasFKeyPressed = false;
|
gWasFKeyPressed = false;
|
||||||
@@ -1936,10 +1803,7 @@ static void ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) {
|
|||||||
|
|
||||||
BK4819_ExitDTMF_TX(false);
|
BK4819_ExitDTMF_TX(false);
|
||||||
|
|
||||||
if (gCurrentVfo->SCRAMBLING_TYPE == 0)
|
BK4819_SetScramble(gCurrentVfo->SCRAMBLING_TYPE);
|
||||||
BK4819_DisableScramble();
|
|
||||||
else
|
|
||||||
BK4819_EnableScramble(gCurrentVfo->SCRAMBLING_TYPE - 1);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -1948,7 +1812,7 @@ static void ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) {
|
|||||||
gEnableSpeaker = true;
|
gEnableSpeaker = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
BK4819_DisableScramble();
|
BK4819_SetScramble(0);
|
||||||
|
|
||||||
if (Code == 0xFE)
|
if (Code == 0xFE)
|
||||||
BK4819_TransmitTone(gEeprom.DTMF_SIDE_TONE, 1750);
|
BK4819_TransmitTone(gEeprom.DTMF_SIDE_TONE, 1750);
|
||||||
@@ -1973,15 +1837,15 @@ static void ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#ifdef ENABLE_FEAT_F4HWN // For F + SIDE1 or F + SIDE2
|
#ifdef ENABLE_FEAT_F4HWN // For F + SIDE1 or F + SIDE2
|
||||||
else if (gWasFKeyPressed && (Key == KEY_SIDE1 || Key == KEY_SIDE2)) {
|
else if (gWasFKeyPressed && (Key == KEY_SIDE1 || Key == KEY_SIDE2)) {
|
||||||
ProcessKeysFunctions[gScreenToDisplay](Key, bKeyPressed, bKeyHeld);
|
ProcessKeysFunctions[gScreenToDisplay](Key, bKeyPressed, bKeyHeld);
|
||||||
} else if (Key != KEY_SIDE1 && Key != KEY_SIDE2 && gScreenToDisplay != DISPLAY_INVALID) {
|
} else if (Key != KEY_SIDE1 && Key != KEY_SIDE2 && gScreenToDisplay != DISPLAY_INVALID) {
|
||||||
ProcessKeysFunctions[gScreenToDisplay](Key, bKeyPressed, bKeyHeld);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
else if (Key != KEY_SIDE1 && Key != KEY_SIDE2 && gScreenToDisplay != DISPLAY_INVALID) {
|
|
||||||
ProcessKeysFunctions[gScreenToDisplay](Key, bKeyPressed, bKeyHeld);
|
ProcessKeysFunctions[gScreenToDisplay](Key, bKeyPressed, bKeyHeld);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
else if (Key != KEY_SIDE1 && Key != KEY_SIDE2 && gScreenToDisplay != DISPLAY_INVALID) {
|
||||||
|
ProcessKeysFunctions[gScreenToDisplay](Key, bKeyPressed, bKeyHeld);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
else if (!SCANNER_IsScanning()
|
else if (!SCANNER_IsScanning()
|
||||||
#ifdef ENABLE_AIRCOPY
|
#ifdef ENABLE_AIRCOPY
|
||||||
@@ -2076,12 +1940,6 @@ static void ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) {
|
|||||||
|
|
||||||
RADIO_SetupRegisters(true);
|
RADIO_SetupRegisters(true);
|
||||||
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
gDTMF_auto_reset_time_500ms = 0;
|
|
||||||
gDTMF_CallState = DTMF_CALL_STATE_NONE;
|
|
||||||
gDTMF_TxStopCountdown_500ms = 0;
|
|
||||||
gDTMF_IsTx = false;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
gVFO_RSSI_bar_level[0] = 0;
|
gVFO_RSSI_bar_level[0] = 0;
|
||||||
gVFO_RSSI_bar_level[1] = 0;
|
gVFO_RSSI_bar_level[1] = 0;
|
||||||
|
|||||||
-301
@@ -44,40 +44,8 @@ uint8_t gDTMF_PreviousIndex = 0;
|
|||||||
char gDTMF_RX_live[20];
|
char gDTMF_RX_live[20];
|
||||||
uint8_t gDTMF_RX_live_timeout = 0;
|
uint8_t gDTMF_RX_live_timeout = 0;
|
||||||
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
char gDTMF_RX[17];
|
|
||||||
uint8_t gDTMF_RX_index = 0;
|
|
||||||
uint8_t gDTMF_RX_timeout = 0;
|
|
||||||
bool gDTMF_RX_pending = false;
|
|
||||||
|
|
||||||
bool gIsDtmfContactValid;
|
|
||||||
char gDTMF_ID[4];
|
|
||||||
char gDTMF_Caller[4];
|
|
||||||
char gDTMF_Callee[4];
|
|
||||||
DTMF_State_t gDTMF_State;
|
|
||||||
uint8_t gDTMF_DecodeRingCountdown_500ms;
|
|
||||||
uint8_t gDTMF_chosen_contact;
|
|
||||||
uint8_t gDTMF_auto_reset_time_500ms;
|
|
||||||
DTMF_CallState_t gDTMF_CallState;
|
|
||||||
DTMF_CallMode_t gDTMF_CallMode;
|
|
||||||
|
|
||||||
bool gDTMF_IsTx;
|
|
||||||
|
|
||||||
uint8_t gDTMF_TxStopCountdown_500ms;
|
|
||||||
bool gDTMF_IsGroupCall;
|
|
||||||
#endif
|
|
||||||
DTMF_ReplyState_t gDTMF_ReplyState;
|
DTMF_ReplyState_t gDTMF_ReplyState;
|
||||||
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
void DTMF_clear_RX(void)
|
|
||||||
{
|
|
||||||
gDTMF_RX_timeout = 0;
|
|
||||||
gDTMF_RX_index = 0;
|
|
||||||
gDTMF_RX_pending = false;
|
|
||||||
memset(gDTMF_RX, 0, sizeof(gDTMF_RX));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void DTMF_SendEndOfTransmission(void)
|
void DTMF_SendEndOfTransmission(void)
|
||||||
{
|
{
|
||||||
if (gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_APOLLO) {
|
if (gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_APOLLO) {
|
||||||
@@ -85,9 +53,6 @@ void DTMF_SendEndOfTransmission(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_TX_DOWN || gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_BOTH)
|
if ((gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_TX_DOWN || gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_BOTH)
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
&& gDTMF_CallState == DTMF_CALL_STATE_NONE
|
|
||||||
#endif
|
|
||||||
) { // end-of-tx
|
) { // end-of-tx
|
||||||
if (gEeprom.DTMF_SIDE_TONE) {
|
if (gEeprom.DTMF_SIDE_TONE) {
|
||||||
AUDIO_AudioPathOn();
|
AUDIO_AudioPathOn();
|
||||||
@@ -134,41 +99,6 @@ bool DTMF_ValidateCodes(char *pCode, const unsigned int size)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
bool DTMF_GetContact(const int Index, char *pContact)
|
|
||||||
{
|
|
||||||
if (Index < 0 || Index >= MAX_DTMF_CONTACTS || pContact == NULL) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
EEPROM_ReadBuffer(0x1C00 + (Index * 16), pContact, 16);
|
|
||||||
|
|
||||||
// check whether the first character is printable or not
|
|
||||||
return (pContact[0] >= ' ' && pContact[0] < 127);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool DTMF_FindContact(const char *pContact, char *pResult)
|
|
||||||
{
|
|
||||||
pResult[0] = 0;
|
|
||||||
|
|
||||||
for (unsigned int i = 0; i < MAX_DTMF_CONTACTS; i++) {
|
|
||||||
char Contact[16];
|
|
||||||
if (!DTMF_GetContact(i, Contact)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (memcmp(pContact, Contact + 8, 3) == 0) {
|
|
||||||
memcpy(pResult, Contact, 8);
|
|
||||||
pResult[8] = 0;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
char DTMF_GetCharacter(const unsigned int code)
|
char DTMF_GetCharacter(const unsigned int code)
|
||||||
{
|
{
|
||||||
if (code <= KEY_9)
|
if (code <= KEY_9)
|
||||||
@@ -185,33 +115,6 @@ char DTMF_GetCharacter(const unsigned int code)
|
|||||||
default: return 0xff;
|
default: return 0xff;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
static bool CompareMessage(const char *pMsg, const char *pTemplate, const unsigned int size, const bool bCheckGroup)
|
|
||||||
{
|
|
||||||
unsigned int i;
|
|
||||||
for (i = 0; i < size; i++)
|
|
||||||
{
|
|
||||||
if (pMsg[i] != pTemplate[i])
|
|
||||||
{
|
|
||||||
if (!bCheckGroup || pMsg[i] != gEeprom.DTMF_GROUP_CALL_CODE)
|
|
||||||
return false;
|
|
||||||
gDTMF_IsGroupCall = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
DTMF_CallMode_t DTMF_CheckGroupCall(const char *pMsg, const unsigned int size)
|
|
||||||
{
|
|
||||||
for (unsigned int i = 0; i < size; i++)
|
|
||||||
if (pMsg[i] == gEeprom.DTMF_GROUP_CALL_CODE) {
|
|
||||||
return DTMF_CALL_MODE_GROUP;
|
|
||||||
}
|
|
||||||
|
|
||||||
return DTMF_CALL_MODE_NOT_GROUP;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void DTMF_clear_input_box(void)
|
void DTMF_clear_input_box(void)
|
||||||
{
|
{
|
||||||
@@ -232,227 +135,23 @@ void DTMF_Append(const char code)
|
|||||||
gDTMF_InputBox[gDTMF_InputBox_Index++] = code;
|
gDTMF_InputBox[gDTMF_InputBox_Index++] = code;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
void DTMF_HandleRequest(void)
|
|
||||||
{ // proccess the RX'ed DTMF characters
|
|
||||||
|
|
||||||
char String[21];
|
|
||||||
unsigned int Offset;
|
|
||||||
|
|
||||||
if (!gDTMF_RX_pending)
|
|
||||||
return; // nothing new received
|
|
||||||
|
|
||||||
if (gScanStateDir != SCAN_OFF || gCssBackgroundScan)
|
|
||||||
{ // we're busy scanning
|
|
||||||
DTMF_clear_RX();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!gRxVfo->DTMF_DECODING_ENABLE)
|
|
||||||
{ // D-DCD is disabled or we're alive
|
|
||||||
DTMF_clear_RX();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
gDTMF_RX_pending = false;
|
|
||||||
|
|
||||||
if (gDTMF_RX_index >= 9)
|
|
||||||
{ // look for the KILL code
|
|
||||||
|
|
||||||
sprintf(String, "%s%c%s", gEeprom.ANI_DTMF_ID, gEeprom.DTMF_SEPARATE_CODE, gEeprom.KILL_CODE);
|
|
||||||
|
|
||||||
Offset = gDTMF_RX_index - strlen(String);
|
|
||||||
|
|
||||||
if (CompareMessage(gDTMF_RX + Offset, String, strlen(String), true))
|
|
||||||
{ // bugger
|
|
||||||
|
|
||||||
// if (gEeprom.PERMIT_REMOTE_KILL)
|
|
||||||
// {
|
|
||||||
// gSetting_KILLED = true; // oooerr !
|
|
||||||
//
|
|
||||||
// DTMF_clear_RX();
|
|
||||||
//
|
|
||||||
// SETTINGS_SaveSettings();
|
|
||||||
//
|
|
||||||
// gDTMF_ReplyState = DTMF_REPLY_AB;
|
|
||||||
//
|
|
||||||
// #ifdef ENABLE_FMRADIO
|
|
||||||
// if (gFmRadioMode)
|
|
||||||
// {
|
|
||||||
// FM_TurnOff();
|
|
||||||
// GUI_SelectNextDisplay(DISPLAY_MAIN);
|
|
||||||
// }
|
|
||||||
// #endif
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
gDTMF_ReplyState = DTMF_REPLY_NONE;
|
|
||||||
// }
|
|
||||||
|
|
||||||
gDTMF_CallState = DTMF_CALL_STATE_NONE;
|
|
||||||
|
|
||||||
gUpdateDisplay = true;
|
|
||||||
gUpdateStatus = true;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// if (gDTMF_RX_index >= 9)
|
|
||||||
// { // look for the REVIVE code
|
|
||||||
//
|
|
||||||
// sprintf(String, "%s%c%s", gEeprom.ANI_DTMF_ID, gEeprom.DTMF_SEPARATE_CODE, gEeprom.REVIVE_CODE);
|
|
||||||
//
|
|
||||||
// Offset = gDTMF_RX_index - strlen(String);
|
|
||||||
//
|
|
||||||
// if (CompareMessage(gDTMF_RX + Offset, String, strlen(String), true))
|
|
||||||
// { // shit, we're back !
|
|
||||||
//
|
|
||||||
// gSetting_KILLED = false;
|
|
||||||
//
|
|
||||||
// DTMF_clear_RX();
|
|
||||||
//
|
|
||||||
// SETTINGS_SaveSettings();
|
|
||||||
//
|
|
||||||
// gDTMF_ReplyState = DTMF_REPLY_AB;
|
|
||||||
// gDTMF_CallState = DTMF_CALL_STATE_NONE;
|
|
||||||
//
|
|
||||||
// gUpdateDisplay = true;
|
|
||||||
// gUpdateStatus = true;
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
if (gDTMF_RX_index >= 2)
|
|
||||||
{ // look for ACK reply
|
|
||||||
char *pPrintStr = "AB";
|
|
||||||
|
|
||||||
Offset = gDTMF_RX_index - strlen(pPrintStr);
|
|
||||||
|
|
||||||
if (CompareMessage(gDTMF_RX + Offset, pPrintStr, strlen(pPrintStr), true)) {
|
|
||||||
// ends with "AB"
|
|
||||||
|
|
||||||
if (gDTMF_ReplyState != DTMF_REPLY_NONE) // 1of11
|
|
||||||
// if (gDTMF_CallState != DTMF_CALL_STATE_NONE) // 1of11
|
|
||||||
// if (gDTMF_CallState == DTMF_CALL_STATE_CALL_OUT) // 1of11
|
|
||||||
{
|
|
||||||
gDTMF_State = DTMF_STATE_TX_SUCC;
|
|
||||||
DTMF_clear_RX();
|
|
||||||
gUpdateDisplay = true;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gDTMF_CallState == DTMF_CALL_STATE_CALL_OUT &&
|
|
||||||
gDTMF_CallMode == DTMF_CALL_MODE_NOT_GROUP &&
|
|
||||||
gDTMF_RX_index >= 9)
|
|
||||||
{ // waiting for a reply
|
|
||||||
|
|
||||||
sprintf(String, "%s%c%s", gDTMF_String, gEeprom.DTMF_SEPARATE_CODE, "AAAAA");
|
|
||||||
|
|
||||||
Offset = gDTMF_RX_index - strlen(String);
|
|
||||||
|
|
||||||
if (CompareMessage(gDTMF_RX + Offset, String, strlen(String), false))
|
|
||||||
{ // we got a response
|
|
||||||
gDTMF_State = DTMF_STATE_CALL_OUT_RSP;
|
|
||||||
DTMF_clear_RX();
|
|
||||||
gUpdateDisplay = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gDTMF_CallState != DTMF_CALL_STATE_NONE)
|
|
||||||
{ // we've been killed or expecting a reply
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gDTMF_RX_index >= 7)
|
|
||||||
{ // see if we're being called
|
|
||||||
|
|
||||||
gDTMF_IsGroupCall = false;
|
|
||||||
|
|
||||||
sprintf(String, "%s%c", gEeprom.ANI_DTMF_ID, gEeprom.DTMF_SEPARATE_CODE);
|
|
||||||
|
|
||||||
Offset = gDTMF_RX_index - strlen(String) - 3;
|
|
||||||
|
|
||||||
if (CompareMessage(gDTMF_RX + Offset, String, strlen(String), true))
|
|
||||||
{ // it's for us !
|
|
||||||
|
|
||||||
gDTMF_CallState = DTMF_CALL_STATE_RECEIVED;
|
|
||||||
|
|
||||||
memset(gDTMF_Callee, 0, sizeof(gDTMF_Callee));
|
|
||||||
memset(gDTMF_Caller, 0, sizeof(gDTMF_Caller));
|
|
||||||
memcpy(gDTMF_Callee, gDTMF_RX + Offset + 0, 3);
|
|
||||||
memcpy(gDTMF_Caller, gDTMF_RX + Offset + 4, 3);
|
|
||||||
|
|
||||||
DTMF_clear_RX();
|
|
||||||
|
|
||||||
gUpdateDisplay = true;
|
|
||||||
|
|
||||||
switch (gEeprom.DTMF_DECODE_RESPONSE)
|
|
||||||
{
|
|
||||||
case DTMF_DEC_RESPONSE_BOTH:
|
|
||||||
gDTMF_DecodeRingCountdown_500ms = DTMF_decode_ring_countdown_500ms;
|
|
||||||
[[fallthrough]];
|
|
||||||
case DTMF_DEC_RESPONSE_REPLY:
|
|
||||||
gDTMF_ReplyState = DTMF_REPLY_AAAAA;
|
|
||||||
break;
|
|
||||||
case DTMF_DEC_RESPONSE_RING:
|
|
||||||
gDTMF_DecodeRingCountdown_500ms = DTMF_decode_ring_countdown_500ms;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
case DTMF_DEC_RESPONSE_NONE:
|
|
||||||
gDTMF_DecodeRingCountdown_500ms = 0;
|
|
||||||
gDTMF_ReplyState = DTMF_REPLY_NONE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gDTMF_IsGroupCall)
|
|
||||||
gDTMF_ReplyState = DTMF_REPLY_NONE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void DTMF_Reply(void)
|
void DTMF_Reply(void)
|
||||||
{
|
{
|
||||||
uint16_t Delay;
|
uint16_t Delay;
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
char String[23];
|
|
||||||
#endif
|
|
||||||
const char *pString = NULL;
|
const char *pString = NULL;
|
||||||
|
|
||||||
switch (gDTMF_ReplyState)
|
switch (gDTMF_ReplyState)
|
||||||
{
|
{
|
||||||
case DTMF_REPLY_ANI:
|
case DTMF_REPLY_ANI:
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
if (gDTMF_CallMode != DTMF_CALL_MODE_DTMF)
|
|
||||||
{ // append our ID code onto the end of the DTMF code to send
|
|
||||||
sprintf(String, "%s%c%s", gDTMF_String, gEeprom.DTMF_SEPARATE_CODE, gEeprom.ANI_DTMF_ID);
|
|
||||||
pString = String;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
pString = gDTMF_String;
|
pString = gDTMF_String;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
case DTMF_REPLY_AB:
|
|
||||||
pString = "AB";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case DTMF_REPLY_AAAAA:
|
|
||||||
sprintf(String, "%s%c%s", gEeprom.ANI_DTMF_ID, gEeprom.DTMF_SEPARATE_CODE, "AAAAA");
|
|
||||||
pString = String;
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
default:
|
default:
|
||||||
case DTMF_REPLY_NONE:
|
case DTMF_REPLY_NONE:
|
||||||
if (
|
if (
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
gDTMF_CallState != DTMF_CALL_STATE_NONE ||
|
|
||||||
#endif
|
|
||||||
gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_APOLLO ||
|
gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_APOLLO ||
|
||||||
gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_OFF ||
|
gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_OFF ||
|
||||||
gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_TX_DOWN)
|
gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_TX_DOWN)
|
||||||
|
|||||||
-29
@@ -87,33 +87,4 @@ void DTMF_Append(const char code);
|
|||||||
void DTMF_Reply(void);
|
void DTMF_Reply(void);
|
||||||
void DTMF_SendEndOfTransmission(void);
|
void DTMF_SendEndOfTransmission(void);
|
||||||
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
|
|
||||||
extern char gDTMF_RX[17];
|
|
||||||
extern uint8_t gDTMF_RX_index;
|
|
||||||
extern uint8_t gDTMF_RX_timeout;
|
|
||||||
extern bool gDTMF_RX_pending;
|
|
||||||
|
|
||||||
extern bool gIsDtmfContactValid;
|
|
||||||
extern char gDTMF_ID[4];
|
|
||||||
extern char gDTMF_Caller[4];
|
|
||||||
extern char gDTMF_Callee[4];
|
|
||||||
extern DTMF_State_t gDTMF_State;
|
|
||||||
extern uint8_t gDTMF_DecodeRingCountdown_500ms;
|
|
||||||
extern uint8_t gDTMF_chosen_contact;
|
|
||||||
extern uint8_t gDTMF_auto_reset_time_500ms;
|
|
||||||
extern DTMF_CallState_t gDTMF_CallState;
|
|
||||||
|
|
||||||
extern DTMF_CallMode_t gDTMF_CallMode;
|
|
||||||
extern bool gDTMF_IsTx;
|
|
||||||
extern uint8_t gDTMF_TxStopCountdown_500ms;
|
|
||||||
|
|
||||||
void DTMF_clear_RX(void);
|
|
||||||
DTMF_CallMode_t DTMF_CheckGroupCall(const char *pDTMF, const unsigned int size);
|
|
||||||
bool DTMF_GetContact(const int Index, char *pContact);
|
|
||||||
bool DTMF_FindContact(const char *pContact, char *pResult);
|
|
||||||
void DTMF_HandleRequest(void);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
+46
-65
@@ -5,79 +5,60 @@
|
|||||||
|
|
||||||
#include "flashlight.h"
|
#include "flashlight.h"
|
||||||
|
|
||||||
#if !defined(ENABLE_FEAT_F4HWN) || defined(ENABLE_FEAT_F4HWN_RESCUE_OPS)
|
enum FlashlightMode_t gFlashLightState;
|
||||||
enum FlashlightMode_t gFlashLightState;
|
|
||||||
|
|
||||||
void FlashlightTimeSlice()
|
void FlashlightTimeSlice() {
|
||||||
{
|
if (gFlashLightState == FLASHLIGHT_BLINK && (gFlashLightBlinkCounter & 15u) == 0) {
|
||||||
if (gFlashLightState == FLASHLIGHT_BLINK && (gFlashLightBlinkCounter & 15u) == 0) {
|
GPIO_FlipBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT);
|
||||||
GPIO_FlipBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT);
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gFlashLightState == FLASHLIGHT_SOS) {
|
||||||
|
const uint16_t u = 15;
|
||||||
|
static uint8_t c;
|
||||||
|
static uint16_t next;
|
||||||
|
|
||||||
|
if (gFlashLightBlinkCounter - next > 7 * u) {
|
||||||
|
c = 0;
|
||||||
|
next = gFlashLightBlinkCounter + 1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gFlashLightState == FLASHLIGHT_SOS) {
|
if (gFlashLightBlinkCounter == next) {
|
||||||
const uint16_t u = 15;
|
if (c == 0) {
|
||||||
static uint8_t c;
|
|
||||||
static uint16_t next;
|
|
||||||
|
|
||||||
if (gFlashLightBlinkCounter - next > 7 * u) {
|
|
||||||
c = 0;
|
|
||||||
next = gFlashLightBlinkCounter + 1;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gFlashLightBlinkCounter == next) {
|
|
||||||
if (c==0) {
|
|
||||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT);
|
|
||||||
} else {
|
|
||||||
GPIO_FlipBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (c >= 18) {
|
|
||||||
next = gFlashLightBlinkCounter + 7 * u;
|
|
||||||
c = 0;
|
|
||||||
} else if(c==7 || c==9 || c==11) {
|
|
||||||
next = gFlashLightBlinkCounter + 3 * u;
|
|
||||||
} else {
|
|
||||||
next = gFlashLightBlinkCounter + u;
|
|
||||||
}
|
|
||||||
c++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ACTION_FlashLight(void)
|
|
||||||
{
|
|
||||||
switch (gFlashLightState) {
|
|
||||||
case FLASHLIGHT_OFF:
|
|
||||||
gFlashLightState++;
|
|
||||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT);
|
|
||||||
break;
|
|
||||||
case FLASHLIGHT_ON:
|
|
||||||
case FLASHLIGHT_BLINK:
|
|
||||||
gFlashLightState++;
|
|
||||||
break;
|
|
||||||
case FLASHLIGHT_SOS:
|
|
||||||
default:
|
|
||||||
gFlashLightState = 0;
|
|
||||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT);
|
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT);
|
||||||
|
} else {
|
||||||
|
GPIO_FlipBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (c >= 18) {
|
||||||
|
next = gFlashLightBlinkCounter + 7 * u;
|
||||||
|
c = 0;
|
||||||
|
} else if (c == 7 || c == 9 || c == 11) {
|
||||||
|
next = gFlashLightBlinkCounter + 3 * u;
|
||||||
|
} else {
|
||||||
|
next = gFlashLightBlinkCounter + u;
|
||||||
|
}
|
||||||
|
c++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
}
|
||||||
void ACTION_FlashLight(void)
|
|
||||||
{
|
|
||||||
static bool gFlashLightState = false;
|
|
||||||
|
|
||||||
if(gFlashLightState)
|
void ACTION_FlashLight(void) {
|
||||||
{
|
switch (gFlashLightState) {
|
||||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT);
|
case FLASHLIGHT_OFF:
|
||||||
}
|
gFlashLightState++;
|
||||||
else
|
|
||||||
{
|
|
||||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT);
|
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT);
|
||||||
}
|
break;
|
||||||
|
case FLASHLIGHT_ON:
|
||||||
gFlashLightState = (gFlashLightState) ? false : true;
|
case FLASHLIGHT_BLINK:
|
||||||
|
gFlashLightState++;
|
||||||
|
break;
|
||||||
|
case FLASHLIGHT_SOS:
|
||||||
|
default:
|
||||||
|
gFlashLightState = 0;
|
||||||
|
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT);
|
||||||
}
|
}
|
||||||
#endif
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#if !defined(ENABLE_FEAT_F4HWN) || defined(ENABLE_FEAT_F4HWN_RESCUE_OPS)
|
|
||||||
enum FlashlightMode_t {
|
enum FlashlightMode_t {
|
||||||
FLASHLIGHT_OFF = 0,
|
FLASHLIGHT_OFF = 0,
|
||||||
FLASHLIGHT_ON,
|
FLASHLIGHT_ON,
|
||||||
@@ -17,7 +16,6 @@
|
|||||||
extern volatile uint16_t gFlashLightBlinkCounter;
|
extern volatile uint16_t gFlashLightBlinkCounter;
|
||||||
|
|
||||||
void FlashlightTimeSlice(void);
|
void FlashlightTimeSlice(void);
|
||||||
#endif
|
|
||||||
void ACTION_FlashLight(void);
|
void ACTION_FlashLight(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -31,22 +31,22 @@
|
|||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "ui/inputbox.h"
|
#include "ui/inputbox.h"
|
||||||
#include "ui/ui.h"
|
#include "ui/ui.h"
|
||||||
|
#include "driver/systick.h"
|
||||||
|
|
||||||
#ifndef ARRAY_SIZE
|
#ifndef ARRAY_SIZE
|
||||||
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
|
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
uint16_t gFM_Channels[20];
|
uint16_t gFM_Channels[20];
|
||||||
bool gFmRadioMode;
|
bool gFmRadioMode;
|
||||||
uint8_t gFmRadioCountdown_500ms;
|
uint8_t gFmRadioCountdown_500ms;
|
||||||
volatile uint16_t gFmPlayCountdown_10ms;
|
volatile uint16_t gFmPlayCountdown_10ms;
|
||||||
volatile int8_t gFM_ScanState;
|
volatile int8_t gFM_ScanState;
|
||||||
bool gFM_AutoScan;
|
bool gFM_AutoScan;
|
||||||
uint8_t gFM_ChannelPosition;
|
uint8_t gFM_ChannelPosition;
|
||||||
bool gFM_FoundFrequency;
|
bool gFM_FoundFrequency;
|
||||||
bool gFM_AutoScan;
|
bool gFM_AutoScan;
|
||||||
uint16_t gFM_RestoreCountdown_10ms;
|
uint16_t gFM_RestoreCountdown_10ms;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const uint8_t BUTTON_STATE_PRESSED = 1 << 0;
|
const uint8_t BUTTON_STATE_PRESSED = 1 << 0;
|
||||||
@@ -54,21 +54,19 @@ const uint8_t BUTTON_STATE_HELD = 1 << 1;
|
|||||||
|
|
||||||
const uint8_t BUTTON_EVENT_PRESSED = BUTTON_STATE_PRESSED;
|
const uint8_t BUTTON_EVENT_PRESSED = BUTTON_STATE_PRESSED;
|
||||||
const uint8_t BUTTON_EVENT_HELD = BUTTON_STATE_PRESSED | BUTTON_STATE_HELD;
|
const uint8_t BUTTON_EVENT_HELD = BUTTON_STATE_PRESSED | BUTTON_STATE_HELD;
|
||||||
const uint8_t BUTTON_EVENT_SHORT = 0;
|
const uint8_t BUTTON_EVENT_SHORT = 0;
|
||||||
const uint8_t BUTTON_EVENT_LONG = BUTTON_STATE_HELD;
|
const uint8_t BUTTON_EVENT_LONG = BUTTON_STATE_HELD;
|
||||||
|
|
||||||
|
|
||||||
static void Key_FUNC(KEY_Code_t Key, uint8_t state);
|
static void Key_FUNC(KEY_Code_t Key, uint8_t state);
|
||||||
|
|
||||||
bool FM_CheckValidChannel(uint8_t Channel)
|
bool FM_CheckValidChannel(uint8_t Channel) {
|
||||||
{
|
return Channel < ARRAY_SIZE(gFM_Channels) &&
|
||||||
return Channel < ARRAY_SIZE(gFM_Channels) &&
|
gFM_Channels[Channel] >= BK1080_GetFreqLoLimit(gEeprom.FM_Band) &&
|
||||||
gFM_Channels[Channel] >= BK1080_GetFreqLoLimit(gEeprom.FM_Band) &&
|
gFM_Channels[Channel] < BK1080_GetFreqHiLimit(gEeprom.FM_Band);
|
||||||
gFM_Channels[Channel] < BK1080_GetFreqHiLimit(gEeprom.FM_Band);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t FM_FindNextChannel(uint8_t Channel, uint8_t Direction)
|
uint8_t FM_FindNextChannel(uint8_t Channel, uint8_t Direction) {
|
||||||
{
|
|
||||||
for (unsigned i = 0; i < ARRAY_SIZE(gFM_Channels); i++) {
|
for (unsigned i = 0; i < ARRAY_SIZE(gFM_Channels); i++) {
|
||||||
if (Channel == 0xFF)
|
if (Channel == 0xFF)
|
||||||
Channel = ARRAY_SIZE(gFM_Channels) - 1;
|
Channel = ARRAY_SIZE(gFM_Channels) - 1;
|
||||||
@@ -82,8 +80,7 @@ uint8_t FM_FindNextChannel(uint8_t Channel, uint8_t Direction)
|
|||||||
return 0xFF;
|
return 0xFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
int FM_ConfigureChannelState(void)
|
int FM_ConfigureChannelState(void) {
|
||||||
{
|
|
||||||
gEeprom.FM_FrequencyPlaying = gEeprom.FM_SelectedFrequency;
|
gEeprom.FM_FrequencyPlaying = gEeprom.FM_SelectedFrequency;
|
||||||
|
|
||||||
if (gEeprom.FM_IsMrMode) {
|
if (gEeprom.FM_IsMrMode) {
|
||||||
@@ -92,17 +89,16 @@ int FM_ConfigureChannelState(void)
|
|||||||
gEeprom.FM_IsMrMode = false;
|
gEeprom.FM_IsMrMode = false;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
gEeprom.FM_SelectedChannel = Channel;
|
gEeprom.FM_SelectedChannel = Channel;
|
||||||
gEeprom.FM_FrequencyPlaying = gFM_Channels[Channel];
|
gEeprom.FM_FrequencyPlaying = gFM_Channels[Channel];
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FM_TurnOff(void)
|
void FM_TurnOff(void) {
|
||||||
{
|
gFmRadioMode = false;
|
||||||
gFmRadioMode = false;
|
gFM_ScanState = FM_SCAN_OFF;
|
||||||
gFM_ScanState = FM_SCAN_OFF;
|
|
||||||
gFM_RestoreCountdown_10ms = 0;
|
gFM_RestoreCountdown_10ms = 0;
|
||||||
|
|
||||||
AUDIO_AudioPathOff();
|
AUDIO_AudioPathOff();
|
||||||
@@ -110,17 +106,16 @@ void FM_TurnOff(void)
|
|||||||
|
|
||||||
BK1080_Init0();
|
BK1080_Init0();
|
||||||
|
|
||||||
gUpdateStatus = true;
|
gUpdateStatus = true;
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_RESUME_STATE
|
#ifdef ENABLE_FEAT_F4HWN_RESUME_STATE
|
||||||
gEeprom.CURRENT_STATE = 0;
|
gEeprom.CURRENT_STATE = 0;
|
||||||
SETTINGS_WriteCurrentState();
|
SETTINGS_WriteCurrentState();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void FM_EraseChannels(void)
|
void FM_EraseChannels(void) {
|
||||||
{
|
uint8_t Template[8];
|
||||||
uint8_t Template[8];
|
|
||||||
memset(Template, 0xFF, sizeof(Template));
|
memset(Template, 0xFF, sizeof(Template));
|
||||||
|
|
||||||
for (unsigned i = 0; i < 5; i++)
|
for (unsigned i = 0; i < 5; i++)
|
||||||
@@ -129,18 +124,18 @@ void FM_EraseChannels(void)
|
|||||||
memset(gFM_Channels, 0xFF, sizeof(gFM_Channels));
|
memset(gFM_Channels, 0xFF, sizeof(gFM_Channels));
|
||||||
}
|
}
|
||||||
|
|
||||||
void FM_Tune(uint16_t Frequency, int8_t Step, bool bFlag)
|
void FM_Tune(uint16_t Frequency, int8_t Step, bool bFlag) {
|
||||||
{
|
|
||||||
AUDIO_AudioPathOff();
|
AUDIO_AudioPathOff();
|
||||||
|
|
||||||
gEnableSpeaker = false;
|
gEnableSpeaker = false;
|
||||||
|
|
||||||
gFmPlayCountdown_10ms = (gFM_ScanState == FM_SCAN_OFF) ? fm_play_countdown_noscan_10ms : fm_play_countdown_scan_10ms;
|
gFmPlayCountdown_10ms = (gFM_ScanState == FM_SCAN_OFF) ? fm_play_countdown_noscan_10ms
|
||||||
|
: fm_play_countdown_scan_10ms;
|
||||||
|
|
||||||
gScheduleFM = false;
|
gScheduleFM = false;
|
||||||
gFM_FoundFrequency = false;
|
gFM_FoundFrequency = false;
|
||||||
gAskToSave = false;
|
gAskToSave = false;
|
||||||
gAskToDelete = false;
|
gAskToDelete = false;
|
||||||
gEeprom.FM_FrequencyPlaying = Frequency;
|
gEeprom.FM_FrequencyPlaying = Frequency;
|
||||||
|
|
||||||
if (!bFlag) {
|
if (!bFlag) {
|
||||||
@@ -158,12 +153,11 @@ void FM_Tune(uint16_t Frequency, int8_t Step, bool bFlag)
|
|||||||
BK1080_SetFrequency(gEeprom.FM_FrequencyPlaying, gEeprom.FM_Band/*, gEeprom.FM_Space*/);
|
BK1080_SetFrequency(gEeprom.FM_FrequencyPlaying, gEeprom.FM_Band/*, gEeprom.FM_Space*/);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FM_PlayAndUpdate(void)
|
void FM_PlayAndUpdate(void) {
|
||||||
{
|
|
||||||
gFM_ScanState = FM_SCAN_OFF;
|
gFM_ScanState = FM_SCAN_OFF;
|
||||||
|
|
||||||
if (gFM_AutoScan) {
|
if (gFM_AutoScan) {
|
||||||
gEeprom.FM_IsMrMode = true;
|
gEeprom.FM_IsMrMode = true;
|
||||||
gEeprom.FM_SelectedChannel = 0;
|
gEeprom.FM_SelectedChannel = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -172,35 +166,34 @@ void FM_PlayAndUpdate(void)
|
|||||||
SETTINGS_SaveFM();
|
SETTINGS_SaveFM();
|
||||||
|
|
||||||
gFmPlayCountdown_10ms = 0;
|
gFmPlayCountdown_10ms = 0;
|
||||||
gScheduleFM = false;
|
gScheduleFM = false;
|
||||||
gAskToSave = false;
|
gAskToSave = false;
|
||||||
|
|
||||||
AUDIO_AudioPathOn();
|
AUDIO_AudioPathOn();
|
||||||
|
|
||||||
gEnableSpeaker = true;
|
gEnableSpeaker = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int FM_CheckFrequencyLock(uint16_t Frequency, uint16_t LowerLimit)
|
int FM_CheckFrequencyLock(uint16_t Frequency, uint16_t LowerLimit) {
|
||||||
{
|
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
|
||||||
const uint16_t Test2 = BK1080_ReadRegister(BK1080_REG_07);
|
const uint16_t Test2 = BK1080_ReadRegister(BK1080_REG_07_TEST1);
|
||||||
|
|
||||||
// This is supposed to be a signed value, but above function is unsigned
|
// This is supposed to be a signed value, but above function is unsigned
|
||||||
const uint16_t Deviation = BK1080_REG_07_GET_FREQD(Test2);
|
const uint16_t Deviation = BK1080_REG_07_GET_FREQD(Test2);
|
||||||
|
|
||||||
if (BK1080_REG_07_GET_SNR(Test2) <= 2) {
|
if (BK1080_REG_07_GET_SNR(Test2) <= 2) {
|
||||||
BK1080_FrequencyDeviation = Deviation;
|
BK1080_FrequencyDeviation = Deviation;
|
||||||
BK1080_BaseFrequency = Frequency;
|
BK1080_BaseFrequency = Frequency;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
const uint16_t Status = BK1080_ReadRegister(BK1080_REG_10);
|
const uint16_t Status = BK1080_ReadRegister(BK1080_REG_10_RSSI_STATUS);
|
||||||
|
|
||||||
if ((Status & BK1080_REG_10_MASK_AFCRL) != BK1080_REG_10_AFCRL_NOT_RAILED || BK1080_REG_10_GET_RSSI(Status) < 10) {
|
if ((Status & BK1080_REG_10_MASK_AFCRL) != BK1080_REG_10_AFCRL_NOT_RAILED || BK1080_REG_10_GET_RSSI(Status) < 10) {
|
||||||
BK1080_FrequencyDeviation = Deviation;
|
BK1080_FrequencyDeviation = Deviation;
|
||||||
BK1080_BaseFrequency = Frequency;
|
BK1080_BaseFrequency = Frequency;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -208,17 +201,16 @@ int FM_CheckFrequencyLock(uint16_t Frequency, uint16_t LowerLimit)
|
|||||||
//if (Deviation > -281 && Deviation < 280)
|
//if (Deviation > -281 && Deviation < 280)
|
||||||
if (Deviation >= 280 && Deviation <= 3815) {
|
if (Deviation >= 280 && Deviation <= 3815) {
|
||||||
BK1080_FrequencyDeviation = Deviation;
|
BK1080_FrequencyDeviation = Deviation;
|
||||||
BK1080_BaseFrequency = Frequency;
|
BK1080_BaseFrequency = Frequency;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
// not BLE(less than or equal)
|
// not BLE(less than or equal)
|
||||||
if (Frequency > LowerLimit && (Frequency - BK1080_BaseFrequency) == 1) {
|
if (Frequency > LowerLimit && (Frequency - BK1080_BaseFrequency) == 1) {
|
||||||
if (BK1080_FrequencyDeviation & 0x800 || (BK1080_FrequencyDeviation < 20))
|
if (BK1080_FrequencyDeviation & 0x800 || (BK1080_FrequencyDeviation < 20)) {
|
||||||
{
|
|
||||||
BK1080_FrequencyDeviation = Deviation;
|
BK1080_FrequencyDeviation = Deviation;
|
||||||
BK1080_BaseFrequency = Frequency;
|
BK1080_BaseFrequency = Frequency;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -227,10 +219,9 @@ int FM_CheckFrequencyLock(uint16_t Frequency, uint16_t LowerLimit)
|
|||||||
// not BLT(less than)
|
// not BLT(less than)
|
||||||
|
|
||||||
if (Frequency >= LowerLimit && (BK1080_BaseFrequency - Frequency) == 1) {
|
if (Frequency >= LowerLimit && (BK1080_BaseFrequency - Frequency) == 1) {
|
||||||
if ((BK1080_FrequencyDeviation & 0x800) == 0 || (BK1080_FrequencyDeviation > 4075))
|
if ((BK1080_FrequencyDeviation & 0x800) == 0 || (BK1080_FrequencyDeviation > 4075)) {
|
||||||
{
|
|
||||||
BK1080_FrequencyDeviation = Deviation;
|
BK1080_FrequencyDeviation = Deviation;
|
||||||
BK1080_BaseFrequency = Frequency;
|
BK1080_BaseFrequency = Frequency;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -238,14 +229,15 @@ int FM_CheckFrequencyLock(uint16_t Frequency, uint16_t LowerLimit)
|
|||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
BK1080_FrequencyDeviation = Deviation;
|
BK1080_FrequencyDeviation = Deviation;
|
||||||
BK1080_BaseFrequency = Frequency;
|
BK1080_BaseFrequency = Frequency;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Key_DIGITS(KEY_Code_t Key, uint8_t state)
|
static void Key_DIGITS(KEY_Code_t Key, uint8_t state) {
|
||||||
{
|
enum {
|
||||||
enum { STATE_FREQ_MODE, STATE_MR_MODE, STATE_SAVE };
|
STATE_FREQ_MODE, STATE_MR_MODE, STATE_SAVE
|
||||||
|
};
|
||||||
|
|
||||||
if (state == BUTTON_EVENT_SHORT && !gWasFKeyPressed) {
|
if (state == BUTTON_EVENT_SHORT && !gWasFKeyPressed) {
|
||||||
uint8_t State;
|
uint8_t State;
|
||||||
@@ -257,8 +249,7 @@ static void Key_DIGITS(KEY_Code_t Key, uint8_t state)
|
|||||||
|
|
||||||
if (gAskToSave) {
|
if (gAskToSave) {
|
||||||
State = STATE_SAVE;
|
State = STATE_SAVE;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
if (gFM_ScanState != FM_SCAN_OFF) {
|
if (gFM_ScanState != FM_SCAN_OFF) {
|
||||||
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||||
return;
|
return;
|
||||||
@@ -278,20 +269,20 @@ static void Key_DIGITS(KEY_Code_t Key, uint8_t state)
|
|||||||
gInputBox[0] = 0;
|
gInputBox[0] = 0;
|
||||||
gInputBoxIndex = 2;
|
gInputBoxIndex = 2;
|
||||||
}
|
}
|
||||||
}
|
} else if (gInputBoxIndex > 3) {
|
||||||
else if (gInputBoxIndex > 3) {
|
|
||||||
uint32_t Frequency;
|
uint32_t Frequency;
|
||||||
|
|
||||||
gInputBoxIndex = 0;
|
gInputBoxIndex = 0;
|
||||||
Frequency = StrToUL(INPUTBOX_GetAscii());
|
Frequency = StrToUL(INPUTBOX_GetAscii());
|
||||||
|
|
||||||
if (Frequency < BK1080_GetFreqLoLimit(gEeprom.FM_Band) || BK1080_GetFreqHiLimit(gEeprom.FM_Band) < Frequency) {
|
if (Frequency < BK1080_GetFreqLoLimit(gEeprom.FM_Band) ||
|
||||||
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
BK1080_GetFreqHiLimit(gEeprom.FM_Band) < Frequency) {
|
||||||
|
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||||
gRequestDisplayScreen = DISPLAY_FM;
|
gRequestDisplayScreen = DISPLAY_FM;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
gEeprom.FM_SelectedFrequency = (uint16_t)Frequency;
|
gEeprom.FM_SelectedFrequency = (uint16_t) Frequency;
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
gAnotherVoiceID = (VOICE_ID_t)Key;
|
gAnotherVoiceID = (VOICE_ID_t)Key;
|
||||||
#endif
|
#endif
|
||||||
@@ -300,8 +291,7 @@ static void Key_DIGITS(KEY_Code_t Key, uint8_t state)
|
|||||||
gRequestSaveFM = true;
|
gRequestSaveFM = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
} else if (gInputBoxIndex == 2) {
|
||||||
else if (gInputBoxIndex == 2) {
|
|
||||||
uint8_t Channel;
|
uint8_t Channel;
|
||||||
|
|
||||||
gInputBoxIndex = 0;
|
gInputBoxIndex = 0;
|
||||||
@@ -318,8 +308,7 @@ static void Key_DIGITS(KEY_Code_t Key, uint8_t state)
|
|||||||
gRequestSaveFM = true;
|
gRequestSaveFM = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
} else if (Channel < 20) {
|
||||||
else if (Channel < 20) {
|
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
gAnotherVoiceID = (VOICE_ID_t)Key;
|
gAnotherVoiceID = (VOICE_ID_t)Key;
|
||||||
#endif
|
#endif
|
||||||
@@ -336,19 +325,17 @@ static void Key_DIGITS(KEY_Code_t Key, uint8_t state)
|
|||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
gAnotherVoiceID = (VOICE_ID_t)Key;
|
gAnotherVoiceID = (VOICE_ID_t)Key;
|
||||||
#endif
|
#endif
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
Key_FUNC(Key, state);
|
Key_FUNC(Key, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Key_FUNC(KEY_Code_t Key, uint8_t state)
|
static void Key_FUNC(KEY_Code_t Key, uint8_t state) {
|
||||||
{
|
|
||||||
if (state == BUTTON_EVENT_SHORT || state == BUTTON_EVENT_HELD) {
|
if (state == BUTTON_EVENT_SHORT || state == BUTTON_EVENT_HELD) {
|
||||||
bool autoScan = gWasFKeyPressed || (state == BUTTON_EVENT_HELD);
|
bool autoScan = gWasFKeyPressed || (state == BUTTON_EVENT_HELD);
|
||||||
|
|
||||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||||
gWasFKeyPressed = false;
|
gWasFKeyPressed = false;
|
||||||
gUpdateStatus = true;
|
gUpdateStatus = true;
|
||||||
gRequestDisplayScreen = DISPLAY_FM;
|
gRequestDisplayScreen = DISPLAY_FM;
|
||||||
|
|
||||||
switch (Key) {
|
switch (Key) {
|
||||||
@@ -361,10 +348,10 @@ static void Key_FUNC(KEY_Code_t Key, uint8_t state)
|
|||||||
gRequestSaveFM = true;
|
gRequestSaveFM = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// case KEY_2:
|
// case KEY_2:
|
||||||
// gEeprom.FM_Space = (gEeprom.FM_Space + 1) % 3;
|
// gEeprom.FM_Space = (gEeprom.FM_Space + 1) % 3;
|
||||||
// gRequestSaveFM = true;
|
// gRequestSaveFM = true;
|
||||||
// break;
|
// break;
|
||||||
|
|
||||||
case KEY_3:
|
case KEY_3:
|
||||||
gEeprom.FM_IsMrMode = !gEeprom.FM_IsMrMode;
|
gEeprom.FM_IsMrMode = !gEeprom.FM_IsMrMode;
|
||||||
@@ -372,11 +359,30 @@ static void Key_FUNC(KEY_Code_t Key, uint8_t state)
|
|||||||
if (!FM_ConfigureChannelState()) {
|
if (!FM_ConfigureChannelState()) {
|
||||||
BK1080_SetFrequency(gEeprom.FM_FrequencyPlaying, gEeprom.FM_Band/*, gEeprom.FM_Space*/);
|
BK1080_SetFrequency(gEeprom.FM_FrequencyPlaying, gEeprom.FM_Band/*, gEeprom.FM_Space*/);
|
||||||
gRequestSaveFM = true;
|
gRequestSaveFM = true;
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case KEY_4:
|
||||||
|
gEeprom.BK1080_AGC_ENABLED = !gEeprom.BK1080_AGC_ENABLED;
|
||||||
|
BK1080_UpdateSysconf();
|
||||||
|
gRequestSaveSettings = true;
|
||||||
|
gRequestSaveFM = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case KEY_5:
|
||||||
|
gEeprom.BK1080_DEEMPHASIS_CONFIG++;
|
||||||
|
BK1080_UpdateSysconf();
|
||||||
|
gRequestSaveSettings = true;
|
||||||
|
gRequestSaveFM = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case KEY_6:
|
||||||
|
gEeprom.BK1080_BLEND_CONFIG++;
|
||||||
|
BK1080_UpdateSysconf();
|
||||||
|
gRequestSaveSettings = true;
|
||||||
|
gRequestSaveFM = true;
|
||||||
|
break;
|
||||||
case KEY_STAR:
|
case KEY_STAR:
|
||||||
ACTION_Scan(autoScan);
|
ACTION_Scan(autoScan);
|
||||||
break;
|
break;
|
||||||
@@ -388,24 +394,23 @@ static void Key_FUNC(KEY_Code_t Key, uint8_t state)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Key_EXIT(uint8_t state)
|
static void Key_EXIT(uint8_t state) {
|
||||||
{
|
|
||||||
if (state != BUTTON_EVENT_SHORT)
|
|
||||||
return;
|
|
||||||
|
|
||||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||||
|
|
||||||
if (gFM_ScanState == FM_SCAN_OFF) {
|
if (state == BUTTON_EVENT_SHORT) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gFM_ScanState == FM_SCAN_OFF || state == BUTTON_EVENT_LONG) {
|
||||||
if (gInputBoxIndex == 0) {
|
if (gInputBoxIndex == 0) {
|
||||||
if (!gAskToSave && !gAskToDelete) {
|
if (!gAskToSave && !gAskToDelete) {
|
||||||
ACTION_FM();
|
ACTION_FM();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
gAskToSave = false;
|
gAskToSave = false;
|
||||||
gAskToDelete = false;
|
gAskToDelete = false;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
gInputBox[--gInputBoxIndex] = 10;
|
gInputBox[--gInputBoxIndex] = 10;
|
||||||
|
|
||||||
if (gInputBoxIndex) {
|
if (gInputBoxIndex) {
|
||||||
@@ -425,8 +430,7 @@ static void Key_EXIT(uint8_t state)
|
|||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
gAnotherVoiceID = VOICE_ID_CANCEL;
|
gAnotherVoiceID = VOICE_ID_CANCEL;
|
||||||
#endif
|
#endif
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
FM_PlayAndUpdate();
|
FM_PlayAndUpdate();
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
gAnotherVoiceID = VOICE_ID_SCANNING_STOP;
|
gAnotherVoiceID = VOICE_ID_SCANNING_STOP;
|
||||||
@@ -436,14 +440,13 @@ static void Key_EXIT(uint8_t state)
|
|||||||
gRequestDisplayScreen = DISPLAY_FM;
|
gRequestDisplayScreen = DISPLAY_FM;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Key_MENU(uint8_t state)
|
static void Key_MENU(uint8_t state) {
|
||||||
{
|
|
||||||
if (state != BUTTON_EVENT_SHORT)
|
if (state != BUTTON_EVENT_SHORT)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
gRequestDisplayScreen = DISPLAY_FM;
|
gRequestDisplayScreen = DISPLAY_FM;
|
||||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||||
|
|
||||||
if (gFM_ScanState == FM_SCAN_OFF) {
|
if (gFM_ScanState == FM_SCAN_OFF) {
|
||||||
if (!gEeprom.FM_IsMrMode) {
|
if (!gEeprom.FM_IsMrMode) {
|
||||||
@@ -452,8 +455,7 @@ static void Key_MENU(uint8_t state)
|
|||||||
gRequestSaveFM = true;
|
gRequestSaveFM = true;
|
||||||
}
|
}
|
||||||
gAskToSave = !gAskToSave;
|
gAskToSave = !gAskToSave;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
if (gAskToDelete) {
|
if (gAskToDelete) {
|
||||||
gFM_Channels[gEeprom.FM_SelectedChannel] = 0xFFFF;
|
gFM_Channels[gEeprom.FM_SelectedChannel] = 0xFFFF;
|
||||||
|
|
||||||
@@ -464,10 +466,9 @@ static void Key_MENU(uint8_t state)
|
|||||||
}
|
}
|
||||||
gAskToDelete = !gAskToDelete;
|
gAskToDelete = !gAskToDelete;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
if (gFM_AutoScan || !gFM_FoundFrequency) {
|
if (gFM_AutoScan || !gFM_FoundFrequency) {
|
||||||
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||||
gInputBoxIndex = 0;
|
gInputBoxIndex = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -480,8 +481,7 @@ static void Key_MENU(uint8_t state)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Key_UP_DOWN(uint8_t state, int8_t Step)
|
static void Key_UP_DOWN(uint8_t state, int8_t Step) {
|
||||||
{
|
|
||||||
if (state == BUTTON_EVENT_PRESSED) {
|
if (state == BUTTON_EVENT_PRESSED) {
|
||||||
if (gInputBoxIndex) {
|
if (gInputBoxIndex) {
|
||||||
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||||
@@ -489,13 +489,13 @@ static void Key_UP_DOWN(uint8_t state, int8_t Step)
|
|||||||
}
|
}
|
||||||
|
|
||||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||||
} else if (gInputBoxIndex || state!=BUTTON_EVENT_HELD) {
|
} else if (gInputBoxIndex || state != BUTTON_EVENT_HELD) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gAskToSave) {
|
if (gAskToSave) {
|
||||||
gRequestDisplayScreen = DISPLAY_FM;
|
gRequestDisplayScreen = DISPLAY_FM;
|
||||||
gFM_ChannelPosition = NUMBER_AddWithWraparound(gFM_ChannelPosition, Step, 0, 19);
|
gFM_ChannelPosition = NUMBER_AddWithWraparound(gFM_ChannelPosition, Step, 0, 19);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -515,10 +515,9 @@ static void Key_UP_DOWN(uint8_t state, int8_t Step)
|
|||||||
if (Channel == 0xFF || gEeprom.FM_SelectedChannel == Channel)
|
if (Channel == 0xFF || gEeprom.FM_SelectedChannel == Channel)
|
||||||
goto Bail;
|
goto Bail;
|
||||||
|
|
||||||
gEeprom.FM_SelectedChannel = Channel;
|
gEeprom.FM_SelectedChannel = Channel;
|
||||||
gEeprom.FM_FrequencyPlaying = gFM_Channels[Channel];
|
gEeprom.FM_FrequencyPlaying = gFM_Channels[Channel];
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
uint16_t Frequency = gEeprom.FM_SelectedFrequency + Step;
|
uint16_t Frequency = gEeprom.FM_SelectedFrequency + Step;
|
||||||
|
|
||||||
if (Frequency < BK1080_GetFreqLoLimit(gEeprom.FM_Band))
|
if (Frequency < BK1080_GetFreqLoLimit(gEeprom.FM_Band))
|
||||||
@@ -526,20 +525,19 @@ static void Key_UP_DOWN(uint8_t state, int8_t Step)
|
|||||||
else if (Frequency > BK1080_GetFreqHiLimit(gEeprom.FM_Band))
|
else if (Frequency > BK1080_GetFreqHiLimit(gEeprom.FM_Band))
|
||||||
Frequency = BK1080_GetFreqLoLimit(gEeprom.FM_Band);
|
Frequency = BK1080_GetFreqLoLimit(gEeprom.FM_Band);
|
||||||
|
|
||||||
gEeprom.FM_FrequencyPlaying = Frequency;
|
gEeprom.FM_FrequencyPlaying = Frequency;
|
||||||
gEeprom.FM_SelectedFrequency = gEeprom.FM_FrequencyPlaying;
|
gEeprom.FM_SelectedFrequency = gEeprom.FM_FrequencyPlaying;
|
||||||
}
|
}
|
||||||
|
|
||||||
gRequestSaveFM = true;
|
gRequestSaveFM = true;
|
||||||
|
|
||||||
Bail:
|
Bail:
|
||||||
BK1080_SetFrequency(gEeprom.FM_FrequencyPlaying, gEeprom.FM_Band/*, gEeprom.FM_Space*/);
|
BK1080_SetFrequency(gEeprom.FM_FrequencyPlaying, gEeprom.FM_Band/*, gEeprom.FM_Space*/);
|
||||||
|
|
||||||
gRequestDisplayScreen = DISPLAY_FM;
|
gRequestDisplayScreen = DISPLAY_FM;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FM_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
void FM_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) {
|
||||||
{
|
|
||||||
uint8_t state = bKeyPressed + 2 * bKeyHeld;
|
uint8_t state = bKeyPressed + 2 * bKeyHeld;
|
||||||
|
|
||||||
switch (Key) {
|
switch (Key) {
|
||||||
@@ -572,14 +570,14 @@ void FM_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
|||||||
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
GUI_DisplayScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FM_Play(void)
|
void FM_Play(void) {
|
||||||
{
|
|
||||||
if (!FM_CheckFrequencyLock(gEeprom.FM_FrequencyPlaying, BK1080_GetFreqLoLimit(gEeprom.FM_Band))) {
|
if (!FM_CheckFrequencyLock(gEeprom.FM_FrequencyPlaying, BK1080_GetFreqLoLimit(gEeprom.FM_Band))) {
|
||||||
if (!gFM_AutoScan) {
|
if (!gFM_AutoScan) {
|
||||||
gFmPlayCountdown_10ms = 0;
|
gFmPlayCountdown_10ms = 0;
|
||||||
gFM_FoundFrequency = true;
|
gFM_FoundFrequency = true;
|
||||||
|
|
||||||
if (!gEeprom.FM_IsMrMode)
|
if (!gEeprom.FM_IsMrMode)
|
||||||
gEeprom.FM_SelectedFrequency = gEeprom.FM_FrequencyPlaying;
|
gEeprom.FM_SelectedFrequency = gEeprom.FM_FrequencyPlaying;
|
||||||
@@ -609,24 +607,23 @@ void FM_Play(void)
|
|||||||
GUI_SelectNextDisplay(DISPLAY_FM);
|
GUI_SelectNextDisplay(DISPLAY_FM);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FM_Start(void)
|
void FM_Start(void) {
|
||||||
{
|
gDualWatchActive = false;
|
||||||
gDualWatchActive = false;
|
gFmRadioMode = true;
|
||||||
gFmRadioMode = true;
|
gFM_ScanState = FM_SCAN_OFF;
|
||||||
gFM_ScanState = FM_SCAN_OFF;
|
|
||||||
gFM_RestoreCountdown_10ms = 0;
|
gFM_RestoreCountdown_10ms = 0;
|
||||||
|
|
||||||
BK1080_Init(gEeprom.FM_FrequencyPlaying, gEeprom.FM_Band/*, gEeprom.FM_Space*/);
|
BK1080_Init(gEeprom.FM_FrequencyPlaying, gEeprom.FM_Band/*, gEeprom.FM_Space*/);
|
||||||
|
|
||||||
AUDIO_AudioPathOn();
|
AUDIO_AudioPathOn();
|
||||||
|
|
||||||
gEnableSpeaker = true;
|
gEnableSpeaker = true;
|
||||||
gUpdateStatus = true;
|
gUpdateStatus = true;
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_RESUME_STATE
|
#ifdef ENABLE_FEAT_F4HWN_RESUME_STATE
|
||||||
gEeprom.CURRENT_STATE = 3;
|
gEeprom.CURRENT_STATE = 3;
|
||||||
SETTINGS_WriteCurrentState();
|
SETTINGS_WriteCurrentState();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
+991
@@ -0,0 +1,991 @@
|
|||||||
|
//
|
||||||
|
// Created by bruno on 25.2.2025.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "fskmodem.h"
|
||||||
|
#include "app/pocsag.h"
|
||||||
|
//#include "messages.h"
|
||||||
|
#include "driver/uart.h"
|
||||||
|
#include "../ui/messages.h"
|
||||||
|
#include "ui/ui.h"
|
||||||
|
|
||||||
|
uint16_t TONE2_FREQ;
|
||||||
|
|
||||||
|
DataPacket dataPacket;
|
||||||
|
|
||||||
|
DataPacket inBoundPacket;
|
||||||
|
|
||||||
|
char *dataPTR = gMessageText;
|
||||||
|
|
||||||
|
SMSEnteringState gEnteringSMS = SMS_NOT_ENTERING;
|
||||||
|
|
||||||
|
SMSResponseState gSMSResponseState = SMS_RESPONSE_IDLE;
|
||||||
|
|
||||||
|
bool gGotACK = false;
|
||||||
|
|
||||||
|
uint8_t SMSResponseCounter = 0;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
Receiving,
|
||||||
|
Ready
|
||||||
|
} RXState;
|
||||||
|
|
||||||
|
RXState rxState = Ready;
|
||||||
|
|
||||||
|
uint8_t SMSResponseCounterTarget = 6;
|
||||||
|
|
||||||
|
#ifdef ENABLE_POCSAG
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// POCSAG 1200 modem (BK4819 native 2-FSK, NRZ)
|
||||||
|
//
|
||||||
|
// * Each 16-bit word in the FSK FIFO (REG_5F) goes on air LOW byte first (each
|
||||||
|
// byte MSB first). Verified with a URH capture of this firmware.
|
||||||
|
// * POCSAG sends a logical 1 as the LOWER frequency. The BK4819 sends a raw 1 as
|
||||||
|
// the higher one, so every bit is inverted on the way in and out of the FIFO.
|
||||||
|
// Both the TX path and the RX sync pattern follow POCSAG_INVERT.
|
||||||
|
// * The chip always prepends its own preamble + 4 byte sync. Its sync is set to the
|
||||||
|
// preamble pattern (1010..., the same in either byte order) for TX and RX:
|
||||||
|
// - TX: it just extends the 576 bit POCSAG preamble; the real preamble and sync
|
||||||
|
// codeword are part of the encoded frame.
|
||||||
|
// - RX: the chip locks somewhere in the preamble and captures a full frame;
|
||||||
|
// POCSAG_Decode() then finds the sync codeword at bit level.
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
#ifndef POCSAG_INVERT
|
||||||
|
#define POCSAG_INVERT 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// REG_40<11:0> FM deviation for POCSAG (+-4.5 kHz nominal). 899 (reference fork)
|
||||||
|
// gave a ~6 kHz tone spacing; tune live with keys 2/8 on the messages screen.
|
||||||
|
#ifndef POCSAG_DEVIATION
|
||||||
|
#define POCSAG_DEVIATION 963U // measured: decodes on a CC1101 POCSAG receiver at Tone2 gain 127
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// REG_70<6:0> Tone2 gain = FSK TX level (0..127). Max: the BK4819 FSK shift is on the low side.
|
||||||
|
#ifndef POCSAG_TONE2_GAIN
|
||||||
|
#define POCSAG_TONE2_GAIN 127U
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define POCSAG_REG58 0x03C1U // FSK 1.2K TX/RX, 1.2K RX BW, 0xAA/0x55 preamble, RX gain 3, FSK on
|
||||||
|
#define POCSAG_REG59 ((6U << 4) | FSK_SYNC_LEN_BIT) // 7 byte chip preamble, 4 byte sync, no scramble
|
||||||
|
#define POCSAG_REG5C 0xAA30U // CRC off
|
||||||
|
// POCSAG 512 / 1200 / 2400 baud, selected by the modem mode
|
||||||
|
static uint16_t POCSAG_Baud(void)
|
||||||
|
{
|
||||||
|
switch (gEeprom.FSKMode) {
|
||||||
|
case MOD_POCSAG_512: return 512;
|
||||||
|
case MOD_POCSAG_2400: return 2400;
|
||||||
|
default: return 1200;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// REG_72 = baud * 10.32444 (1200 -> 0x3065)
|
||||||
|
#define POCSAG_REG72(baud) ((uint16_t) (((uint32_t) (baud) * 103244UL + 5000UL) / 10000UL))
|
||||||
|
// wider FSK RX bandwidth for 2400 baud
|
||||||
|
#define POCSAG_REG58_FOR(baud) (POCSAG_REG58 | ((baud) > 1200U ? FSK_RX_BW_2_4K_FFSK_1200_2400 : FSK_RX_BW_1_2K))
|
||||||
|
#define POCSAG_RX_BYTES POCSAG_MAX_FRAME_SIZE // captured after the chip locks on the preamble
|
||||||
|
#define POCSAG_CHIP_SYNC 0xAAAAU // logical preamble pattern
|
||||||
|
|
||||||
|
// REG_43 for POCSAG: +-4.5 kHz deviation at 1200 baud occupies ~10.2 kHz (Carson),
|
||||||
|
// so use 25 kHz channel mode with a 7.5 kHz RF filter, kept wide for weak signals too.
|
||||||
|
#define POCSAG_REG43 ((4U << 12) | /* RF filter 3.75 kHz (x2 in 25k mode) */ \
|
||||||
|
(4U << 9) | /* same RF filter when the signal is weak */ \
|
||||||
|
(6U << 6) | /* TX AF LPF (bypassed for FSK) */ \
|
||||||
|
(2U << 4) | /* 25 kHz channel mode */ \
|
||||||
|
(1U << 3))
|
||||||
|
|
||||||
|
#if POCSAG_DEVIATION_TUNING
|
||||||
|
// Runtime-tunable TX deviation (REG_40<11:0>), keys 2/8 on the messages screen.
|
||||||
|
uint16_t gPocsagDeviation = POCSAG_DEVIATION;
|
||||||
|
|
||||||
|
void POCSAG_AdjustDeviation(const int delta)
|
||||||
|
{
|
||||||
|
char text[12] = "DEV ";
|
||||||
|
int value = (int) gPocsagDeviation + delta;
|
||||||
|
|
||||||
|
if (value < 0x40)
|
||||||
|
value = 0x40;
|
||||||
|
if (value > 0x0FFF)
|
||||||
|
value = 0x0FFF;
|
||||||
|
gPocsagDeviation = (uint16_t) value;
|
||||||
|
|
||||||
|
itoa(gPocsagDeviation, text + 4);
|
||||||
|
UI_DisplayPopup(text);
|
||||||
|
gUpdateDisplay = true;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
#define gPocsagDeviation POCSAG_DEVIATION
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static uint16_t POCSAG_Raw16(const uint16_t logical)
|
||||||
|
{
|
||||||
|
return POCSAG_INVERT ? (uint16_t) ~logical : logical;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void POCSAG_ConfigureModem(const bool rx)
|
||||||
|
{
|
||||||
|
// The FSK modulator is driven through Tone2: with Tone2 disabled / gain 0 the
|
||||||
|
// carrier barely shifts. The gain (together with REG_40) sets the FSK deviation.
|
||||||
|
BK4819_WriteRegister(BK4819_REG_70, TONE2_ENABLE_BIT | (POCSAG_TONE2_GAIN & TONE2_GAIN_MASK));
|
||||||
|
const uint16_t baud = POCSAG_Baud();
|
||||||
|
BK4819_WriteRegister(BK4819_REG_72, POCSAG_REG72(baud));
|
||||||
|
BK4819_WriteRegister(BK4819_REG_58, POCSAG_REG58_FOR(baud));
|
||||||
|
|
||||||
|
if (rx) {
|
||||||
|
// "FSK" channel bandwidth: BK4819_SetFilterBandwidth() leaves REG_43 alone,
|
||||||
|
// so pick the filter the POCSAG signal needs.
|
||||||
|
if (gRxVfo->CHANNEL_BANDWIDTH == BK4819_FILTER_BW_FSK_OFFLOAD)
|
||||||
|
BK4819_WriteRegister(BK4819_REG_43, POCSAG_REG43);
|
||||||
|
|
||||||
|
}
|
||||||
|
BK4819_WriteRegister(BK4819_REG_5A, POCSAG_Raw16(POCSAG_CHIP_SYNC));
|
||||||
|
BK4819_WriteRegister(BK4819_REG_5B, POCSAG_Raw16(POCSAG_CHIP_SYNC));
|
||||||
|
BK4819_WriteRegister(BK4819_REG_5C, POCSAG_REG5C);
|
||||||
|
BK4819_WriteRegister(BK4819_REG_5E, (64U << 3) | 4U); // RX FIFO almost full: 4 words
|
||||||
|
|
||||||
|
// REG_5D<15:8> = data length - 1 (bytes)
|
||||||
|
const uint16_t length = rx ? POCSAG_RX_BYTES : POCSAG_MAX_FRAME_SIZE;
|
||||||
|
BK4819_WriteRegister(BK4819_REG_5D, (uint16_t) ((length - 1U) << 8));
|
||||||
|
|
||||||
|
BK4819_WriteRegister(BK4819_REG_59, FSK_CLEAR_TX_FIFO | FSK_CLEAR_RX_FIFO | POCSAG_REG59);
|
||||||
|
BK4819_WriteRegister(BK4819_REG_59, POCSAG_REG59);
|
||||||
|
// No REG_02 write here: this also runs from inside the interrupt loop (RX re-arm)
|
||||||
|
// and clearing REG_02 there drops pending events such as squelch close.
|
||||||
|
}
|
||||||
|
|
||||||
|
static uint8_t pocsagRxBuffer[POCSAG_RX_BYTES];
|
||||||
|
static size_t pocsagRxSize;
|
||||||
|
static uint32_t lastPocsagSender;
|
||||||
|
static char lastPocsagMessage[POCSAG_MAX_MESSAGE_LENGTH + 1U];
|
||||||
|
static uint8_t pocsagDuplicateTimeout;
|
||||||
|
|
||||||
|
// New page alert: yellow (red + green) LED flashing and a speaker beep. The beep
|
||||||
|
// waits until RX has ended, AUDIO_PlayBeep() does nothing while receiving.
|
||||||
|
#define POCSAG_ALERT_FLASHES 10U // 500 ms half periods
|
||||||
|
static uint8_t pocsagAlertTicks;
|
||||||
|
static bool pocsagBeepPending;
|
||||||
|
|
||||||
|
static void POCSAG_StartAlert(void)
|
||||||
|
{
|
||||||
|
pocsagAlertTicks = POCSAG_ALERT_FLASHES;
|
||||||
|
pocsagBeepPending = true;
|
||||||
|
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1_RED, true);
|
||||||
|
BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2_GREEN, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void POCSAG_AlertTimeSlice500ms(void)
|
||||||
|
{
|
||||||
|
if (pocsagAlertTicks > 0) {
|
||||||
|
pocsagAlertTicks--;
|
||||||
|
const bool on = (pocsagAlertTicks & 1U) != 0;
|
||||||
|
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1_RED, on);
|
||||||
|
BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2_GREEN, on);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pocsagBeepPending && !FUNCTION_IsRx() && gCurrentFunction != FUNCTION_TRANSMIT) {
|
||||||
|
pocsagBeepPending = false;
|
||||||
|
AUDIO_PlayBeep(BEEP_880HZ_60MS_DOUBLE_BEEP); // not affected by the key beep setting
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // ENABLE_POCSAG
|
||||||
|
|
||||||
|
void FSKModem_TimeSlice500ms(void) {
|
||||||
|
#ifdef ENABLE_POCSAG
|
||||||
|
if (MODEM_IS_POCSAG(gEeprom.FSKMode)) {
|
||||||
|
if (pocsagDuplicateTimeout > 0)
|
||||||
|
pocsagDuplicateTimeout--;
|
||||||
|
POCSAG_AlertTimeSlice500ms();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (SMSResponseCounter && FUNCTION_IsRx() && SMSResponseCounter++ > SMSResponseCounterTarget) {
|
||||||
|
switch (gSMSResponseState) {
|
||||||
|
case SMS_RESPONSE_ACK:
|
||||||
|
MSG_FSKSendData(&inBoundPacket);
|
||||||
|
gSMSResponseState = SMS_RESPONSE_IDLE;
|
||||||
|
SMSResponseCounter = 0;
|
||||||
|
break;
|
||||||
|
case SMS_RESPONSE_RETRANSMIT:
|
||||||
|
MSG_FSKSendData(&inBoundPacket);
|
||||||
|
gSMSResponseState = SMS_RESPONSE_IDLE;
|
||||||
|
SMSResponseCounter = 0;
|
||||||
|
break;
|
||||||
|
case SMS_RESPONSE_RESEND:
|
||||||
|
MSG_FSKSendData(&dataPacket);
|
||||||
|
gSMSResponseState = SMS_RESPONSE_IDLE;
|
||||||
|
SMSResponseCounter = 0;
|
||||||
|
break;
|
||||||
|
case SMS_RESPONSE_ACK_LIGHT:
|
||||||
|
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1_RED, false);
|
||||||
|
BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2_GREEN, false);
|
||||||
|
gSMSResponseState = SMS_RESPONSE_IDLE;
|
||||||
|
SMSResponseCounter = 0;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MSG_ConfigureFSK(bool rx) {
|
||||||
|
#ifdef ENABLE_POCSAG
|
||||||
|
if (MODEM_IS_POCSAG(gEeprom.FSKMode)) {
|
||||||
|
POCSAG_ConfigureModem(rx);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// quick helper
|
||||||
|
bool isAFSK = (gEeprom.FSKMode == MOD_AFSK_1200 ||
|
||||||
|
gEeprom.FSKMode == MOD_AFSK_2400 ||
|
||||||
|
gEeprom.FSKMode == MOD_NOAA_SAME);
|
||||||
|
|
||||||
|
|
||||||
|
// Base tone config
|
||||||
|
uint16_t tone1 = 0, tone2 = 0;
|
||||||
|
#define BK4819_FREQ_WORD(freq_hz) ((uint16_t)((freq_hz) * 10.32444f))
|
||||||
|
|
||||||
|
if (isAFSK) {
|
||||||
|
// Bell-202 style tones for AFSK/NOAA
|
||||||
|
switch (gEeprom.FSKMode) {
|
||||||
|
case MOD_AFSK_1200:
|
||||||
|
tone1 = BK4819_FREQ_WORD(1200.0f); // mark
|
||||||
|
tone2 = BK4819_FREQ_WORD(2200.0f); // space
|
||||||
|
break;
|
||||||
|
case MOD_AFSK_2400:
|
||||||
|
tone1 = BK4819_FREQ_WORD(1200.0f);
|
||||||
|
tone2 = BK4819_FREQ_WORD(2400.0f);
|
||||||
|
break;
|
||||||
|
case MOD_NOAA_SAME:
|
||||||
|
tone1 = BK4819_FREQ_WORD(1562.5f); // typical mark
|
||||||
|
tone2 = BK4819_FREQ_WORD(2083.3f); // typical space
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
tone1 = BK4819_FREQ_WORD(1200.0f);
|
||||||
|
tone2 = BK4819_FREQ_WORD(2200.0f);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
BK4819_WriteRegister(BK4819_REG_71, tone1);
|
||||||
|
BK4819_WriteRegister(BK4819_REG_72, tone2);
|
||||||
|
// enable both tones
|
||||||
|
BK4819_WriteRegister(BK4819_REG_70,
|
||||||
|
TONE1_ENABLE_BIT | TONE2_ENABLE_BIT |
|
||||||
|
(96U << 8) | (96U << 0));
|
||||||
|
} else {
|
||||||
|
// plain FSK path: only TONE2 used (frequency for binary shift display/debug)
|
||||||
|
switch (gEeprom.FSKMode) {
|
||||||
|
case MOD_FSK_450:
|
||||||
|
tone2 = BK4819_FREQ_WORD(450.0f);
|
||||||
|
break;
|
||||||
|
case MOD_FSK_700:
|
||||||
|
tone2 = BK4819_FREQ_WORD(700.0f);
|
||||||
|
break;
|
||||||
|
case MOD_FSK_1200:
|
||||||
|
tone2 = BK4819_FREQ_WORD(1200.0f);
|
||||||
|
break;
|
||||||
|
case MOD_FSK_2400:
|
||||||
|
tone2 = BK4819_FREQ_WORD(2400.0f);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
tone2 = BK4819_FREQ_WORD(1200.0f);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
BK4819_WriteRegister(BK4819_REG_72, tone2);
|
||||||
|
BK4819_WriteRegister(BK4819_REG_70, TONE2_ENABLE_BIT | (96U << 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Base FSK config
|
||||||
|
uint16_t fskConfig = FSK_ENABLE_BIT | FSK_PREAMBLE_TYPE_AA;
|
||||||
|
|
||||||
|
// Compose the correct fields into REG_58:
|
||||||
|
// - TX mode bits are at <15:13> (use your FSK_TX_MODE_* macros which are <<13)
|
||||||
|
// - RX mode bits are at <12:10> (use your FSK_RX_MODE_* macros which are <<10)
|
||||||
|
// - RX BW bits are at <3:1> (use your FSK_RX_BW_* macros which are <<1)
|
||||||
|
switch (gEeprom.FSKMode) {
|
||||||
|
case MOD_AFSK_1200:
|
||||||
|
fskConfig |= FSK_TX_MODE_FFSK_1200_1800 /*<<13 in macro*/
|
||||||
|
| FSK_RX_MODE_FFSK_1200_1800 /*<<10 in macro*/
|
||||||
|
| FSK_RX_BW_FFSK_1200_1800; /*<<1 in macro*/
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MOD_AFSK_2400:
|
||||||
|
fskConfig |= FSK_TX_MODE_FFSK_1200_2400
|
||||||
|
| FSK_RX_MODE_FFSK_1200_2400
|
||||||
|
| FSK_RX_BW_2_4K_FFSK_1200_2400;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MOD_NOAA_SAME:
|
||||||
|
fskConfig |= FSK_TX_MODE_NOAA_SAME
|
||||||
|
| FSK_RX_MODE_FSK_1_2K_2_4K_NOAA
|
||||||
|
| FSK_RX_BW_NOAA_SAME;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MOD_FSK_2400:
|
||||||
|
// binary FSK 1.2k/2.4k - use default FSK TX/RX modes and 1.2k BW
|
||||||
|
fskConfig |= FSK_TX_MODE_FSK_1_2K_2_4K
|
||||||
|
| FSK_RX_MODE_FSK_1_2K_2_4K_NOAA
|
||||||
|
| FSK_RX_BW_2_4K_FFSK_1200_2400;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MOD_FSK_700:
|
||||||
|
case MOD_FSK_450:
|
||||||
|
case MOD_FSK_1200:
|
||||||
|
default:
|
||||||
|
// binary FSK 1.2k/2.4k - use default FSK TX/RX modes and 1.2k BW
|
||||||
|
fskConfig |= FSK_TX_MODE_FSK_1_2K_2_4K
|
||||||
|
| FSK_RX_MODE_FSK_1_2K_2_4K_NOAA
|
||||||
|
| FSK_RX_BW_1_2K;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BK4819_WriteRegister(BK4819_REG_58, fskConfig);
|
||||||
|
|
||||||
|
BK4819_WriteRegister(BK4819_REG_5A, FSK_SYNC_BYTE0 << 8 | FSK_SYNC_BYTE1);
|
||||||
|
BK4819_WriteRegister(BK4819_REG_5B, FSK_SYNC_BYTE2 << 8 | FSK_SYNC_BYTE3);
|
||||||
|
BK4819_WriteRegister(BK4819_REG_5C, FSK_CRC_ON);
|
||||||
|
|
||||||
|
if (rx) {
|
||||||
|
uint8_t threshold;
|
||||||
|
switch (gEeprom.FSKMode) {
|
||||||
|
case MOD_AFSK_1200:
|
||||||
|
case MOD_NOAA_SAME:
|
||||||
|
threshold = 1U;
|
||||||
|
break;
|
||||||
|
case MOD_AFSK_2400:
|
||||||
|
threshold = 2U; // Slightly higher; 2400 baud can fill FIFO faster
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
threshold = 4U; // FSK modes
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
BK4819_WriteRegister(BK4819_REG_5E, (64U << 3) | threshold);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Data length (REG_5D<15:8>)
|
||||||
|
size_t size = sizeof(dataPacket);
|
||||||
|
if (rx) size = (((size + 1) / 2) * 2) + 2;
|
||||||
|
BK4819_WriteRegister(BK4819_REG_5D, (size << 8));
|
||||||
|
|
||||||
|
BK4819_FskClearFifo();
|
||||||
|
|
||||||
|
// REG_59: clear flags, preamble len, sync len etc.
|
||||||
|
//uint16_t fskParams = FSK_SYNC_LEN_BIT | ((rx ? 0U : 15U) << 4);
|
||||||
|
uint16_t preamble_len = (gEeprom.FSKMode == MOD_AFSK_1200 || gEeprom.FSKMode == MOD_AFSK_2400 || gEeprom.FSKMode == MOD_NOAA_SAME) ? 10U : (rx ? 0U
|
||||||
|
: 15U);
|
||||||
|
uint16_t fskParams = FSK_SYNC_LEN_BIT | (preamble_len << 4);
|
||||||
|
if (gCurrentVfo->SCRAMBLING_TYPE > 0) fskParams |= FSK_SCRAMBLE_ENABLE;
|
||||||
|
BK4819_WriteRegister(BK4819_REG_59, fskParams);
|
||||||
|
|
||||||
|
|
||||||
|
// Clear interrupt flags
|
||||||
|
BK4819_WriteRegister(BK4819_REG_02, 0);
|
||||||
|
|
||||||
|
// Enable AF path filters for tone demodulation in AFSK/NOAA modes
|
||||||
|
if (gEeprom.FSKMode == MOD_AFSK_1200 ||
|
||||||
|
gEeprom.FSKMode == MOD_AFSK_2400 ||
|
||||||
|
gEeprom.FSKMode == MOD_NOAA_SAME) {
|
||||||
|
|
||||||
|
// Keep DC cancel, disable only deemphasis
|
||||||
|
BK4819_WriteRegister(BK4819_REG_2B,
|
||||||
|
(1U << 15) | (1U << 14) | (1U << 8));
|
||||||
|
} else {
|
||||||
|
|
||||||
|
//BK4819_WriteRegister(BK4819_REG_2B, (1u << 2) | (1u << 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// set the FM deviation level
|
||||||
|
const uint16_t dev_val = BK4819_ReadRegister(BK4819_REG_40);
|
||||||
|
|
||||||
|
uint16_t deviation;
|
||||||
|
switch (gEeprom.FSKMode) {
|
||||||
|
case MOD_AFSK_1200:
|
||||||
|
case MOD_AFSK_2400:
|
||||||
|
case MOD_NOAA_SAME:
|
||||||
|
deviation = 650; // 0.65 kHz for audio-based tones (linear region)
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MOD_FSK_450:
|
||||||
|
deviation = 225; // ≈ half of 450 Hz separation
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MOD_FSK_700:
|
||||||
|
deviation = 350; // ≈ half of 700 Hz separation
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MOD_FSK_1200:
|
||||||
|
deviation = 600; // halfway between 1200 and 2400 = 1.8 kHz spacing → ±900 Hz dev
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MOD_FSK_2400:
|
||||||
|
deviation = 1200; // halfway between 1200 and 2400 = 1.8 kHz spacing → ±900 Hz dev
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
deviation = 750; // safe fallback
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (gCurrentVfo->CHANNEL_BANDWIDTH == BK4819_FILTER_BW_FSK_OFFLOAD) {
|
||||||
|
BK4819_WriteRegister(BK4819_REG_40, (dev_val & 0xf000) | (deviation & 0x0fff));
|
||||||
|
}
|
||||||
|
|
||||||
|
// restore FM deviation level
|
||||||
|
//BK4819_WriteRegister(BK4819_REG_40, dev_val);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
uint16_t calculateCRC(uint8_t *data, size_t length) {
|
||||||
|
uint16_t crc = 0xFFFF; // Example CRC-16 initialization
|
||||||
|
for (size_t i = 0; i < length; i++) {
|
||||||
|
crc ^= data[i];
|
||||||
|
for (uint8_t j = 0; j < 8; j++) {
|
||||||
|
if (crc & 1) {
|
||||||
|
crc = (crc >> 1) ^ 0xA001; // Example polynomial (CRC-16-IBM)
|
||||||
|
} else {
|
||||||
|
crc >>= 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return crc;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void processReceivedPacket(DataPacket *packet) {
|
||||||
|
char String[18];
|
||||||
|
char numBuf[11]; // Enough for any 64-bit unsigned integer
|
||||||
|
const unsigned int vfo = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.RX_VFO
|
||||||
|
: gEeprom.TX_VFO;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
uint16_t ID;
|
||||||
|
uint16_t Size;
|
||||||
|
} Header_t;
|
||||||
|
|
||||||
|
Header_t Header;
|
||||||
|
Header.ID = 0x06FE;
|
||||||
|
Header.Size = sizeof(DataPacket);
|
||||||
|
UART_Send(&Header, sizeof(Header));
|
||||||
|
UART_Send(packet, sizeof(DataPacket));
|
||||||
|
if (packet->dest == gEeprom.FSKSRCAddress) {
|
||||||
|
if ((packet->flags & 0x80)) {
|
||||||
|
if (packet->flags & 0x40) {
|
||||||
|
uint16_t crcSent = calculateCRC(dataPacket.data, 20);
|
||||||
|
uint16_t crcGot = inBoundPacket.data[0] | (inBoundPacket.data[1] << 8);
|
||||||
|
if (crcSent == crcGot) {
|
||||||
|
gGotACK = true;
|
||||||
|
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1_RED, true);
|
||||||
|
BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2_GREEN, true);
|
||||||
|
SMSResponseCounter = 1;
|
||||||
|
gSMSResponseState = SMS_RESPONSE_ACK_LIGHT;
|
||||||
|
} else {
|
||||||
|
if (--dataPacket.ttl) {
|
||||||
|
gSMSResponseState = SMS_RESPONSE_RESEND;
|
||||||
|
SMSResponseCounter = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
AUDIO_PlayBeep(BEEP_500HZ_60MS_DOUBLE_BEEP);
|
||||||
|
BK4819_PlaySingleTone(1000, 250, 127, true);
|
||||||
|
strcpy(String, "SMS by ");
|
||||||
|
itoa(packet->src, numBuf); // Convert number to string
|
||||||
|
strcat(String, numBuf);
|
||||||
|
MESSAGES_SAVE(inBoundPacket.src, inBoundPacket.seq, inBoundPacket.ttl, inBoundPacket.flags,
|
||||||
|
inBoundPacket.data, DataPacketDataSize);
|
||||||
|
gRequestDisplayScreen = DISPLAY_MESSAGES;
|
||||||
|
GUI_SelectNextDisplay(gRequestDisplayScreen);
|
||||||
|
MESSAGES_ShowNewest();
|
||||||
|
UI_DisplayPopup(String);
|
||||||
|
inBoundPacket.flags |= 0x40;
|
||||||
|
inBoundPacket.dest = inBoundPacket.src;
|
||||||
|
inBoundPacket.src = gEeprom.FSKSRCAddress;
|
||||||
|
uint16_t crcTest = calculateCRC(inBoundPacket.data, 20);
|
||||||
|
memset(inBoundPacket.data, 0, DataPacketDataSize);
|
||||||
|
inBoundPacket.data[0] = crcTest & 0xFF;
|
||||||
|
inBoundPacket.data[1] = (crcTest >> 8) & 0xFF;
|
||||||
|
gSMSResponseState = SMS_RESPONSE_ACK;
|
||||||
|
SMSResponseCounter = 1;
|
||||||
|
UI_PrintStringSmallNormal(String, 2, 0, 4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (VfoState[vfo] == VFO_STATE_NORMAL && !TX_freq_check(gCurrentVfo->freq_config_TX.Frequency)) {
|
||||||
|
if (packet->ttl--) {
|
||||||
|
SMSResponseCounter = 1;
|
||||||
|
gSMSResponseState = SMS_RESPONSE_RETRANSMIT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef ENABLE_POCSAG
|
||||||
|
static void MSG_POCSAGStoreReceived(void);
|
||||||
|
|
||||||
|
// The chip locks somewhere in the preamble, so it usually has not collected all
|
||||||
|
// POCSAG_RX_BYTES when the carrier drops. Squelch close / VFO switching re-arms
|
||||||
|
// RX through here: decode what was captured before it is thrown away.
|
||||||
|
static void POCSAG_FlushCapture(void)
|
||||||
|
{
|
||||||
|
if (!MODEM_IS_POCSAG(gEeprom.FSKMode) || rxState != Receiving)
|
||||||
|
return;
|
||||||
|
|
||||||
|
rxState = Ready;
|
||||||
|
if (pocsagRxSize >= 4U * 3U) // at least sync + address + one message word
|
||||||
|
MSG_POCSAGStoreReceived();
|
||||||
|
pocsagRxSize = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // ENABLE_POCSAG
|
||||||
|
|
||||||
|
void MSG_EnableRX(const bool enable) {
|
||||||
|
#ifdef ENABLE_POCSAG
|
||||||
|
POCSAG_FlushCapture();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (enable) {
|
||||||
|
MSG_ConfigureFSK(true);
|
||||||
|
|
||||||
|
//if(gEeprom.MESSENGER_CONFIG.data.receive)
|
||||||
|
BK4819_FskEnableRx();
|
||||||
|
} else {
|
||||||
|
BK4819_WriteRegister(BK4819_REG_70, 0);
|
||||||
|
BK4819_WriteRegister(BK4819_REG_58, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Common end of a data transmission (SMS and POCSAG): back to RX, FSK RX re-armed.
|
||||||
|
static void MSG_EndDataTransmission(const bool audioWasEnabled)
|
||||||
|
{
|
||||||
|
APP_EndTransmission();
|
||||||
|
FUNCTION_Select(FUNCTION_FOREGROUND);
|
||||||
|
gUpdateStatus = true;
|
||||||
|
gUpdateDisplay = true;
|
||||||
|
gFlagEndTransmission = false;
|
||||||
|
|
||||||
|
if (audioWasEnabled) {
|
||||||
|
AUDIO_AudioPathOn();
|
||||||
|
gEnableSpeaker = true;
|
||||||
|
BK4819_ExitTxMute();
|
||||||
|
}
|
||||||
|
|
||||||
|
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1_RED, false);
|
||||||
|
MSG_EnableRX(true);
|
||||||
|
gVfoConfigureMode = VFO_CONFIGURE;
|
||||||
|
dataPTR = gMessageText;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef ENABLE_POCSAG
|
||||||
|
void MSG_POCSAGSend(const uint32_t ric, const char *text)
|
||||||
|
{
|
||||||
|
uint8_t frame[POCSAG_MAX_FRAME_SIZE];
|
||||||
|
size_t frameSize;
|
||||||
|
const unsigned int vfo = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.RX_VFO
|
||||||
|
: gEeprom.TX_VFO;
|
||||||
|
|
||||||
|
if (!POCSAG_Encode(ric, text, frame, sizeof(frame), &frameSize)) {
|
||||||
|
AUDIO_PlayBeep(BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (VfoState[vfo] != VFO_STATE_NORMAL || TX_freq_check(gCurrentVfo->freq_config_TX.Frequency))
|
||||||
|
return;
|
||||||
|
|
||||||
|
const bool audioWasEnabled = gEnableSpeaker;
|
||||||
|
|
||||||
|
RADIO_PrepareTX();
|
||||||
|
if (gCurrentFunction != FUNCTION_TRANSMIT)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Registers changed for the data burst, restored before returning to RX.
|
||||||
|
static const BK4819_REGISTER_t savedRegs[] = {
|
||||||
|
BK4819_REG_2B, BK4819_REG_31, BK4819_REG_3F, BK4819_REG_40,
|
||||||
|
BK4819_REG_43, BK4819_REG_4B, BK4819_REG_51, BK4819_REG_7E,
|
||||||
|
BK4819_REG_30,
|
||||||
|
};
|
||||||
|
uint16_t saved[ARRAY_SIZE(savedRegs)];
|
||||||
|
for (unsigned int i = 0; i < ARRAY_SIZE(savedRegs); i++)
|
||||||
|
saved[i] = BK4819_ReadRegister(savedRegs[i]);
|
||||||
|
|
||||||
|
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1_RED, true);
|
||||||
|
|
||||||
|
// Clean, flat, wide FM path for the NRZ data:
|
||||||
|
BK4819_WriteRegister(BK4819_REG_30, saved[8] & ~BK4819_REG_30_MASK_ENABLE_MIC_ADC); // mic off
|
||||||
|
BK4819_WriteRegister(BK4819_REG_51, 0); // no CTCSS/DCS
|
||||||
|
BK4819_WriteRegister(BK4819_REG_31, saved[1] & ~((1U << 1) | (1U << 3))); // scrambler + compander off
|
||||||
|
BK4819_WriteRegister(BK4819_REG_2B, (saved[0] & 0xF8F8U) | 0x0707U); // bypass AF filters + emphasis
|
||||||
|
BK4819_WriteRegister(BK4819_REG_7E, saved[7] & 0xFFC0U); // DC filters off
|
||||||
|
BK4819_WriteRegister(BK4819_REG_4B, saved[5] | (1U << 5)); // ALC off
|
||||||
|
BK4819_WriteRegister(BK4819_REG_43, POCSAG_REG43); // 25 kHz channel for +-4.5 kHz
|
||||||
|
BK4819_WriteRegister(BK4819_REG_40, (saved[3] & 0xE000U) | (1U << 12) | (gPocsagDeviation & 0x0FFFU));
|
||||||
|
|
||||||
|
POCSAG_ConfigureModem(false);
|
||||||
|
BK4819_WriteRegister(BK4819_REG_3F, BK4819_REG_3F_FSK_TX_FINISHED);
|
||||||
|
|
||||||
|
// Low byte of each FIFO word is transmitted first.
|
||||||
|
for (size_t i = 0; i + 1U < frameSize; i += 2U)
|
||||||
|
BK4819_WriteRegister(BK4819_REG_5F, POCSAG_Raw16((uint16_t) (frame[i] | (frame[i + 1U] << 8))));
|
||||||
|
|
||||||
|
SYSTEM_DelayMs(20);
|
||||||
|
BK4819_FskEnableTx();
|
||||||
|
|
||||||
|
// chip preamble/sync + frame, plus 1 s margin (512 baud: ~4.4 s)
|
||||||
|
const unsigned int timeoutMs =
|
||||||
|
(unsigned int) (((frameSize + 11U) * 8U * 1000U) / POCSAG_Baud()) + 1000U;
|
||||||
|
for (unsigned int timeout = 0; timeout < timeoutMs / 5U; timeout++) {
|
||||||
|
SYSTEM_DelayMs(5);
|
||||||
|
if (BK4819_ReadRegister(BK4819_REG_0C) & 1U) {
|
||||||
|
BK4819_WriteRegister(BK4819_REG_02, 0);
|
||||||
|
if (BK4819_ReadRegister(BK4819_REG_02) & BK4819_REG_02_FSK_TX_FINISHED)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SYSTEM_DelayMs(20); // let the last bits leave the modulator
|
||||||
|
BK4819_WriteRegister(BK4819_REG_59, POCSAG_REG59); // FSK TX off
|
||||||
|
BK4819_WriteRegister(BK4819_REG_58, 0);
|
||||||
|
BK4819_WriteRegister(BK4819_REG_02, 0);
|
||||||
|
|
||||||
|
for (unsigned int i = 0; i < ARRAY_SIZE(savedRegs); i++)
|
||||||
|
BK4819_WriteRegister(savedRegs[i], saved[i]);
|
||||||
|
|
||||||
|
MSG_EndDataTransmission(audioWasEnabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // ENABLE_POCSAG
|
||||||
|
|
||||||
|
void MSG_FSKSendData(DataPacket *dataPacketIn) {
|
||||||
|
#ifdef ENABLE_POCSAG
|
||||||
|
if (MODEM_IS_POCSAG(gEeprom.FSKMode)) { // e.g. UART command 0x06FF
|
||||||
|
char text[DataPacketDataSize + 1U];
|
||||||
|
memcpy(text, dataPacketIn->data, DataPacketDataSize);
|
||||||
|
text[DataPacketDataSize] = '\0';
|
||||||
|
MSG_POCSAGSend(dataPacketIn->dest, text);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
const unsigned int vfo = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.RX_VFO
|
||||||
|
: gEeprom.TX_VFO;
|
||||||
|
if (VfoState[vfo] == VFO_STATE_NORMAL &&
|
||||||
|
!TX_freq_check(gCurrentVfo->freq_config_TX.Frequency)) {
|
||||||
|
|
||||||
|
RADIO_PrepareTX();
|
||||||
|
BK4819_SetScramble(gCurrentVfo->SCRAMBLING_TYPE);
|
||||||
|
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1_RED, true);
|
||||||
|
|
||||||
|
bool isAudioOn = gEnableSpeaker;
|
||||||
|
if (gEnableSpeaker) {
|
||||||
|
AUDIO_AudioPathOff();
|
||||||
|
BK4819_EnterTxMute();
|
||||||
|
gEnableSpeaker = false;
|
||||||
|
}
|
||||||
|
// turn off CTCSS/CDCSS during FFSK
|
||||||
|
const uint16_t css_val = BK4819_ReadRegister(BK4819_REG_51);
|
||||||
|
BK4819_WriteRegister(BK4819_REG_51, 0);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// REG_2B 0
|
||||||
|
//
|
||||||
|
// <15> 1 Enable CTCSS/CDCSS DC cancellation after FM Demodulation 1 = enable 0 = disable
|
||||||
|
// <14> 1 Enable AF DC cancellation after FM Demodulation 1 = enable 0 = disable
|
||||||
|
// <10> 0 AF RX HPF 300Hz filter 0 = enable 1 = disable
|
||||||
|
// <9> 0 AF RX LPF 3kHz filter 0 = enable 1 = disable
|
||||||
|
// <8> 0 AF RX de-emphasis filter 0 = enable 1 = disable
|
||||||
|
// <2> 0 AF TX HPF 300Hz filter 0 = enable 1 = disable
|
||||||
|
// <1> 0 AF TX LPF filter 0 = enable 1 = disable
|
||||||
|
// <0> 0 AF TX pre-emphasis filter 0 = enable 1 = disable
|
||||||
|
//
|
||||||
|
// disable the 300Hz HPF and FM pre-emphasis filter
|
||||||
|
//
|
||||||
|
|
||||||
|
const uint16_t filt_val = BK4819_ReadRegister(BK4819_REG_2B);
|
||||||
|
// Enable AF path filters for tone demodulation in AFSK/NOAA modes
|
||||||
|
if (gEeprom.FSKMode == MOD_AFSK_1200 ||
|
||||||
|
gEeprom.FSKMode == MOD_AFSK_2400 ||
|
||||||
|
gEeprom.FSKMode == MOD_NOAA_SAME) {
|
||||||
|
|
||||||
|
// Keep DC cancel, disable only deemphasis
|
||||||
|
BK4819_WriteRegister(BK4819_REG_2B,
|
||||||
|
(1U << 15) | (1U << 14) | (1U << 8));
|
||||||
|
} else {
|
||||||
|
|
||||||
|
BK4819_WriteRegister(BK4819_REG_2B, (1u << 2) | (1u << 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
MSG_ConfigureFSK(false);
|
||||||
|
|
||||||
|
|
||||||
|
SYSTEM_DelayMs(100);
|
||||||
|
|
||||||
|
{ // load the entire packet data into the TX FIFO buffer
|
||||||
|
uint16_t *ptr = (uint16_t *) dataPacketIn;
|
||||||
|
size_t wordCount = sizeof(*dataPacketIn) / sizeof(uint16_t);
|
||||||
|
|
||||||
|
for (size_t i = 0; i < wordCount; i++) {
|
||||||
|
BK4819_WriteRegister(BK4819_REG_5F, ptr[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// enable FSK TX
|
||||||
|
BK4819_FskEnableTx();
|
||||||
|
|
||||||
|
{
|
||||||
|
// allow up to 310ms for the TX to complete
|
||||||
|
// if it takes any longer then somethings gone wrong, we shut the TX down
|
||||||
|
unsigned int timeout = 1000 / 5;
|
||||||
|
|
||||||
|
while (timeout-- > 0) {
|
||||||
|
SYSTEM_DelayMs(5);
|
||||||
|
if (BK4819_ReadRegister(BK4819_REG_0C) & (1u << 0)) { // we have interrupt flags
|
||||||
|
BK4819_WriteRegister(BK4819_REG_02, 0);
|
||||||
|
if (BK4819_ReadRegister(BK4819_REG_02) & BK4819_REG_02_FSK_TX_FINISHED)
|
||||||
|
timeout = 0; // TX is complete
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//BK4819_WriteRegister(BK4819_REG_02, 0);
|
||||||
|
|
||||||
|
SYSTEM_DelayMs(100);
|
||||||
|
|
||||||
|
// disable TX
|
||||||
|
MSG_ConfigureFSK(true);
|
||||||
|
|
||||||
|
// restore TX/RX filtering
|
||||||
|
BK4819_WriteRegister(BK4819_REG_2B, filt_val);
|
||||||
|
|
||||||
|
// restore the CTCSS/CDCSS setting
|
||||||
|
BK4819_WriteRegister(BK4819_REG_51, css_val);
|
||||||
|
|
||||||
|
SYSTEM_DelayMs(50);
|
||||||
|
|
||||||
|
//if (!(dataPacketIn->flags & 0x64)) {
|
||||||
|
if (!(dataPacketIn->flags & 0x40)) {
|
||||||
|
gGotACK = false;
|
||||||
|
}
|
||||||
|
MSG_EndDataTransmission(isAudioOn);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void prepareDataPacket() {
|
||||||
|
dataPacket.src = gEeprom.FSKSRCAddress;
|
||||||
|
uint8_t Data[8];
|
||||||
|
EEPROM_ReadBuffer(SEQParameterEEPROM, Data, 8);
|
||||||
|
dataPacket.seq = Data[0];
|
||||||
|
Data[0]++;
|
||||||
|
EEPROM_WriteBuffer(SEQParameterEEPROM, Data);
|
||||||
|
dataPacket.ttl = 20;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef ENABLE_POCSAG
|
||||||
|
// UART debug log for POCSAG RX (38400 8N1 on the programming cable):
|
||||||
|
// "PS" chip locked on the preamble (FSK RX sync)
|
||||||
|
// "PF <n>" capture finished, n bytes
|
||||||
|
// "PD <hex>" raw captured bytes (logical bits, as stored)
|
||||||
|
// "PR <ric> <m>" decoded a page (any RIC), "PX" nothing decodable
|
||||||
|
#ifndef POCSAG_DEBUG_UART
|
||||||
|
#define POCSAG_DEBUG_UART 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if POCSAG_DEBUG_UART
|
||||||
|
static void POCSAG_Log(const char *text)
|
||||||
|
{
|
||||||
|
UART_Send(text, strlen(text));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void POCSAG_LogNumber(const char *tag, const uint32_t value)
|
||||||
|
{
|
||||||
|
char number[12];
|
||||||
|
itoa(value, number);
|
||||||
|
POCSAG_Log(tag);
|
||||||
|
POCSAG_Log(number);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void POCSAG_LogHex(const char *tag, const uint8_t *data, const size_t size)
|
||||||
|
{
|
||||||
|
static const char digits[] = "0123456789ABCDEF";
|
||||||
|
POCSAG_Log(tag);
|
||||||
|
for (size_t i = 0; i < size; i++) {
|
||||||
|
const char pair[2] = {digits[data[i] >> 4], digits[data[i] & 15U]};
|
||||||
|
UART_Send(pair, 2);
|
||||||
|
}
|
||||||
|
POCSAG_Log("\r\n");
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
#define POCSAG_Log(text) do { } while (0)
|
||||||
|
#define POCSAG_LogNumber(tag, value) do { } while (0)
|
||||||
|
#define POCSAG_LogHex(tag, data, size) do { } while (0)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static void POCSAG_SwapBytePairs(void)
|
||||||
|
{
|
||||||
|
for (size_t i = 0; i + 1U < pocsagRxSize; i += 2U) {
|
||||||
|
const uint8_t b = pocsagRxBuffer[i];
|
||||||
|
pocsagRxBuffer[i] = pocsagRxBuffer[i + 1U];
|
||||||
|
pocsagRxBuffer[i + 1U] = b;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// The RX FIFO byte order has not been verified on hardware: try both.
|
||||||
|
static bool POCSAG_TryDecode(const uint32_t ric, uint32_t *sender, char *message, const size_t capacity)
|
||||||
|
{
|
||||||
|
if (POCSAG_Decode(pocsagRxBuffer, pocsagRxSize, ric, sender, message, capacity))
|
||||||
|
return true;
|
||||||
|
POCSAG_SwapBytePairs();
|
||||||
|
const bool ok = POCSAG_Decode(pocsagRxBuffer, pocsagRxSize, ric, sender, message, capacity);
|
||||||
|
POCSAG_SwapBytePairs();
|
||||||
|
return ok;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MSG_POCSAGStoreReceived(void)
|
||||||
|
{
|
||||||
|
uint32_t sender;
|
||||||
|
char message[POCSAG_MAX_MESSAGE_LENGTH + 1U];
|
||||||
|
|
||||||
|
POCSAG_LogNumber("PF ", pocsagRxSize);
|
||||||
|
POCSAG_Log("\r\n");
|
||||||
|
POCSAG_LogHex("PD ", pocsagRxBuffer, pocsagRxSize);
|
||||||
|
|
||||||
|
// monitor mode: accept pages for every RIC, otherwise only our own
|
||||||
|
const uint32_t ric = gEeprom.POCSAG_MONITOR ? POCSAG_ANY_RIC : gEeprom.FSKSRCAddress;
|
||||||
|
const bool decoded = POCSAG_TryDecode(ric, &sender, message, sizeof(message));
|
||||||
|
|
||||||
|
#if POCSAG_DEBUG_UART
|
||||||
|
if (decoded || POCSAG_TryDecode(POCSAG_ANY_RIC, &sender, message, sizeof(message))) {
|
||||||
|
POCSAG_LogNumber(decoded ? "PR " : "PO ", sender); // PO: page for another RIC
|
||||||
|
POCSAG_Log(" ");
|
||||||
|
POCSAG_Log(message);
|
||||||
|
POCSAG_Log("\r\n");
|
||||||
|
} else {
|
||||||
|
POCSAG_Log("PX\r\n");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (!decoded || message[0] == '\0')
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (pocsagDuplicateTimeout > 0 && sender == lastPocsagSender &&
|
||||||
|
strcmp(message, lastPocsagMessage) == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
lastPocsagSender = sender;
|
||||||
|
strcpy(lastPocsagMessage, message);
|
||||||
|
pocsagDuplicateTimeout = 20;
|
||||||
|
|
||||||
|
MESSAGES_SAVE(sender, 0, 0, MESSAGE_FLAG_POCSAG, (const uint8_t *) message, strlen(message));
|
||||||
|
POCSAG_StartAlert();
|
||||||
|
|
||||||
|
MESSAGES_ShowNewest();
|
||||||
|
gRequestDisplayScreen = DISPLAY_MESSAGES;
|
||||||
|
GUI_SelectNextDisplay(DISPLAY_MESSAGES);
|
||||||
|
UI_DisplayPopup("POCSAG received");
|
||||||
|
gUpdateDisplay = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void POCSAG_HandleIRQ(const bool rx_sync, const bool rx_fifo_almost_full, const bool rx_finished)
|
||||||
|
{
|
||||||
|
if (rx_sync) {
|
||||||
|
// locked on the preamble; the decoder searches for the sync codeword itself
|
||||||
|
pocsagRxSize = 0;
|
||||||
|
rxState = Receiving;
|
||||||
|
AUDIO_AudioPathOff();
|
||||||
|
POCSAG_Log("PS\r\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rx_fifo_almost_full && rxState == Receiving) {
|
||||||
|
const uint16_t count = BK4819_ReadRegister(BK4819_REG_5E) & 7U;
|
||||||
|
|
||||||
|
for (uint16_t i = 0; i < count; i++) {
|
||||||
|
const uint16_t word = POCSAG_Raw16(BK4819_ReadRegister(BK4819_REG_5F));
|
||||||
|
if (pocsagRxSize + 2U <= sizeof(pocsagRxBuffer)) {
|
||||||
|
pocsagRxBuffer[pocsagRxSize++] = (uint8_t) word; // low byte arrived first
|
||||||
|
pocsagRxBuffer[pocsagRxSize++] = (uint8_t) (word >> 8);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rx_finished) {
|
||||||
|
if (rxState == Receiving)
|
||||||
|
MSG_POCSAGStoreReceived();
|
||||||
|
rxState = Ready;
|
||||||
|
pocsagRxSize = 0;
|
||||||
|
|
||||||
|
// re-arm the FSK receiver for the next page
|
||||||
|
MSG_EnableRX(true);
|
||||||
|
gUpdateStatus = true;
|
||||||
|
gUpdateDisplay = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // ENABLE_POCSAG
|
||||||
|
|
||||||
|
void FSK_HANDLE_IRQ(unsigned short irq) {
|
||||||
|
//const uint16_t rx_sync_flags = BK4819_ReadRegister(BK4819_REG_0B);
|
||||||
|
|
||||||
|
const bool rx_sync = (irq & BK4819_REG_02_FSK_RX_SYNC) != 0;
|
||||||
|
const bool rx_fifo_almost_full = (irq & BK4819_REG_02_FSK_FIFO_ALMOST_FULL) != 0;
|
||||||
|
const bool rx_finished = (irq & BK4819_REG_02_FSK_RX_FINISHED) != 0;
|
||||||
|
|
||||||
|
//UART_printf("\nMSG : S%i, F%i, E%i | %i", rx_sync, rx_fifo_almost_full, rx_finished, irq);
|
||||||
|
|
||||||
|
#ifdef ENABLE_POCSAG
|
||||||
|
if (MODEM_IS_POCSAG(gEeprom.FSKMode)) {
|
||||||
|
POCSAG_HandleIRQ(rx_sync, rx_fifo_almost_full, rx_finished);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (rx_sync) {
|
||||||
|
// prevent listening to fsk data and squelch (kamilsss655)
|
||||||
|
// CTCSS codes seem to false trigger the rx_sync
|
||||||
|
if (gCurrentCodeType == CODE_TYPE_OFF)
|
||||||
|
AUDIO_AudioPathOff();
|
||||||
|
gFSKWriteIndex = 0;
|
||||||
|
memset(&inBoundPacket, 0, sizeof(DataPacket));
|
||||||
|
rxState = Receiving;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rx_fifo_almost_full && rxState == Receiving) {
|
||||||
|
const uint16_t count = BK4819_ReadRegister(BK4819_REG_5E) & 7U;
|
||||||
|
|
||||||
|
uint16_t *ptr = (uint16_t *) &inBoundPacket;
|
||||||
|
size_t wordCount = sizeof(inBoundPacket) / sizeof(uint16_t);
|
||||||
|
|
||||||
|
for (uint16_t i = 0; i < count && gFSKWriteIndex < wordCount; i++) {
|
||||||
|
ptr[gFSKWriteIndex++] = BK4819_ReadRegister(BK4819_REG_5F);
|
||||||
|
//UART_Send((const void *) &ptr[gFSKWriteIndex - 1], 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
SYSTEM_DelayMs(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rx_finished) {
|
||||||
|
// Turn off green LED
|
||||||
|
BK4819_FskClearFifo();
|
||||||
|
|
||||||
|
rxState = Ready;
|
||||||
|
|
||||||
|
if (gFSKWriteIndex > 2) {
|
||||||
|
// Validate checksum (assuming last 2 bytes are CRC-16)
|
||||||
|
//size_t dataLength = sizeof(inBoundPacket.data) - 2;
|
||||||
|
//uint16_t receivedCRC = (inBoundPacket.data[dataLength] << 8) | inBoundPacket.data[dataLength + 1];
|
||||||
|
//uint16_t calculatedCRC = calculateCRC(inBoundPacket.data, dataLength);
|
||||||
|
|
||||||
|
//if (receivedCRC == calculatedCRC) {
|
||||||
|
processReceivedPacket(&inBoundPacket);
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
|
||||||
|
APP_EndTransmission();
|
||||||
|
FUNCTION_Select(FUNCTION_FOREGROUND);
|
||||||
|
gUpdateStatus = true;
|
||||||
|
gUpdateDisplay = true;
|
||||||
|
gFlagEndTransmission = false;
|
||||||
|
|
||||||
|
gFSKWriteIndex = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
+148
@@ -0,0 +1,148 @@
|
|||||||
|
//
|
||||||
|
// Created by bruno on 25.2.2025.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef UV_K5_FIRMWARE_CUSTOM_FSKMODEM_H
|
||||||
|
#define UV_K5_FIRMWARE_CUSTOM_FSKMODEM_H
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include "../driver/bk4819.h"
|
||||||
|
#include "../driver/bk4819-regs.h"
|
||||||
|
#include "../settings.h"
|
||||||
|
#include "stddef.h"
|
||||||
|
#include "../driver/system.h"
|
||||||
|
#include "../misc.h"
|
||||||
|
#include "../app/app.h"
|
||||||
|
#include <string.h>
|
||||||
|
#include "../audio.h"
|
||||||
|
#include <stdio.h>
|
||||||
|
#include "../ui/helper.h"
|
||||||
|
#include "../ui/main.h"
|
||||||
|
|
||||||
|
// REG_70 bit definitions
|
||||||
|
#define TONE1_ENABLE_BIT (1U << 15)
|
||||||
|
#define TONE1_GAIN_MASK (0x7FU << 8)
|
||||||
|
#define TONE2_ENABLE_BIT (1U << 7)
|
||||||
|
#define TONE2_GAIN_MASK (0x7FU << 0)
|
||||||
|
|
||||||
|
// REG_58 bit definitions
|
||||||
|
// FSK Tx Mode Selection (REG_58<15:13>)
|
||||||
|
#define FSK_TX_MODE_FSK_1_2K_2_4K (0U << 13) // 000
|
||||||
|
#define FSK_TX_MODE_FFSK_1200_1800 (1U << 13) // 001
|
||||||
|
#define FSK_TX_MODE_FFSK_1200_2400 (3U << 13) // 011
|
||||||
|
#define FSK_TX_MODE_NOAA_SAME (5U << 13) // 101
|
||||||
|
|
||||||
|
// FSK Rx Mode Selection (REG_58<12:10>)
|
||||||
|
#define FSK_RX_MODE_FSK_1_2K_2_4K_NOAA (0U << 10) // 000
|
||||||
|
#define FSK_RX_MODE_FFSK_1200_1800 (7U << 10) // 111
|
||||||
|
#define FSK_RX_MODE_FFSK_1200_2400 (4U << 10) // 100
|
||||||
|
|
||||||
|
// FSK Rx Gain (REG_58<9:8>)
|
||||||
|
#define FSK_RX_GAIN_DEFAULT (0U << 8) // 00
|
||||||
|
#define FSK_RX_GAIN_TYPE_C (1U << 8) // 01
|
||||||
|
#define FSK_RX_GAIN_TYPE_B (2U << 8) // 10
|
||||||
|
#define FSK_UNKNOWN_MASK (3U << 6)
|
||||||
|
// FSK Preamble Type Selection (REG_58<5:4>)
|
||||||
|
#define FSK_PREAMBLE_TYPE_AA (3U << 4) // 11
|
||||||
|
#define FSK_PREAMBLE_TYPE_55 (2U << 4) // 10
|
||||||
|
#define FSK_PREAMBLE_TYPE_UNKNOWN (0U << 4) // 00
|
||||||
|
// FSK Rx Bandwidth Setting (REG_58<3:1>)
|
||||||
|
#define FSK_RX_BW_2_4K_FFSK_1200_2400 (4U << 1) // 100
|
||||||
|
#define FSK_RX_BW_1_2K (0U << 1) // 000
|
||||||
|
#define FSK_RX_BW_FFSK_1200_1800 (1U << 1) // 001
|
||||||
|
#define FSK_RX_BW_NOAA_SAME (2U << 1) // 010
|
||||||
|
#define FSK_ENABLE_BIT (1U << 0)
|
||||||
|
|
||||||
|
// REG_59 bit definitions
|
||||||
|
#define FSK_CLEAR_TX_FIFO (1U << 15)
|
||||||
|
#define FSK_CLEAR_RX_FIFO (1U << 14)
|
||||||
|
#define FSK_SCRAMBLE_ENABLE (1U << 13)
|
||||||
|
#define FSK_RX_ENABLE (1U << 12)
|
||||||
|
#define FSK_TX_ENABLE (1U << 11)
|
||||||
|
#define FSK_INVERT_RX (1U << 10)
|
||||||
|
#define FSK_INVERT_TX (1U << 9)
|
||||||
|
#define FSK_PREAMBLE_LEN_MASK (15U << 4)
|
||||||
|
#define FSK_SYNC_LEN_BIT (1U << 3)
|
||||||
|
|
||||||
|
//#define FSK_SYNC_BYTE0 0x30
|
||||||
|
//#define FSK_SYNC_BYTE1 0x72
|
||||||
|
//#define FSK_SYNC_BYTE2 0x57
|
||||||
|
//#define FSK_SYNC_BYTE3 0x6c
|
||||||
|
|
||||||
|
#define FSK_SYNC_BYTE0 0x42
|
||||||
|
#define FSK_SYNC_BYTE1 0x52
|
||||||
|
#define FSK_SYNC_BYTE2 0x4E
|
||||||
|
#define FSK_SYNC_BYTE3 0x51
|
||||||
|
|
||||||
|
#define FSK_CRC_ON (1U << 6)
|
||||||
|
#define FSK_CRC_OFF (0U << 6)
|
||||||
|
|
||||||
|
#define DataPacketDataSize (21)
|
||||||
|
|
||||||
|
#define SEQParameterEEPROM 0x1900 // message counters, after the channels (settings.h)
|
||||||
|
|
||||||
|
typedef struct __attribute__((packed)){
|
||||||
|
uint32_t dest; //4bytes
|
||||||
|
uint32_t src; //4bytes
|
||||||
|
uint8_t seq; //1bytes
|
||||||
|
uint8_t ttl; //1bytes
|
||||||
|
uint8_t flags; //1bytes
|
||||||
|
uint8_t data[DataPacketDataSize];
|
||||||
|
} DataPacket;
|
||||||
|
|
||||||
|
void prepareDataPacket();
|
||||||
|
|
||||||
|
void MSG_FSKSendData(DataPacket *dataPacketIn);
|
||||||
|
|
||||||
|
void MSG_EnableRX(bool enable);
|
||||||
|
|
||||||
|
void processReceivedPacket(DataPacket *packet);
|
||||||
|
|
||||||
|
uint16_t calculateCRC(uint8_t *data, size_t length);
|
||||||
|
|
||||||
|
extern DataPacket dataPacket;
|
||||||
|
|
||||||
|
extern DataPacket inBoundPacket;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
SMS_NOT_ENTERING = 0,
|
||||||
|
SMS_ENTERING_DEST,
|
||||||
|
SMS_ENTERING_MESSAGE
|
||||||
|
} SMSEnteringState;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
SMS_RESPONSE_IDLE,
|
||||||
|
SMS_RESPONSE_ACK,
|
||||||
|
SMS_RESPONSE_ACK_LIGHT,
|
||||||
|
SMS_RESPONSE_RETRANSMIT,
|
||||||
|
SMS_RESPONSE_RESEND
|
||||||
|
} SMSResponseState;
|
||||||
|
|
||||||
|
extern SMSEnteringState gEnteringSMS;
|
||||||
|
extern SMSResponseState gSMSResponseState;
|
||||||
|
|
||||||
|
extern char *dataPTR; // cursor into gMessageText (app/messages.h)
|
||||||
|
|
||||||
|
extern bool gGotACK;
|
||||||
|
|
||||||
|
extern uint8_t SMSResponseCounter;
|
||||||
|
|
||||||
|
void FSK_HANDLE_IRQ(unsigned short irq);
|
||||||
|
|
||||||
|
void FSKModem_TimeSlice500ms(void);
|
||||||
|
|
||||||
|
// Transmit an alphanumeric POCSAG page to the given RIC.
|
||||||
|
void MSG_POCSAGSend(uint32_t ric, const char *text);
|
||||||
|
|
||||||
|
// POCSAG TX deviation (BK4819 REG_40<11:0>). Build with -DPOCSAG_DEVIATION_TUNING=1
|
||||||
|
// to adjust it at runtime with keys 2 / 8 on the messages screen.
|
||||||
|
#ifndef POCSAG_DEVIATION_TUNING
|
||||||
|
#define POCSAG_DEVIATION_TUNING 0
|
||||||
|
#endif
|
||||||
|
#if POCSAG_DEVIATION_TUNING
|
||||||
|
extern uint16_t gPocsagDeviation;
|
||||||
|
void POCSAG_AdjustDeviation(int delta);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif //UV_K5_FIRMWARE_CUSTOM_FSKMODEM_H
|
||||||
@@ -198,16 +198,6 @@ void GENERIC_Key_PTT(bool bKeyPressed)
|
|||||||
if (gDTMF_InputBox_Index < sizeof(gDTMF_InputBox))
|
if (gDTMF_InputBox_Index < sizeof(gDTMF_InputBox))
|
||||||
gDTMF_InputBox[gDTMF_InputBox_Index] = 0; // NULL term the string
|
gDTMF_InputBox[gDTMF_InputBox_Index] = 0; // NULL term the string
|
||||||
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
// append our DTMF ID to the inputted DTMF code -
|
|
||||||
// IF the user inputted code is exactly 3 digits long and D-DCD is enabled
|
|
||||||
if (gDTMF_InputBox_Index == 3 && gTxVfo->DTMF_DECODING_ENABLE > 0)
|
|
||||||
gDTMF_CallMode = DTMF_CheckGroupCall(gDTMF_InputBox, 3);
|
|
||||||
else
|
|
||||||
gDTMF_CallMode = DTMF_CALL_MODE_DTMF;
|
|
||||||
|
|
||||||
gDTMF_State = DTMF_STATE_0;
|
|
||||||
#endif
|
|
||||||
// remember the DTMF string
|
// remember the DTMF string
|
||||||
gDTMF_PreviousIndex = gDTMF_InputBox_Index;
|
gDTMF_PreviousIndex = gDTMF_InputBox_Index;
|
||||||
strcpy(gDTMF_String, gDTMF_InputBox);
|
strcpy(gDTMF_String, gDTMF_InputBox);
|
||||||
|
|||||||
+13
-135
@@ -47,23 +47,9 @@
|
|||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "ui/inputbox.h"
|
#include "ui/inputbox.h"
|
||||||
#include "ui/ui.h"
|
#include "ui/ui.h"
|
||||||
|
#include "messages.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#define T9Count 9
|
|
||||||
|
|
||||||
const char T9Table[10][T9Count] = {
|
|
||||||
{'#', '(', ')', ';', ':', '<', '>', '/', '0'},
|
|
||||||
{',', '.', '?', '&', '!', ' ', '-', '_', '1'},
|
|
||||||
{'a', 'b', 'c', 'A', 'B', 'C', '[', ']', '2'},
|
|
||||||
{'d', 'e', 'f', 'D', 'E', 'F', '@', '%', '3'},
|
|
||||||
{'g', 'h', 'i', 'G', 'H', 'I', '~', '$', '4'},
|
|
||||||
{'j', 'k', 'l', 'J', 'K', 'L', '|', '*', '5'},
|
|
||||||
{'m', 'n', 'o', 'M', 'N', 'O', '{', '}', '6'},
|
|
||||||
{'p', 'q', 'r', 's', 'P', 'Q', 'R', 'S', '7'},
|
|
||||||
{'t', 'u', 'v', 'T', 'U', 'V', '"', '\'', '8'},
|
|
||||||
{'w', 'x', 'y', 'z', 'W', 'X', 'Y', 'Z', '9'}
|
|
||||||
};
|
|
||||||
|
|
||||||
static void toggle_chan_scanlist(void) { // toggle the selected channels scanlist setting
|
static void toggle_chan_scanlist(void) { // toggle the selected channels scanlist setting
|
||||||
|
|
||||||
if (SCANNER_IsScanning())
|
if (SCANNER_IsScanning())
|
||||||
@@ -180,7 +166,7 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep) {
|
|||||||
#endif
|
#endif
|
||||||
gTxVfo->Band += 1;
|
gTxVfo->Band += 1;
|
||||||
|
|
||||||
if (gTxVfo->Band == BAND5_350MHz && !gSetting_350EN) {
|
if (gTxVfo->Band == BAND5_350MHz) {
|
||||||
// skip if not enabled
|
// skip if not enabled
|
||||||
gTxVfo->Band += 1;
|
gTxVfo->Band += 1;
|
||||||
} else if (gTxVfo->Band >= BAND_N_ELEM) {
|
} else if (gTxVfo->Band >= BAND_N_ELEM) {
|
||||||
@@ -264,13 +250,13 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep) {
|
|||||||
case KEY_7:
|
case KEY_7:
|
||||||
#ifdef ENABLE_VOX
|
#ifdef ENABLE_VOX
|
||||||
ACTION_Vox();
|
ACTION_Vox();
|
||||||
//#else
|
#elif defined(ENABLE_OOK_SENDER)
|
||||||
// toggle_chan_scanlist();
|
gRequestDisplayScreen = DISPLAY_OOKSENDER; // the VOX key is free: OOK sender
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case KEY_8:
|
case KEY_8:
|
||||||
gTxVfo->FrequencyReverse = gTxVfo->FrequencyReverse == false;
|
gTxVfo->FrequencyReverse = !gTxVfo->FrequencyReverse;
|
||||||
gRequestSaveChannel = 1;
|
gRequestSaveChannel = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -360,10 +346,8 @@ void channelMove(uint16_t Channel) {
|
|||||||
//gRequestSaveVFO = true;
|
//gRequestSaveVFO = true;
|
||||||
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
|
||||||
gRemoveOffset = false;
|
gRemoveOffset = false;
|
||||||
gPowerHigh = false;
|
gPowerHigh = false;
|
||||||
#endif
|
|
||||||
|
|
||||||
RADIO_ConfigureChannel(gEeprom.TX_VFO, gVfoConfigureMode);
|
RADIO_ConfigureChannel(gEeprom.TX_VFO, gVfoConfigureMode);
|
||||||
|
|
||||||
@@ -594,14 +578,6 @@ static void MAIN_Key_EXIT(bool bKeyPressed, bool bKeyHeld) {
|
|||||||
if (!bKeyHeld && bKeyPressed) { // exit key pressed
|
if (!bKeyHeld && bKeyPressed) { // exit key pressed
|
||||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||||
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
if (gDTMF_CallState != DTMF_CALL_STATE_NONE && gCurrentFunction != FUNCTION_TRANSMIT)
|
|
||||||
{ // clear CALL mode being displayed
|
|
||||||
gDTMF_CallState = DTMF_CALL_STATE_NONE;
|
|
||||||
gUpdateDisplay = true;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef ENABLE_FMRADIO
|
#ifdef ENABLE_FMRADIO
|
||||||
if (!gFmRadioMode)
|
if (!gFmRadioMode)
|
||||||
@@ -660,7 +636,7 @@ static void MAIN_Key_MENU(bool bKeyPressed, bool bKeyHeld) {
|
|||||||
#ifdef ENABLE_FEAT_F4HWN
|
#ifdef ENABLE_FEAT_F4HWN
|
||||||
// Exclude work with list 1, 2, 3 or all list
|
// Exclude work with list 1, 2, 3 or all list
|
||||||
if (gScanStateDir != SCAN_OFF) {
|
if (gScanStateDir != SCAN_OFF) {
|
||||||
if (FUNCTION_IsRx()) {
|
if (FUNCTION_IsRx() || gScanPauseDelayIn_10ms > 9) {
|
||||||
gMR_ChannelExclude[gTxVfo->CHANNEL_SAVE] = true;
|
gMR_ChannelExclude[gTxVfo->CHANNEL_SAVE] = true;
|
||||||
|
|
||||||
gVfoConfigureMode = VFO_CONFIGURE;
|
gVfoConfigureMode = VFO_CONFIGURE;
|
||||||
@@ -693,6 +669,13 @@ static void MAIN_Key_MENU(bool bKeyPressed, bool bKeyHeld) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (gWasFKeyPressed && bKeyPressed) {
|
||||||
|
MESSAGES_GET();
|
||||||
|
gRequestDisplayScreen = DISPLAY_MESSAGES;
|
||||||
|
MESSAGES_ShowNewest();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!bKeyPressed && !gDTMF_InputMode) { // menu key released
|
if (!bKeyPressed && !gDTMF_InputMode) { // menu key released
|
||||||
const bool bFlag = !gInputBoxIndex;
|
const bool bFlag = !gInputBoxIndex;
|
||||||
gInputBoxIndex = 0;
|
gInputBoxIndex = 0;
|
||||||
@@ -825,10 +808,8 @@ static void MAIN_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
|
||||||
gRemoveOffset = false;
|
gRemoveOffset = false;
|
||||||
gPowerHigh = false;
|
gPowerHigh = false;
|
||||||
#endif
|
|
||||||
|
|
||||||
uint8_t Channel = gEeprom.ScreenChannel[gEeprom.TX_VFO];
|
uint8_t Channel = gEeprom.ScreenChannel[gEeprom.TX_VFO];
|
||||||
|
|
||||||
@@ -910,11 +891,6 @@ static void MAIN_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
|
|||||||
gPttWasReleased = true;
|
gPttWasReleased = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void updatePrevChar(KEY_Code_t Key) {
|
|
||||||
if (Key != prevKey) {
|
|
||||||
prevKey = Key;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void MAIN_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) {
|
void MAIN_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) {
|
||||||
#ifdef ENABLE_FMRADIO
|
#ifdef ENABLE_FMRADIO
|
||||||
@@ -943,104 +919,6 @@ void MAIN_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) {
|
|||||||
// Key = KEY_SIDE2; // what's this doing ???
|
// Key = KEY_SIDE2; // what's this doing ???
|
||||||
// }
|
// }
|
||||||
|
|
||||||
if (Key == KEY_9 && bKeyHeld) {
|
|
||||||
if (bKeyPressed) {
|
|
||||||
if (gEnteringSMS == SMS_NOT_ENTERING) {
|
|
||||||
gEnteringSMS = SMS_ENTERING_DEST;
|
|
||||||
updatePrevChar(Key);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (Key == KEY_MENU) {
|
|
||||||
if (gEnteringSMS == SMS_ENTERING_DEST) {
|
|
||||||
if (bKeyPressed) {
|
|
||||||
memset(dataPacket.data, 0, DataPacketDataSize);
|
|
||||||
prepareDataPacket();
|
|
||||||
dataPacket.flags = 126;
|
|
||||||
gEnteringSMS = SMS_ENTERING_MESSAGE;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (gEnteringSMS == SMS_ENTERING_MESSAGE) {
|
|
||||||
if (bKeyPressed) {
|
|
||||||
if (strlen((char *) dataPacket.data)) {
|
|
||||||
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1_RED, true);
|
|
||||||
AUDIO_AudioPathOff();
|
|
||||||
gEnableSpeaker = false;
|
|
||||||
RADIO_PrepareTX();
|
|
||||||
if (gCurrentVfo->SCRAMBLING_TYPE > 0)
|
|
||||||
BK4819_EnableScramble(gCurrentVfo->SCRAMBLING_TYPE - 1);
|
|
||||||
else
|
|
||||||
BK4819_DisableScramble();
|
|
||||||
MSG_FSKSendData();
|
|
||||||
AUDIO_AudioPathOn();
|
|
||||||
gEnableSpeaker = true;
|
|
||||||
BK4819_ExitTxMute();
|
|
||||||
MSG_EnableRX(true);
|
|
||||||
gVfoConfigureMode = VFO_CONFIGURE;
|
|
||||||
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1_RED, false);
|
|
||||||
dataPTR = dataPacket.data;
|
|
||||||
memset(dataPacket.data, 0, DataPacketDataSize);
|
|
||||||
gEnteringSMS = SMS_NOT_ENTERING;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (Key == KEY_EXIT && gEnteringSMS != SMS_NOT_ENTERING) {
|
|
||||||
if (bKeyHeld) {
|
|
||||||
if (bKeyPressed) {
|
|
||||||
gEnteringSMS = SMS_NOT_ENTERING;
|
|
||||||
dataPTR = dataPacket.data;
|
|
||||||
memset(dataPacket.data, 0, DataPacketDataSize);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (bKeyPressed) {
|
|
||||||
if (gEnteringSMS == SMS_ENTERING_MESSAGE) {
|
|
||||||
if (dataPacket.data <= dataPTR) {
|
|
||||||
*dataPTR = '\0';
|
|
||||||
if (dataPacket.data < dataPTR) {
|
|
||||||
dataPTR--;
|
|
||||||
}
|
|
||||||
*dataPTR = '\0';
|
|
||||||
}
|
|
||||||
} else if (gEnteringSMS == SMS_ENTERING_DEST) {
|
|
||||||
dataPacket.dest /= 10;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
updatePrevChar(Key);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gEnteringSMS != SMS_NOT_ENTERING && !bKeyHeld) {
|
|
||||||
if (!dataPTR) {
|
|
||||||
dataPTR = dataPacket.data;
|
|
||||||
}
|
|
||||||
if (gEnteringSMS == SMS_ENTERING_MESSAGE) {
|
|
||||||
if (bKeyPressed) {
|
|
||||||
if (prevKey != Key) {
|
|
||||||
dataPTR++;
|
|
||||||
if (dataPTR - dataPacket.data >= DataPacketDataSize) {
|
|
||||||
dataPTR = dataPacket.data;
|
|
||||||
}
|
|
||||||
prevLetter = 0;
|
|
||||||
}
|
|
||||||
*(dataPTR - 1) = T9Table[Key][(prevLetter++) % T9Count];
|
|
||||||
updatePrevChar(Key);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
} else if (gEnteringSMS == SMS_ENTERING_DEST) {
|
|
||||||
if (bKeyPressed) {
|
|
||||||
dataPacket.dest *= 10;
|
|
||||||
dataPacket.dest += Key;
|
|
||||||
prevLetter = 0;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (Key) {
|
switch (Key) {
|
||||||
#ifdef ENABLE_FEAT_F4HWN
|
#ifdef ENABLE_FEAT_F4HWN
|
||||||
case KEY_SIDE1:
|
case KEY_SIDE1:
|
||||||
|
|||||||
+39
-245
@@ -14,6 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "app/pocsag.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#if !defined(ENABLE_OVERLAY)
|
#if !defined(ENABLE_OVERLAY)
|
||||||
@@ -121,6 +122,11 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax) {
|
|||||||
*pMax = 9;
|
*pMax = 9;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case MENU_TOT:
|
||||||
|
*pMin = 0;
|
||||||
|
*pMax = 179;
|
||||||
|
break;
|
||||||
|
|
||||||
case MENU_STEP:
|
case MENU_STEP:
|
||||||
//*pMin = 0;
|
//*pMin = 0;
|
||||||
*pMax = STEP_N_ELEM - 1;
|
*pMax = STEP_N_ELEM - 1;
|
||||||
@@ -234,24 +240,17 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax) {
|
|||||||
#endif
|
#endif
|
||||||
case MENU_BCL:
|
case MENU_BCL:
|
||||||
case MENU_BEEP:
|
case MENU_BEEP:
|
||||||
|
case MENU_PMON:
|
||||||
case MENU_S_ADD1:
|
case MENU_S_ADD1:
|
||||||
case MENU_S_ADD2:
|
case MENU_S_ADD2:
|
||||||
case MENU_S_ADD3:
|
case MENU_S_ADD3:
|
||||||
case MENU_STE:
|
case MENU_STE:
|
||||||
case MENU_D_ST:
|
case MENU_D_ST:
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
case MENU_D_DCD:
|
|
||||||
#endif
|
|
||||||
case MENU_D_LIVE_DEC:
|
case MENU_D_LIVE_DEC:
|
||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_NOAA
|
||||||
case MENU_NOAA_S:
|
case MENU_NOAA_S:
|
||||||
#endif
|
#endif
|
||||||
#ifndef ENABLE_FEAT_F4HWN
|
|
||||||
case MENU_350TX:
|
|
||||||
case MENU_200TX:
|
|
||||||
case MENU_500TX:
|
|
||||||
#endif
|
|
||||||
case MENU_350EN:
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN
|
#ifdef ENABLE_FEAT_F4HWN
|
||||||
case MENU_SET_TMR:
|
case MENU_SET_TMR:
|
||||||
#endif
|
#endif
|
||||||
@@ -265,7 +264,7 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax) {
|
|||||||
|
|
||||||
case MENU_SCR:
|
case MENU_SCR:
|
||||||
//*pMin = 0;
|
//*pMin = 0;
|
||||||
*pMax = ARRAY_SIZE(gSubMenu_SCRAMBLER) - 1;
|
*pMax = 65535;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_AUTOLK:
|
case MENU_AUTOLK:
|
||||||
@@ -273,15 +272,11 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_FSKSRC:
|
case MENU_FSKSRC:
|
||||||
*pMax = INT32_MAX;
|
// POCSAG: own RIC (21 bits, 7 digits); SMS: 32 bit address (8 digit input box)
|
||||||
|
*pMax = MODEM_IS_POCSAG(gEeprom.FSKMode) ? (int32_t) POCSAG_MAX_RIC : 99999999;
|
||||||
*pMin = 0;
|
*pMin = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_TOT:
|
|
||||||
//*pMin = 0;
|
|
||||||
*pMin = 5;
|
|
||||||
*pMax = 179;
|
|
||||||
break;
|
|
||||||
|
|
||||||
#ifdef ENABLE_VOX
|
#ifdef ENABLE_VOX
|
||||||
case MENU_VOX:
|
case MENU_VOX:
|
||||||
@@ -321,12 +316,7 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax) {
|
|||||||
*pMax = 5;
|
*pMax = 5;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
case MENU_D_RSP:
|
|
||||||
//*pMin = 0;
|
|
||||||
*pMax = ARRAY_SIZE(gSubMenu_D_RSP) - 1;
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
case MENU_PTT_ID:
|
case MENU_PTT_ID:
|
||||||
//*pMin = 0;
|
//*pMin = 0;
|
||||||
*pMax = ARRAY_SIZE(gSubMenu_PTT_ID) - 1;
|
*pMax = ARRAY_SIZE(gSubMenu_PTT_ID) - 1;
|
||||||
@@ -337,23 +327,12 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax) {
|
|||||||
*pMax = ARRAY_SIZE(gSubMenu_BAT_TXT) - 1;
|
*pMax = ARRAY_SIZE(gSubMenu_BAT_TXT) - 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
case MENU_D_HOLD:
|
|
||||||
*pMin = 5;
|
|
||||||
*pMax = 60;
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
case MENU_D_PRE:
|
case MENU_D_PRE:
|
||||||
*pMin = 3;
|
*pMin = 3;
|
||||||
*pMax = 99;
|
*pMax = 99;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
case MENU_D_LIST:
|
|
||||||
*pMin = 1;
|
|
||||||
*pMax = 16;
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
#ifdef ENABLE_F_CAL_MENU
|
#ifdef ENABLE_F_CAL_MENU
|
||||||
case MENU_F_CALI:
|
case MENU_F_CALI:
|
||||||
*pMin = -50;
|
*pMin = -50;
|
||||||
@@ -387,45 +366,15 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN
|
#ifdef ENABLE_FEAT_F4HWN
|
||||||
case MENU_SET_PWR:
|
|
||||||
*pMax = ARRAY_SIZE(gSubMenu_SET_PWR) - 1;
|
|
||||||
break;
|
|
||||||
case MENU_SET_PTT:
|
case MENU_SET_PTT:
|
||||||
//*pMin = 0;
|
//*pMin = 0;
|
||||||
*pMax = ARRAY_SIZE(gSubMenu_SET_PTT) - 1;
|
*pMax = ARRAY_SIZE(gSubMenu_SET_PTT) - 1;
|
||||||
break;
|
break;
|
||||||
case MENU_SET_TOT:
|
|
||||||
case MENU_SET_EOT:
|
|
||||||
//*pMin = 0;
|
|
||||||
*pMax = ARRAY_SIZE(gSubMenu_SET_TOT) - 1;
|
|
||||||
break;
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_CTR
|
|
||||||
case MENU_SET_CTR:
|
|
||||||
*pMin = 1;
|
|
||||||
*pMax = 15;
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
case MENU_TX_LOCK:
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_INV
|
#ifdef ENABLE_FEAT_F4HWN_INV
|
||||||
case MENU_SET_INV:
|
case MENU_SET_INV:
|
||||||
//*pMin = 0;
|
//*pMin = 0;
|
||||||
*pMax = ARRAY_SIZE(gSubMenu_OFF_ON) - 1;
|
*pMax = ARRAY_SIZE(gSubMenu_OFF_ON) - 1;
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
case MENU_SET_LCK:
|
|
||||||
//*pMin = 0;
|
|
||||||
*pMax = ARRAY_SIZE(gSubMenu_SET_LCK) - 1;
|
|
||||||
break;
|
|
||||||
case MENU_SET_MET:
|
|
||||||
case MENU_SET_GUI:
|
|
||||||
//*pMin = 0;
|
|
||||||
*pMax = ARRAY_SIZE(gSubMenu_SET_MET) - 1;
|
|
||||||
break;
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_NARROWER
|
|
||||||
case MENU_SET_NFM:
|
|
||||||
//*pMin = 0;
|
|
||||||
*pMax = ARRAY_SIZE(gSubMenu_SET_NFM) - 1;
|
|
||||||
break;
|
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_FEAT_F4HWN_VOL
|
#ifdef ENABLE_FEAT_F4HWN_VOL
|
||||||
case MENU_SET_VOL:
|
case MENU_SET_VOL:
|
||||||
@@ -433,12 +382,6 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax) {
|
|||||||
*pMax = 63;
|
*pMax = 63;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
|
||||||
case MENU_SET_KEY:
|
|
||||||
//*pMin = 0;
|
|
||||||
*pMax = 4;
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -537,10 +480,7 @@ void MENU_AcceptSetting(void) {
|
|||||||
|
|
||||||
case MENU_SCR:
|
case MENU_SCR:
|
||||||
gTxVfo->SCRAMBLING_TYPE = gSubMenuSelection;
|
gTxVfo->SCRAMBLING_TYPE = gSubMenuSelection;
|
||||||
if (gSubMenuSelection > 0)
|
BK4819_SetScramble(gSubMenuSelection);
|
||||||
BK4819_EnableScramble(gSubMenuSelection - 1);
|
|
||||||
else
|
|
||||||
BK4819_DisableScramble();
|
|
||||||
gRequestSaveChannel = 1;
|
gRequestSaveChannel = 1;
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -549,6 +489,10 @@ void MENU_AcceptSetting(void) {
|
|||||||
gRequestSaveChannel = 1;
|
gRequestSaveChannel = 1;
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
case MENU_TOT:
|
||||||
|
gEeprom.TX_TIMEOUT_TIMER = gSubMenuSelection;
|
||||||
|
break;
|
||||||
|
|
||||||
case MENU_MEM_CH:
|
case MENU_MEM_CH:
|
||||||
gTxVfo->CHANNEL_SAVE = gSubMenuSelection;
|
gTxVfo->CHANNEL_SAVE = gSubMenuSelection;
|
||||||
#if 0
|
#if 0
|
||||||
@@ -625,8 +569,9 @@ void MENU_AcceptSetting(void) {
|
|||||||
gEeprom.BEEP_CONTROL = gSubMenuSelection;
|
gEeprom.BEEP_CONTROL = gSubMenuSelection;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_TOT:
|
case MENU_PMON:
|
||||||
gEeprom.TX_TIMEOUT_TIMER = gSubMenuSelection;
|
gEeprom.POCSAG_MONITOR = gSubMenuSelection;
|
||||||
|
gFlagReconfigureVfos = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
@@ -716,15 +661,6 @@ void MENU_AcceptSetting(void) {
|
|||||||
gEeprom.DTMF_SIDE_TONE = gSubMenuSelection;
|
gEeprom.DTMF_SIDE_TONE = gSubMenuSelection;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
case MENU_D_RSP:
|
|
||||||
gEeprom.DTMF_DECODE_RESPONSE = gSubMenuSelection;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case MENU_D_HOLD:
|
|
||||||
gEeprom.DTMF_auto_reset_time = gSubMenuSelection;
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
case MENU_D_PRE:
|
case MENU_D_PRE:
|
||||||
gEeprom.DTMF_PRELOAD_TIME = gSubMenuSelection * 10;
|
gEeprom.DTMF_PRELOAD_TIME = gSubMenuSelection * 10;
|
||||||
break;
|
break;
|
||||||
@@ -738,13 +674,6 @@ void MENU_AcceptSetting(void) {
|
|||||||
gSetting_battery_text = gSubMenuSelection;
|
gSetting_battery_text = gSubMenuSelection;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
case MENU_D_DCD:
|
|
||||||
gTxVfo->DTMF_DECODING_ENABLE = gSubMenuSelection;
|
|
||||||
DTMF_clear_RX();
|
|
||||||
gRequestSaveChannel = 1;
|
|
||||||
return;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
case MENU_D_LIVE_DEC:
|
case MENU_D_LIVE_DEC:
|
||||||
gSetting_live_DTMF_decoder = gSubMenuSelection;
|
gSetting_live_DTMF_decoder = gSubMenuSelection;
|
||||||
@@ -756,18 +685,6 @@ void MENU_AcceptSetting(void) {
|
|||||||
gUpdateStatus = true;
|
gUpdateStatus = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
case MENU_D_LIST:
|
|
||||||
gDTMF_chosen_contact = gSubMenuSelection - 1;
|
|
||||||
if (gIsDtmfContactValid) {
|
|
||||||
GUI_SelectNextDisplay(DISPLAY_MAIN);
|
|
||||||
gDTMF_InputMode = true;
|
|
||||||
gDTMF_InputBox_Index = 3;
|
|
||||||
memcpy(gDTMF_InputBox, gDTMF_ID, 4);
|
|
||||||
gRequestDisplayScreen = DISPLAY_INVALID;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
#endif
|
|
||||||
case MENU_FSKMOD:
|
case MENU_FSKMOD:
|
||||||
gEeprom.FSKMode = gSubMenuSelection;
|
gEeprom.FSKMode = gSubMenuSelection;
|
||||||
break;
|
break;
|
||||||
@@ -812,40 +729,14 @@ void MENU_AcceptSetting(void) {
|
|||||||
SETTINGS_FactoryReset(gSubMenuSelection);
|
SETTINGS_FactoryReset(gSubMenuSelection);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#ifndef ENABLE_FEAT_F4HWN
|
|
||||||
case MENU_350TX:
|
|
||||||
gSetting_350TX = gSubMenuSelection;
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
case MENU_F_LOCK: {
|
case MENU_F_LOCK: {
|
||||||
gSetting_F_LOCK = gSubMenuSelection;
|
gSetting_F_LOCK = gSubMenuSelection;
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN
|
if(gSetting_F_LOCK == F_LOCK_ALL) {
|
||||||
if (gSetting_F_LOCK == F_LOCK_ALL) {
|
|
||||||
SETTINGS_ResetTxLock();
|
SETTINGS_ResetTxLock();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#ifndef ENABLE_FEAT_F4HWN
|
|
||||||
case MENU_200TX:
|
|
||||||
gSetting_200TX = gSubMenuSelection;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case MENU_500TX:
|
|
||||||
gSetting_500TX = gSubMenuSelection;
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
case MENU_350EN:
|
|
||||||
gSetting_350EN = gSubMenuSelection;
|
|
||||||
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
|
||||||
gFlagResetVfos = true;
|
|
||||||
break;
|
|
||||||
// case MENU_SCREN:
|
|
||||||
// gSetting_ScrambleEnable = gSubMenuSelection;
|
|
||||||
// gFlagReconfigureVfos = true;
|
|
||||||
// break;
|
|
||||||
|
|
||||||
#ifdef ENABLE_F_CAL_MENU
|
#ifdef ENABLE_F_CAL_MENU
|
||||||
case MENU_F_CALI:
|
case MENU_F_CALI:
|
||||||
@@ -890,61 +781,21 @@ void MENU_AcceptSetting(void) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN
|
#ifdef ENABLE_FEAT_F4HWN
|
||||||
case MENU_SET_PWR:
|
|
||||||
gSetting_set_pwr = gSubMenuSelection;
|
|
||||||
gRequestSaveChannel = 1;
|
|
||||||
break;
|
|
||||||
case MENU_SET_PTT:
|
case MENU_SET_PTT:
|
||||||
gSetting_set_ptt = gSubMenuSelection;
|
gSetting_set_ptt = gSubMenuSelection;
|
||||||
gSetting_set_ptt_session = gSetting_set_ptt; // Special for action
|
gSetting_set_ptt_session = gSetting_set_ptt; // Special for action
|
||||||
break;
|
break;
|
||||||
case MENU_SET_TOT:
|
|
||||||
gSetting_set_tot = gSubMenuSelection;
|
|
||||||
break;
|
|
||||||
case MENU_SET_EOT:
|
|
||||||
gSetting_set_eot = gSubMenuSelection;
|
|
||||||
break;
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_CTR
|
|
||||||
case MENU_SET_CTR:
|
|
||||||
gSetting_set_ctr = gSubMenuSelection;
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
case MENU_SET_INV:
|
case MENU_SET_INV:
|
||||||
gSetting_set_inv = gSubMenuSelection;
|
gSetting_set_inv = gSubMenuSelection;
|
||||||
break;
|
break;
|
||||||
case MENU_SET_LCK:
|
|
||||||
gSetting_set_lck = gSubMenuSelection;
|
|
||||||
break;
|
|
||||||
case MENU_SET_MET:
|
|
||||||
gSetting_set_met = gSubMenuSelection;
|
|
||||||
break;
|
|
||||||
case MENU_SET_GUI:
|
|
||||||
gSetting_set_gui = gSubMenuSelection;
|
|
||||||
break;
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_NARROWER
|
|
||||||
case MENU_SET_NFM:
|
|
||||||
gSetting_set_nfm = gSubMenuSelection;
|
|
||||||
RADIO_SetTxParameters();
|
|
||||||
RADIO_SetupRegisters(true);
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_VOL
|
#ifdef ENABLE_FEAT_F4HWN_VOL
|
||||||
case MENU_SET_VOL:
|
case MENU_SET_VOL:
|
||||||
gEeprom.VOLUME_GAIN = gSubMenuSelection;
|
gEeprom.VOLUME_GAIN = gSubMenuSelection;
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
|
||||||
case MENU_SET_KEY:
|
|
||||||
gEeprom.SET_KEY = gSubMenuSelection;
|
|
||||||
break;
|
|
||||||
#endif
|
#endif
|
||||||
case MENU_SET_TMR:
|
case MENU_SET_TMR:
|
||||||
gSetting_set_tmr = gSubMenuSelection;
|
gSetting_set_tmr = gSubMenuSelection;
|
||||||
break;
|
break;
|
||||||
case MENU_TX_LOCK:
|
|
||||||
gTxVfo->TX_LOCK = gSubMenuSelection;
|
|
||||||
gRequestSaveChannel = 1;
|
|
||||||
return;
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1051,6 +902,10 @@ void MENU_ShowCurrentSetting(void) {
|
|||||||
gSubMenuSelection = gTxVfo->BUSY_CHANNEL_LOCK;
|
gSubMenuSelection = gTxVfo->BUSY_CHANNEL_LOCK;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case MENU_TOT:
|
||||||
|
gSubMenuSelection = gEeprom.TX_TIMEOUT_TIMER;
|
||||||
|
break;
|
||||||
|
|
||||||
case MENU_MEM_CH:
|
case MENU_MEM_CH:
|
||||||
#if 0
|
#if 0
|
||||||
gSubMenuSelection = gEeprom.MrChannel[0];
|
gSubMenuSelection = gEeprom.MrChannel[0];
|
||||||
@@ -1106,10 +961,9 @@ void MENU_ShowCurrentSetting(void) {
|
|||||||
gSubMenuSelection = gEeprom.BEEP_CONTROL;
|
gSubMenuSelection = gEeprom.BEEP_CONTROL;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_TOT:
|
case MENU_PMON:
|
||||||
gSubMenuSelection = gEeprom.TX_TIMEOUT_TIMER;
|
gSubMenuSelection = gEeprom.POCSAG_MONITOR;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
case MENU_VOICE:
|
case MENU_VOICE:
|
||||||
gSubMenuSelection = gEeprom.VOICE_PROMPT;
|
gSubMenuSelection = gEeprom.VOICE_PROMPT;
|
||||||
@@ -1186,15 +1040,6 @@ void MENU_ShowCurrentSetting(void) {
|
|||||||
gSubMenuSelection = gEeprom.DTMF_SIDE_TONE;
|
gSubMenuSelection = gEeprom.DTMF_SIDE_TONE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
case MENU_D_RSP:
|
|
||||||
gSubMenuSelection = gEeprom.DTMF_DECODE_RESPONSE;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case MENU_D_HOLD:
|
|
||||||
gSubMenuSelection = gEeprom.DTMF_auto_reset_time;
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
case MENU_D_PRE:
|
case MENU_D_PRE:
|
||||||
gSubMenuSelection = gEeprom.DTMF_PRELOAD_TIME / 10;
|
gSubMenuSelection = gEeprom.DTMF_PRELOAD_TIME / 10;
|
||||||
break;
|
break;
|
||||||
@@ -1207,15 +1052,6 @@ void MENU_ShowCurrentSetting(void) {
|
|||||||
gSubMenuSelection = gSetting_battery_text;
|
gSubMenuSelection = gSetting_battery_text;
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
case MENU_D_DCD:
|
|
||||||
gSubMenuSelection = gTxVfo->DTMF_DECODING_ENABLE;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case MENU_D_LIST:
|
|
||||||
gSubMenuSelection = gDTMF_chosen_contact + 1;
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
case MENU_D_LIVE_DEC:
|
case MENU_D_LIVE_DEC:
|
||||||
gSubMenuSelection = gSetting_live_DTMF_decoder;
|
gSubMenuSelection = gSetting_live_DTMF_decoder;
|
||||||
break;
|
break;
|
||||||
@@ -1268,17 +1104,6 @@ void MENU_ShowCurrentSetting(void) {
|
|||||||
gSubMenuSelection = gSetting_F_LOCK;
|
gSubMenuSelection = gSetting_F_LOCK;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifndef ENABLE_FEAT_F4HWN
|
|
||||||
case MENU_200TX:
|
|
||||||
gSubMenuSelection = gSetting_200TX;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case MENU_500TX:
|
|
||||||
gSubMenuSelection = gSetting_500TX;
|
|
||||||
break;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef ENABLE_F_CAL_MENU
|
#ifdef ENABLE_F_CAL_MENU
|
||||||
case MENU_F_CALI:
|
case MENU_F_CALI:
|
||||||
gSubMenuSelection = gEeprom.BK4819_XTAL_FREQ_LOW;
|
gSubMenuSelection = gEeprom.BK4819_XTAL_FREQ_LOW;
|
||||||
@@ -1323,56 +1148,20 @@ void MENU_ShowCurrentSetting(void) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN
|
#ifdef ENABLE_FEAT_F4HWN
|
||||||
case MENU_SET_PWR:
|
|
||||||
gSubMenuSelection = gSetting_set_pwr;
|
|
||||||
break;
|
|
||||||
case MENU_SET_PTT:
|
case MENU_SET_PTT:
|
||||||
gSubMenuSelection = gSetting_set_ptt_session;
|
gSubMenuSelection = gSetting_set_ptt_session;
|
||||||
break;
|
break;
|
||||||
case MENU_SET_TOT:
|
|
||||||
gSubMenuSelection = gSetting_set_tot;
|
|
||||||
break;
|
|
||||||
case MENU_SET_EOT:
|
|
||||||
gSubMenuSelection = gSetting_set_eot;
|
|
||||||
break;
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_CTR
|
|
||||||
case MENU_SET_CTR:
|
|
||||||
gSubMenuSelection = gSetting_set_ctr;
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
case MENU_SET_INV:
|
case MENU_SET_INV:
|
||||||
gSubMenuSelection = gSetting_set_inv;
|
gSubMenuSelection = gSetting_set_inv;
|
||||||
break;
|
break;
|
||||||
case MENU_SET_LCK:
|
|
||||||
gSubMenuSelection = gSetting_set_lck;
|
|
||||||
break;
|
|
||||||
case MENU_SET_MET:
|
|
||||||
gSubMenuSelection = gSetting_set_met;
|
|
||||||
break;
|
|
||||||
case MENU_SET_GUI:
|
|
||||||
gSubMenuSelection = gSetting_set_gui;
|
|
||||||
break;
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_NARROWER
|
|
||||||
case MENU_SET_NFM:
|
|
||||||
gSubMenuSelection = gSetting_set_nfm;
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_VOL
|
#ifdef ENABLE_FEAT_F4HWN_VOL
|
||||||
case MENU_SET_VOL:
|
case MENU_SET_VOL:
|
||||||
gSubMenuSelection = gEeprom.VOLUME_GAIN;
|
gSubMenuSelection = gEeprom.VOLUME_GAIN;
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
|
||||||
case MENU_SET_KEY:
|
|
||||||
gSubMenuSelection = gEeprom.SET_KEY;
|
|
||||||
break;
|
|
||||||
#endif
|
#endif
|
||||||
case MENU_SET_TMR:
|
case MENU_SET_TMR:
|
||||||
gSubMenuSelection = gSetting_set_tmr;
|
gSubMenuSelection = gSetting_set_tmr;
|
||||||
break;
|
break;
|
||||||
case MENU_TX_LOCK:
|
|
||||||
gSubMenuSelection = gTxVfo->TX_LOCK;
|
|
||||||
break;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -1384,7 +1173,7 @@ static void MENU_Key_0_to_9(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) {
|
|||||||
uint8_t Offset;
|
uint8_t Offset;
|
||||||
int32_t Min;
|
int32_t Min;
|
||||||
int32_t Max;
|
int32_t Max;
|
||||||
uint16_t Value = 0;
|
uint32_t Value = 0; // was uint16_t: truncated FSKSRC above 65535
|
||||||
|
|
||||||
if (bKeyHeld || !bKeyPressed)
|
if (bKeyHeld || !bKeyPressed)
|
||||||
return;
|
return;
|
||||||
@@ -1504,7 +1293,15 @@ static void MENU_Key_0_to_9(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Offset = (Max >= 100) ? 3 : (Max >= 10) ? 2 : 1;
|
Offset = (Max >= 1000000000) ? 10 :
|
||||||
|
(Max >= 100000000) ? 9 :
|
||||||
|
(Max >= 10000000) ? 8 :
|
||||||
|
(Max >= 1000000) ? 7 :
|
||||||
|
(Max >= 100000) ? 6 :
|
||||||
|
(Max >= 10000) ? 5 :
|
||||||
|
(Max >= 1000) ? 4 :
|
||||||
|
(Max >= 100) ? 3 :
|
||||||
|
(Max >= 10) ? 2 : 1;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
switch (gInputBoxIndex)
|
switch (gInputBoxIndex)
|
||||||
@@ -1528,7 +1325,7 @@ static void MENU_Key_0_to_9(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) {
|
|||||||
if (Offset == gInputBoxIndex)
|
if (Offset == gInputBoxIndex)
|
||||||
gInputBoxIndex = 0;
|
gInputBoxIndex = 0;
|
||||||
|
|
||||||
if (Value <= Max) {
|
if (Value <= (uint32_t) Max) {
|
||||||
gSubMenuSelection = Value;
|
gSubMenuSelection = Value;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1603,9 +1400,6 @@ static void MENU_Key_MENU(const bool bKeyPressed, const bool bKeyHeld) {
|
|||||||
#endif
|
#endif
|
||||||
if (UI_MENU_GetCurrentMenuId() == MENU_UPCODE
|
if (UI_MENU_GetCurrentMenuId() == MENU_UPCODE
|
||||||
|| UI_MENU_GetCurrentMenuId() == MENU_DWCODE
|
|| UI_MENU_GetCurrentMenuId() == MENU_DWCODE
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
|| UI_MENU_GetCurrentMenuId() == MENU_ANI_ID
|
|
||||||
#endif
|
|
||||||
)
|
)
|
||||||
return;
|
return;
|
||||||
#if 1
|
#if 1
|
||||||
|
|||||||
+274
@@ -0,0 +1,274 @@
|
|||||||
|
//
|
||||||
|
// Created by bruno on 3/30/25.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "messages.h"
|
||||||
|
#include "ui/ui.h"
|
||||||
|
#include "driver/uart.h"
|
||||||
|
#include "driver/systick.h"
|
||||||
|
#include "app/pocsag.h"
|
||||||
|
|
||||||
|
#define T9Count 9
|
||||||
|
|
||||||
|
// 0x1E00+ holds the radio calibration; the message store must never reach it.
|
||||||
|
_Static_assert(sizeof(StoredPacket) == MESSAGES_SLOT_SIZE, "StoredPacket layout");
|
||||||
|
_Static_assert(MESSAGES_START + MESSAGES_COUNT * MESSAGES_SLOT_SIZE <= MESSAGES_END,
|
||||||
|
"message store overlaps calibration EEPROM: lower MESSAGES_COUNT or POCSAG_MAX_MESSAGE_LENGTH");
|
||||||
|
_Static_assert(MESSAGES_PER_PAGE >= 1U, "POCSAG_MAX_MESSAGE_LENGTH too long for the display");
|
||||||
|
_Static_assert(MESSAGES_COUNT >= 1U && MESSAGES_COUNT <= 36U, "MESSAGES_COUNT out of range");
|
||||||
|
|
||||||
|
const char T9Table[10][T9Count] = {
|
||||||
|
{'#', '(', ')', ';', ':', '<', '>', '/', '0'},
|
||||||
|
{',', '.', '?', '&', '!', ' ', '-', '_', '1'},
|
||||||
|
{'a', 'b', 'c', 'A', 'B', 'C', '[', ']', '2'},
|
||||||
|
{'d', 'e', 'f', 'D', 'E', 'F', '@', '%', '3'},
|
||||||
|
{'g', 'h', 'i', 'G', 'H', 'I', '~', '$', '4'},
|
||||||
|
{'j', 'k', 'l', 'J', 'K', 'L', '|', '*', '5'},
|
||||||
|
{'m', 'n', 'o', 'M', 'N', 'O', '{', '}', '6'},
|
||||||
|
{'p', 'q', 'r', 's', 'P', 'Q', 'R', 'S', '7'},
|
||||||
|
{'t', 'u', 'v', 'T', 'U', 'V', '"', '\'', '8'},
|
||||||
|
{'w', 'x', 'y', 'z', 'W', 'X', 'Y', 'Z', '9'}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
uint8_t gActiveMessage = 0;
|
||||||
|
uint8_t gActiveMessageBank = 0;
|
||||||
|
|
||||||
|
StoredPacket loadedPacket;
|
||||||
|
|
||||||
|
char gMessageText[MESSAGES_TEXT_LENGTH + 1U];
|
||||||
|
|
||||||
|
uint8_t gKeyTimeout = 0;
|
||||||
|
|
||||||
|
static size_t MESSAGES_MaxTextLength(void)
|
||||||
|
{
|
||||||
|
// the SMS packet carries DataPacketDataSize bytes including the terminator
|
||||||
|
return MODEM_IS_POCSAG(gEeprom.FSKMode) ? MESSAGES_TEXT_LENGTH : DataPacketDataSize - 1U;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MESSAGES_SAVE(const uint32_t src, const uint8_t seq, const uint8_t ttl, const uint8_t flags,
|
||||||
|
const uint8_t *text, size_t length) {
|
||||||
|
uint8_t Data[8];
|
||||||
|
StoredPacket stored;
|
||||||
|
EEPROM_ReadBuffer(SEQParameterEEPROM, Data, 8);
|
||||||
|
// Data[1] = slot of the latest message (0 .. MESSAGES_COUNT-1), see UI_DisplayMessages()
|
||||||
|
uint8_t msgIndex = (uint8_t) ((Data[1] + 1U) % MESSAGES_COUNT);
|
||||||
|
if (Data[1] >= MESSAGES_COUNT)
|
||||||
|
msgIndex = 0;
|
||||||
|
Data[1] = msgIndex;
|
||||||
|
EEPROM_WriteBuffer(SEQParameterEEPROM, Data);
|
||||||
|
|
||||||
|
memset(&stored, 0, sizeof(stored));
|
||||||
|
stored.src = src;
|
||||||
|
stored.seq = seq;
|
||||||
|
stored.ttl = ttl;
|
||||||
|
stored.flags = flags;
|
||||||
|
if (length > MESSAGES_TEXT_LENGTH)
|
||||||
|
length = MESSAGES_TEXT_LENGTH;
|
||||||
|
for (size_t i = 0; i < length && text[i] != '\0'; i++)
|
||||||
|
stored.data[i] = text[i];
|
||||||
|
|
||||||
|
const uint16_t address = MESSAGES_START + (msgIndex * sizeof(StoredPacket));
|
||||||
|
for (unsigned int offset = 0; offset < sizeof(stored); offset += 8U)
|
||||||
|
EEPROM_WriteBuffer(address + offset, (const uint8_t *) &stored + offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MESSAGES_GET() {
|
||||||
|
if (gActiveMessage == MESSAGES_COUNT) {
|
||||||
|
memset(&loadedPacket, 0, sizeof(loadedPacket));
|
||||||
|
loadedPacket.src = dataPacket.src;
|
||||||
|
loadedPacket.seq = dataPacket.seq;
|
||||||
|
loadedPacket.ttl = dataPacket.ttl;
|
||||||
|
loadedPacket.flags = dataPacket.flags;
|
||||||
|
memcpy(loadedPacket.data, gMessageText, MESSAGES_TEXT_LENGTH);
|
||||||
|
} else {
|
||||||
|
EEPROM_ReadBuffer(MESSAGES_START + (gActiveMessage * sizeof(StoredPacket)), &loadedPacket,
|
||||||
|
sizeof(StoredPacket));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MESSAGES_GetText(char *text) {
|
||||||
|
size_t i = 0;
|
||||||
|
for (; i < MESSAGES_TEXT_LENGTH; i++) {
|
||||||
|
const uint8_t c = loadedPacket.data[i];
|
||||||
|
if (c == 0x00 || c == 0xFF) // NUL padding or erased EEPROM
|
||||||
|
break;
|
||||||
|
text[i] = (c < 0x20 || c > 0x7E) ? '?' : (char) c;
|
||||||
|
}
|
||||||
|
text[i] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
void MESSAGES_ShowNewest(void) {
|
||||||
|
gActiveMessageBank = MESSAGES_PAGES - 1U; // pages run oldest .. newest
|
||||||
|
}
|
||||||
|
|
||||||
|
void MESSAGES_DELETE() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void updatePrevChar(KEY_Code_t Key) {
|
||||||
|
if (Key != prevKey) {
|
||||||
|
prevKey = Key;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void MESSAGES_TimeSlice500ms(void) {
|
||||||
|
if (gKeyTimeout && gKeyTimeout++ > 2) {
|
||||||
|
gKeyTimeout = 0;
|
||||||
|
prevKey = KEY_EXIT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MESSAGES_ClearText(void) {
|
||||||
|
memset(gMessageText, 0, sizeof(gMessageText));
|
||||||
|
dataPTR = gMessageText;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MESSAGES_Send(void) {
|
||||||
|
#ifdef ENABLE_POCSAG
|
||||||
|
if (MODEM_IS_POCSAG(gEeprom.FSKMode)) {
|
||||||
|
MSG_POCSAGSend(dataPacket.dest, gMessageText);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
memset(dataPacket.data, 0, DataPacketDataSize);
|
||||||
|
memcpy(dataPacket.data, gMessageText, DataPacketDataSize - 1U);
|
||||||
|
MSG_FSKSendData(&dataPacket);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MESSAGES_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) {
|
||||||
|
#ifdef ENABLE_OOK_SENDER
|
||||||
|
if(Key == KEY_STAR) {
|
||||||
|
gRequestDisplayScreen = DISPLAY_OOKSENDER;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
gKeyTimeout = 1;
|
||||||
|
#if POCSAG_DEVIATION_TUNING
|
||||||
|
// POCSAG deviation tuning: 2 = more, 8 = less (send a page and check it on an SDR)
|
||||||
|
if (MODEM_IS_POCSAG(gEeprom.FSKMode) && gEnteringSMS == SMS_NOT_ENTERING &&
|
||||||
|
(Key == KEY_2 || Key == KEY_8)) {
|
||||||
|
if (bKeyPressed && !bKeyHeld)
|
||||||
|
POCSAG_AdjustDeviation(Key == KEY_2 ? 0x40 : -0x40);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
if (gEnteringSMS != SMS_NOT_ENTERING && Key <= KEY_9) {
|
||||||
|
if (!bKeyHeld) {
|
||||||
|
if (!dataPTR || dataPTR < gMessageText) {
|
||||||
|
dataPTR = gMessageText;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (gEnteringSMS == SMS_ENTERING_MESSAGE) {
|
||||||
|
if (bKeyPressed) {
|
||||||
|
if (prevKey != Key) {
|
||||||
|
if ((size_t) (dataPTR - gMessageText) >= MESSAGES_MaxTextLength()) {
|
||||||
|
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
dataPTR++;
|
||||||
|
prevLetter = 0;
|
||||||
|
}
|
||||||
|
*(dataPTR - 1) = T9Table[Key][prevLetter];
|
||||||
|
if (!bKeyHeld) {
|
||||||
|
prevLetter++;
|
||||||
|
} else {
|
||||||
|
prevLetter--;
|
||||||
|
}
|
||||||
|
prevLetter = (prevLetter) % T9Count;
|
||||||
|
updatePrevChar(Key);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
} else if (gEnteringSMS == SMS_ENTERING_DEST) {
|
||||||
|
if (!bKeyHeld) {
|
||||||
|
if (bKeyPressed) {
|
||||||
|
const uint32_t dest = dataPacket.dest * 10U + Key;
|
||||||
|
// in POCSAG mode the destination is the pager RIC (21 bits)
|
||||||
|
if (MODEM_IS_POCSAG(gEeprom.FSKMode) && dest > POCSAG_MAX_RIC) {
|
||||||
|
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
dataPacket.dest = dest;
|
||||||
|
prevLetter = 0;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
switch (Key) {
|
||||||
|
case KEY_PTT:
|
||||||
|
case KEY_MENU:
|
||||||
|
if (gEnteringSMS == SMS_NOT_ENTERING) {
|
||||||
|
if (bKeyPressed) {
|
||||||
|
gEnteringSMS = SMS_ENTERING_DEST;
|
||||||
|
updatePrevChar(Key);
|
||||||
|
}
|
||||||
|
} else if (gEnteringSMS == SMS_ENTERING_DEST) {
|
||||||
|
if (bKeyPressed) {
|
||||||
|
MESSAGES_ClearText();
|
||||||
|
prepareDataPacket();
|
||||||
|
dataPacket.flags = 0x80 | (gCurrentVfo->OUTPUT_POWER & 0x07);
|
||||||
|
gEnteringSMS = SMS_ENTERING_MESSAGE;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
} else if (gEnteringSMS == SMS_ENTERING_MESSAGE) {
|
||||||
|
if (bKeyPressed) {
|
||||||
|
if (strlen(gMessageText)) {
|
||||||
|
MESSAGES_Send();
|
||||||
|
gEnteringSMS = SMS_NOT_ENTERING;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case KEY_UP:
|
||||||
|
if (gEnteringSMS == SMS_NOT_ENTERING && bKeyPressed) {
|
||||||
|
gActiveMessageBank = (uint8_t) ((gActiveMessageBank + 1U) % MESSAGES_PAGES);
|
||||||
|
gUpdateDisplay = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case KEY_DOWN:
|
||||||
|
if (gEnteringSMS == SMS_NOT_ENTERING && bKeyPressed) {
|
||||||
|
gActiveMessageBank = gActiveMessageBank ? gActiveMessageBank - 1U : MESSAGES_PAGES - 1U;
|
||||||
|
gUpdateDisplay = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case KEY_EXIT:
|
||||||
|
if (gEnteringSMS != SMS_NOT_ENTERING) {
|
||||||
|
if (bKeyHeld) {
|
||||||
|
if (bKeyPressed) {
|
||||||
|
gEnteringSMS = SMS_NOT_ENTERING;
|
||||||
|
MESSAGES_ClearText();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (bKeyPressed) {
|
||||||
|
if (gEnteringSMS == SMS_ENTERING_MESSAGE) {
|
||||||
|
if (gMessageText <= dataPTR) {
|
||||||
|
*dataPTR = '\0';
|
||||||
|
if (gMessageText < dataPTR) {
|
||||||
|
dataPTR--;
|
||||||
|
}
|
||||||
|
*dataPTR = '\0';
|
||||||
|
}
|
||||||
|
} else if (gEnteringSMS == SMS_ENTERING_DEST) {
|
||||||
|
dataPacket.dest /= 10;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (bKeyPressed) {
|
||||||
|
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
updatePrevChar(Key);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
if (!bKeyHeld && bKeyPressed)
|
||||||
|
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
//
|
||||||
|
// Created by bruno on 3/30/25.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef BRNQUANFW_MESSAGES_H
|
||||||
|
#define BRNQUANFW_MESSAGES_H
|
||||||
|
#include "fskmodem.h"
|
||||||
|
#include "../driver/keyboard.h"
|
||||||
|
#include "../driver/eeprom.h"
|
||||||
|
|
||||||
|
#include "pocsag.h"
|
||||||
|
|
||||||
|
// Message store: MESSAGES_COUNT slots between MESSAGES_START and the calibration
|
||||||
|
// data at MESSAGES_END. Override MESSAGES_COUNT / POCSAG_MAX_MESSAGE_LENGTH with -D;
|
||||||
|
// changing either moves the slots (old stored messages read back as garbage).
|
||||||
|
#define MESSAGES_START (SEQParameterEEPROM + 8U)
|
||||||
|
#define MESSAGES_END (0x1E00U)
|
||||||
|
#define MESSAGE_FLAG_POCSAG (0x20U)
|
||||||
|
|
||||||
|
#define MESSAGES_TEXT_LENGTH POCSAG_MAX_MESSAGE_LENGTH
|
||||||
|
#define MESSAGES_HEADER_SIZE 7U // src, seq, ttl, flags
|
||||||
|
// EEPROM is written in 8 byte blocks, so slots are a multiple of 8 bytes
|
||||||
|
#define MESSAGES_SLOT_SIZE (((MESSAGES_HEADER_SIZE + MESSAGES_TEXT_LENGTH + 7U) / 8U) * 8U)
|
||||||
|
// default: as many messages as fit (40 characters -> 48 byte slots -> 26 messages)
|
||||||
|
#ifndef MESSAGES_COUNT
|
||||||
|
#define MESSAGES_COUNT ((MESSAGES_END - MESSAGES_START) / MESSAGES_SLOT_SIZE)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Display: 18 small-font characters per line, header line + text lines per message
|
||||||
|
#define MESSAGES_LINE_CHARS 18U
|
||||||
|
#define MESSAGES_TEXT_LINES ((MESSAGES_TEXT_LENGTH + MESSAGES_LINE_CHARS - 1U) / MESSAGES_LINE_CHARS)
|
||||||
|
#define MESSAGES_PER_PAGE (8U / (1U + MESSAGES_TEXT_LINES))
|
||||||
|
#define MESSAGES_PAGES ((MESSAGES_COUNT + MESSAGES_PER_PAGE - 1U) / MESSAGES_PER_PAGE)
|
||||||
|
|
||||||
|
typedef struct __attribute__((packed)) {
|
||||||
|
uint32_t src;
|
||||||
|
uint8_t seq;
|
||||||
|
uint8_t ttl;
|
||||||
|
uint8_t flags;
|
||||||
|
uint8_t data[MESSAGES_SLOT_SIZE - MESSAGES_HEADER_SIZE]; // text, NUL padded
|
||||||
|
} StoredPacket;
|
||||||
|
|
||||||
|
// Text being typed / last sent (SMS mode sends the first DataPacketDataSize - 1 chars)
|
||||||
|
extern char gMessageText[MESSAGES_TEXT_LENGTH + 1U];
|
||||||
|
|
||||||
|
extern uint8_t gActiveMessage;
|
||||||
|
extern uint8_t gActiveMessageBank;
|
||||||
|
|
||||||
|
extern StoredPacket loadedPacket;
|
||||||
|
|
||||||
|
extern uint8_t gKeyTimeout;
|
||||||
|
|
||||||
|
void MESSAGES_GET();
|
||||||
|
void MESSAGES_DELETE();
|
||||||
|
void MESSAGES_SAVE(uint32_t src, uint8_t seq, uint8_t ttl, uint8_t flags,
|
||||||
|
const uint8_t *text, size_t length);
|
||||||
|
// loadedPacket text as a NUL terminated string (buffer of MESSAGES_TEXT_LENGTH + 1)
|
||||||
|
void MESSAGES_GetText(char *text);
|
||||||
|
// show the newest messages page
|
||||||
|
void MESSAGES_ShowNewest(void);
|
||||||
|
void MESSAGES_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld);
|
||||||
|
void MESSAGES_TimeSlice500ms(void);
|
||||||
|
|
||||||
|
#endif //BRNQUANFW_MESSAGES_H
|
||||||
+353
@@ -0,0 +1,353 @@
|
|||||||
|
//
|
||||||
|
// Created by bruno on 3/30/25.
|
||||||
|
//
|
||||||
|
// OOK remote code sender. The carrier is generated in TX mode with the audio
|
||||||
|
// muted and keyed with the PA enable line (fast SPI write, ~25 us). Every edge
|
||||||
|
// is scheduled on an absolute SysTick clock, so the write latency is the same
|
||||||
|
// for every edge and does not change pulse widths, and nothing drifts.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "ooksender.h"
|
||||||
|
#include <stddef.h>
|
||||||
|
#include "ARMCM0.h"
|
||||||
|
#include "audio.h"
|
||||||
|
#include "driver/bk4819.h"
|
||||||
|
#include "driver/system.h"
|
||||||
|
#include "frequencies.h"
|
||||||
|
#include "misc.h"
|
||||||
|
#include "radio.h"
|
||||||
|
#include "ui/ooksender.h"
|
||||||
|
#include "ui/ui.h"
|
||||||
|
|
||||||
|
uint8_t gOOKSenderState = OOKSENDER_PROTO_CHOOSE;
|
||||||
|
uint8_t gOOKSenderProtocol = OOKSENDER_PROTO_EV1527;
|
||||||
|
uint8_t gOOKSenderField = OOK_FIELD_CODE;
|
||||||
|
uint32_t gOOKSenderValue[OOK_FIELD_COUNT];
|
||||||
|
|
||||||
|
#define PT2262_MAX_TRITS 12U
|
||||||
|
|
||||||
|
// rc-switch protocols: pulse length, then (high, low) in pulses for sync, 0 and 1.
|
||||||
|
// Data bits are sent MSB first, followed by the sync (rc-switch order).
|
||||||
|
typedef struct {
|
||||||
|
uint16_t pulse_us;
|
||||||
|
uint8_t sync[2];
|
||||||
|
uint8_t zero[2];
|
||||||
|
uint8_t one[2];
|
||||||
|
bool inverted;
|
||||||
|
} OOK_RcProtocol_t;
|
||||||
|
|
||||||
|
static const OOK_RcProtocol_t rcProtocols[7] = {
|
||||||
|
{350, {1, 31}, {1, 3}, {3, 1}, false}, // 1: PT2262, EV1527, most cheap remotes
|
||||||
|
{650, {1, 10}, {1, 2}, {2, 1}, false}, // 2
|
||||||
|
{100, {30, 71}, {4, 11}, {9, 6}, false}, // 3
|
||||||
|
{380, {1, 6}, {1, 3}, {3, 1}, false}, // 4
|
||||||
|
{500, {6, 14}, {1, 2}, {2, 1}, false}, // 5
|
||||||
|
{450, {23, 1}, {1, 2}, {2, 1}, true}, // 6: HT6P20B
|
||||||
|
{150, {2, 62}, {1, 6}, {6, 1}, false}, // 7: HS2303-PT
|
||||||
|
};
|
||||||
|
|
||||||
|
// Field labels per protocol, index into labelText (0 = field not used)
|
||||||
|
static const char labelText[][7] = {"", "Code", "ID", "Key", "Bits", "Proto", "Unit", "On", "Pulse", "Half", "Repeat"};
|
||||||
|
static const uint8_t fieldLabels[OOKSENDER_PROTO_END][OOK_FIELD_COUNT] = {
|
||||||
|
[OOKSENDER_PROTO_PT2262] = {1, 0, 0, 8, 10},
|
||||||
|
[OOKSENDER_PROTO_EV1527] = {2, 3, 0, 8, 10},
|
||||||
|
[OOKSENDER_PROTO_RCSWITCH] = {1, 4, 5, 8, 10},
|
||||||
|
[OOKSENDER_PROTO_INTERTECHNO] = {2, 6, 7, 8, 10},
|
||||||
|
[OOKSENDER_PROTO_MANCHESTER] = {1, 4, 0, 9, 10},
|
||||||
|
};
|
||||||
|
|
||||||
|
// Largest value per field: code / ID in bits, the others plain
|
||||||
|
static const uint8_t codeBits[OOKSENDER_PROTO_END] = {24, 20, 32, 26, 32};
|
||||||
|
static const uint8_t argMax[OOKSENDER_PROTO_END] = {PT2262_MAX_TRITS, 15, 32, 15, 32};
|
||||||
|
static const uint8_t extraMax[OOKSENDER_PROTO_END] = {0, 0, 7, 1, 0};
|
||||||
|
|
||||||
|
static uint32_t OOK_FieldMax(const uint8_t field)
|
||||||
|
{
|
||||||
|
switch (field) {
|
||||||
|
case OOK_FIELD_CODE: return codeBits[gOOKSenderProtocol] >= 32U ? 0xFFFFFFFFU
|
||||||
|
: (1UL << codeBits[gOOKSenderProtocol]) - 1U;
|
||||||
|
case OOK_FIELD_ARG: return argMax[gOOKSenderProtocol];
|
||||||
|
case OOK_FIELD_EXTRA: return extraMax[gOOKSenderProtocol];
|
||||||
|
case OOK_FIELD_PULSE: return 5000U;
|
||||||
|
default: return 100U;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *OOKSENDER_FieldLabel(const uint8_t protocol, const uint8_t field)
|
||||||
|
{
|
||||||
|
const uint8_t label = fieldLabels[protocol][field];
|
||||||
|
return label ? labelText[label] : NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void OOK_SetDefaults(void)
|
||||||
|
{
|
||||||
|
static const uint16_t pulse[OOKSENDER_PROTO_END] = {350, 350, 350, 260, 500};
|
||||||
|
static const uint8_t arg[OOKSENDER_PROTO_END] = {0, 0, 24, 0, 16};
|
||||||
|
|
||||||
|
gOOKSenderValue[OOK_FIELD_CODE] = 0;
|
||||||
|
gOOKSenderValue[OOK_FIELD_ARG] = arg[gOOKSenderProtocol];
|
||||||
|
gOOKSenderValue[OOK_FIELD_EXTRA] = 1; // rc-switch protocol 1 / Intertechno "on"
|
||||||
|
gOOKSenderValue[OOK_FIELD_PULSE] = pulse[gOOKSenderProtocol];
|
||||||
|
gOOKSenderValue[OOK_FIELD_REPEAT] = 10;
|
||||||
|
gOOKSenderField = OOK_FIELD_CODE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------- timing
|
||||||
|
|
||||||
|
#define OOK_TICKS_PER_US 48U // SysTick runs on the 48 MHz core clock
|
||||||
|
|
||||||
|
static uint32_t ookLastVal;
|
||||||
|
static uint32_t ookNow;
|
||||||
|
static uint32_t ookDue;
|
||||||
|
|
||||||
|
// Monotonic 48 MHz tick count. SysTick counts down and reloads every 10 ms, so this
|
||||||
|
// must be called more often than that (the busy waits below do).
|
||||||
|
static uint32_t OOK_Ticks(void)
|
||||||
|
{
|
||||||
|
const uint32_t value = SysTick->VAL;
|
||||||
|
ookNow += (ookLastVal >= value) ? ookLastVal - value : ookLastVal + SysTick->LOAD + 1U - value;
|
||||||
|
ookLastVal = value;
|
||||||
|
return ookNow;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Switch the carrier at the scheduled time, then schedule the next edge.
|
||||||
|
static void OOK_Level(const bool on, const uint32_t us)
|
||||||
|
{
|
||||||
|
while ((int32_t) (OOK_Ticks() - ookDue) < 0) {
|
||||||
|
}
|
||||||
|
BK4819_ToggleGpioOutFast(BK4819_GPIO1_PIN29_PA_ENABLE, on);
|
||||||
|
ookDue += us * OOK_TICKS_PER_US;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void OOK_Pair(const uint8_t ratio[2], const uint32_t pulse, const bool inverted)
|
||||||
|
{
|
||||||
|
OOK_Level(!inverted, ratio[0] * pulse);
|
||||||
|
OOK_Level(inverted, ratio[1] * pulse);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------- encoders
|
||||||
|
|
||||||
|
static void OOK_SendRcBits(const OOK_RcProtocol_t *p, const uint32_t code, const uint8_t bits,
|
||||||
|
const uint32_t pulse)
|
||||||
|
{
|
||||||
|
for (uint8_t i = bits; i-- > 0;)
|
||||||
|
OOK_Pair(((code >> i) & 1U) ? p->one : p->zero, pulse, p->inverted);
|
||||||
|
OOK_Pair(p->sync, pulse, p->inverted);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void OOK_SendFrame(void)
|
||||||
|
{
|
||||||
|
static const uint8_t itShort[2] = {1, 1}, itLong[2] = {1, 5};
|
||||||
|
static const uint8_t itStart[2] = {1, 10}, itEnd[2] = {1, 40};
|
||||||
|
const uint32_t code = gOOKSenderValue[OOK_FIELD_CODE];
|
||||||
|
const uint32_t arg = gOOKSenderValue[OOK_FIELD_ARG];
|
||||||
|
const uint32_t pulse = gOOKSenderValue[OOK_FIELD_PULSE];
|
||||||
|
const OOK_RcProtocol_t *p1 = &rcProtocols[0];
|
||||||
|
|
||||||
|
switch (gOOKSenderProtocol) {
|
||||||
|
case OOKSENDER_PROTO_PT2262:
|
||||||
|
// trit 0 = "0 0", trit 1 = "1 1", trit F = "0 1" (2 bits per trit in code)
|
||||||
|
for (uint32_t i = arg; i-- > 0;) {
|
||||||
|
const uint32_t trit = (code >> (2U * i)) & 3U;
|
||||||
|
OOK_Pair(trit == 1U ? p1->one : p1->zero, pulse, false);
|
||||||
|
OOK_Pair(trit == 0U ? p1->zero : p1->one, pulse, false);
|
||||||
|
}
|
||||||
|
OOK_Pair(p1->sync, pulse, false);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case OOKSENDER_PROTO_EV1527:
|
||||||
|
OOK_SendRcBits(p1, (code << 4) | (arg & 0x0FU), 24, pulse);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case OOKSENDER_PROTO_RCSWITCH:
|
||||||
|
OOK_SendRcBits(&rcProtocols[gOOKSenderValue[OOK_FIELD_EXTRA] - 1U], code, (uint8_t) arg, pulse);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case OOKSENDER_PROTO_INTERTECHNO: {
|
||||||
|
// 26 bit ID, group bit (0), on/off, 4 bit unit; bit 0 = short+long, 1 = long+short
|
||||||
|
const uint32_t word = (code << 6) | ((gOOKSenderValue[OOK_FIELD_EXTRA] & 1U) << 4) | (arg & 0x0FU);
|
||||||
|
OOK_Pair(itStart, pulse, false);
|
||||||
|
for (uint8_t i = 32; i-- > 0;) {
|
||||||
|
const bool one = (word >> i) & 1U;
|
||||||
|
OOK_Pair(one ? itLong : itShort, pulse, false);
|
||||||
|
OOK_Pair(one ? itShort : itLong, pulse, false);
|
||||||
|
}
|
||||||
|
OOK_Pair(itEnd, pulse, false);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case OOKSENDER_PROTO_MANCHESTER:
|
||||||
|
// 1 = on/off, 0 = off/on (half bit each), then a 20 half-bit gap
|
||||||
|
for (uint32_t i = arg; i-- > 0;) {
|
||||||
|
const bool one = (code >> i) & 1U;
|
||||||
|
OOK_Level(one, pulse);
|
||||||
|
OOK_Level(!one, pulse);
|
||||||
|
}
|
||||||
|
OOK_Level(false, 20U * pulse);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool OOK_Valid(void)
|
||||||
|
{
|
||||||
|
const uint32_t *v = gOOKSenderValue;
|
||||||
|
|
||||||
|
if (v[OOK_FIELD_REPEAT] == 0 || v[OOK_FIELD_PULSE] < 50U)
|
||||||
|
return false;
|
||||||
|
switch (gOOKSenderProtocol) {
|
||||||
|
case OOKSENDER_PROTO_PT2262:
|
||||||
|
return v[OOK_FIELD_ARG] > 0;
|
||||||
|
case OOKSENDER_PROTO_RCSWITCH:
|
||||||
|
return v[OOK_FIELD_ARG] > 0 && v[OOK_FIELD_EXTRA] >= 1U && v[OOK_FIELD_EXTRA] <= 7U;
|
||||||
|
case OOKSENDER_PROTO_MANCHESTER:
|
||||||
|
return v[OOK_FIELD_ARG] > 0;
|
||||||
|
default:
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void OOK_Transmit(void)
|
||||||
|
{
|
||||||
|
if (!OOK_Valid() || TX_freq_check(gCurrentVfo->pTX->Frequency) != 0) {
|
||||||
|
AUDIO_PlayBeep(BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
gOOKSenderState = OOKSENDER_SENDING;
|
||||||
|
OOKSENDER_Display();
|
||||||
|
|
||||||
|
// unmodulated carrier, PA switched off until the first pulse
|
||||||
|
BK4819_EnterTxMute();
|
||||||
|
RADIO_SetTxParameters();
|
||||||
|
BK4819_WriteRegister(BK4819_REG_30,
|
||||||
|
BK4819_REG_30_ENABLE_VCO_CALIB |
|
||||||
|
BK4819_REG_30_ENABLE_UNKNOWN |
|
||||||
|
BK4819_REG_30_DISABLE_RX_LINK |
|
||||||
|
BK4819_REG_30_DISABLE_AF_DAC |
|
||||||
|
BK4819_REG_30_ENABLE_DISC_MODE |
|
||||||
|
BK4819_REG_30_ENABLE_PLL_VCO |
|
||||||
|
BK4819_REG_30_ENABLE_PA_GAIN |
|
||||||
|
BK4819_REG_30_DISABLE_MIC_ADC |
|
||||||
|
BK4819_REG_30_ENABLE_TX_DSP |
|
||||||
|
BK4819_REG_30_DISABLE_RX_DSP);
|
||||||
|
BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29_PA_ENABLE, false);
|
||||||
|
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1_RED, true);
|
||||||
|
SYSTEM_DelayMs(20);
|
||||||
|
|
||||||
|
ookLastVal = SysTick->VAL;
|
||||||
|
ookNow = 0;
|
||||||
|
ookDue = 200U * OOK_TICKS_PER_US;
|
||||||
|
for (uint32_t r = 0; r < gOOKSenderValue[OOK_FIELD_REPEAT]; r++)
|
||||||
|
OOK_SendFrame();
|
||||||
|
OOK_Level(false, 0); // end of the last pulse / gap
|
||||||
|
|
||||||
|
SYSTEM_DelayMs(20);
|
||||||
|
BK4819_SetupPowerAmplifier(0, 0);
|
||||||
|
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1_RED, false);
|
||||||
|
RADIO_SetupRegisters(true); // back to normal RX
|
||||||
|
|
||||||
|
gOOKSenderState = OOKSENDER_DATA_INPUT;
|
||||||
|
gUpdateDisplay = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------- keys
|
||||||
|
|
||||||
|
static void OOK_NextField(const int8_t direction)
|
||||||
|
{
|
||||||
|
for (uint8_t n = 0; n < OOK_FIELD_COUNT; n++) {
|
||||||
|
gOOKSenderField = (uint8_t) ((gOOKSenderField + OOK_FIELD_COUNT + direction) % OOK_FIELD_COUNT);
|
||||||
|
if (fieldLabels[gOOKSenderProtocol][gOOKSenderField] != 0)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void OOK_Digit(const uint8_t digit)
|
||||||
|
{
|
||||||
|
uint32_t *value = &gOOKSenderValue[gOOKSenderField];
|
||||||
|
|
||||||
|
if (gOOKSenderProtocol == OOKSENDER_PROTO_PT2262 && gOOKSenderField == OOK_FIELD_CODE) {
|
||||||
|
// keys 0, 1 and 2 (= F) append a trit
|
||||||
|
if (digit > 2U || gOOKSenderValue[OOK_FIELD_ARG] >= PT2262_MAX_TRITS) {
|
||||||
|
AUDIO_PlayBeep(BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
*value = (*value << 2) | digit;
|
||||||
|
gOOKSenderValue[OOK_FIELD_ARG]++;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const uint32_t max = OOK_FieldMax(gOOKSenderField);
|
||||||
|
if (*value > (max - digit) / 10U) { // value * 10 + digit > max, without overflow
|
||||||
|
AUDIO_PlayBeep(BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
*value = *value * 10U + digit;
|
||||||
|
|
||||||
|
// a new rc-switch protocol brings its own pulse length
|
||||||
|
if (gOOKSenderProtocol == OOKSENDER_PROTO_RCSWITCH && gOOKSenderField == OOK_FIELD_EXTRA &&
|
||||||
|
*value >= 1U && *value <= 7U)
|
||||||
|
gOOKSenderValue[OOK_FIELD_PULSE] = rcProtocols[*value - 1U].pulse_us;
|
||||||
|
}
|
||||||
|
|
||||||
|
// returns false when the field was already empty
|
||||||
|
static bool OOK_Backspace(void)
|
||||||
|
{
|
||||||
|
uint32_t *value = &gOOKSenderValue[gOOKSenderField];
|
||||||
|
|
||||||
|
if (gOOKSenderProtocol == OOKSENDER_PROTO_PT2262 && gOOKSenderField == OOK_FIELD_CODE) {
|
||||||
|
if (gOOKSenderValue[OOK_FIELD_ARG] == 0)
|
||||||
|
return false;
|
||||||
|
*value >>= 2;
|
||||||
|
gOOKSenderValue[OOK_FIELD_ARG]--;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (*value == 0)
|
||||||
|
return false;
|
||||||
|
*value /= 10U;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void OOKSENDER_TimeSlice500ms(void) {
|
||||||
|
}
|
||||||
|
|
||||||
|
void OOKSENDER_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) {
|
||||||
|
if (!bKeyPressed || bKeyHeld)
|
||||||
|
return;
|
||||||
|
|
||||||
|
switch (gOOKSenderState) {
|
||||||
|
case OOKSENDER_PROTO_CHOOSE:
|
||||||
|
if (Key == KEY_EXIT) {
|
||||||
|
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||||
|
} else if (Key == KEY_MENU) {
|
||||||
|
OOK_SetDefaults();
|
||||||
|
gOOKSenderState = OOKSENDER_DATA_INPUT;
|
||||||
|
} else if (Key == KEY_UP) {
|
||||||
|
gOOKSenderProtocol = (gOOKSenderProtocol + 1U) % OOKSENDER_PROTO_END;
|
||||||
|
} else if (Key == KEY_DOWN) {
|
||||||
|
gOOKSenderProtocol = (gOOKSenderProtocol + OOKSENDER_PROTO_END - 1U) % OOKSENDER_PROTO_END;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case OOKSENDER_DATA_INPUT:
|
||||||
|
if (Key <= KEY_9) {
|
||||||
|
OOK_Digit((uint8_t) (Key - KEY_0));
|
||||||
|
} else if (Key == KEY_UP) {
|
||||||
|
OOK_NextField(-1);
|
||||||
|
} else if (Key == KEY_DOWN) {
|
||||||
|
OOK_NextField(1);
|
||||||
|
} else if (Key == KEY_EXIT) {
|
||||||
|
if (!OOK_Backspace())
|
||||||
|
gOOKSenderState = OOKSENDER_PROTO_CHOOSE; // EXIT on an empty field
|
||||||
|
} else if (Key == KEY_MENU || Key == KEY_PTT) {
|
||||||
|
OOK_Transmit();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
gUpdateDisplay = true;
|
||||||
|
}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
//
|
||||||
|
// Created by bruno on 3/30/25.
|
||||||
|
//
|
||||||
|
// OOK (on/off keyed carrier) sender for 433 MHz style remotes: the carrier is
|
||||||
|
// keyed with the PA enable line, pulse edges are timed against SysTick.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef BRNQUANFW_OOKSENDER_H
|
||||||
|
#define BRNQUANFW_OOKSENDER_H
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include "../driver/keyboard.h"
|
||||||
|
|
||||||
|
typedef enum OOKSENDERSCREENSTATE {
|
||||||
|
OOKSENDER_PROTO_CHOOSE = 0,
|
||||||
|
OOKSENDER_DATA_INPUT,
|
||||||
|
OOKSENDER_SENDING
|
||||||
|
} OOKSENDERSCREENSTATE;
|
||||||
|
|
||||||
|
typedef enum OOKSENDERPROTO {
|
||||||
|
OOKSENDER_PROTO_PT2262 = 0, // tri-state code, 12 trits (0 / 1 / F)
|
||||||
|
OOKSENDER_PROTO_EV1527, // 20 bit ID + 4 bit key
|
||||||
|
OOKSENDER_PROTO_RCSWITCH, // rc-switch protocols 1..7, decimal code
|
||||||
|
OOKSENDER_PROTO_INTERTECHNO, // Intertechno / KlikAanKlikUit self learning
|
||||||
|
OOKSENDER_PROTO_MANCHESTER, // raw Manchester bits
|
||||||
|
OOKSENDER_PROTO_END,
|
||||||
|
} OOKSENDERPROTO;
|
||||||
|
|
||||||
|
// Editable fields, meaning per protocol (labels: OOKSENDER_FieldLabel)
|
||||||
|
enum {
|
||||||
|
OOK_FIELD_CODE = 0, // code / ID / trits (PT2262: 2 bits per trit)
|
||||||
|
OOK_FIELD_ARG, // bits / key / unit / trit count
|
||||||
|
OOK_FIELD_EXTRA, // rc-switch protocol, Intertechno on/off
|
||||||
|
OOK_FIELD_PULSE, // base pulse length in us
|
||||||
|
OOK_FIELD_REPEAT, // number of code repetitions
|
||||||
|
OOK_FIELD_COUNT
|
||||||
|
};
|
||||||
|
|
||||||
|
extern uint8_t gOOKSenderState;
|
||||||
|
extern uint8_t gOOKSenderProtocol;
|
||||||
|
extern uint8_t gOOKSenderField;
|
||||||
|
extern uint32_t gOOKSenderValue[OOK_FIELD_COUNT];
|
||||||
|
|
||||||
|
// NULL when the field is not used by the protocol
|
||||||
|
const char *OOKSENDER_FieldLabel(uint8_t protocol, uint8_t field);
|
||||||
|
|
||||||
|
void OOKSENDER_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld);
|
||||||
|
void OOKSENDER_TimeSlice500ms(void);
|
||||||
|
|
||||||
|
#endif //BRNQUANFW_OOKSENDER_H
|
||||||
+249
@@ -0,0 +1,249 @@
|
|||||||
|
#include "app/pocsag.h"
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#define POCSAG_BCH_POLYNOMIAL 0x769U // x^10 + x^9 + x^8 + x^6 + x^5 + x^3 + 1
|
||||||
|
#define POCSAG_FUNCTION_ALPHA 3U
|
||||||
|
#define POCSAG_MESSAGE_WORDS ((POCSAG_MAX_MESSAGE_LENGTH * 7U + 19U) / 20U)
|
||||||
|
#define POCSAG_TOTAL_SLOTS (POCSAG_BATCH_COUNT * POCSAG_BATCH_WORDS)
|
||||||
|
|
||||||
|
// Worst case: address in the last slot of frame 7, followed by a full message.
|
||||||
|
// There must be room for at least one idle codeword afterwards to terminate it.
|
||||||
|
_Static_assert(7U * 2U + 1U + POCSAG_MESSAGE_WORDS < POCSAG_TOTAL_SLOTS,
|
||||||
|
"POCSAG frame too short for the longest message");
|
||||||
|
|
||||||
|
static uint8_t parity32(uint32_t value)
|
||||||
|
{
|
||||||
|
value ^= value >> 16;
|
||||||
|
value ^= value >> 8;
|
||||||
|
value ^= value >> 4;
|
||||||
|
value ^= value >> 2;
|
||||||
|
value ^= value >> 1;
|
||||||
|
return value & 1U;
|
||||||
|
}
|
||||||
|
|
||||||
|
// information: 21 bits (flag bit 20, then 20 data bits)
|
||||||
|
static uint32_t make_codeword(const uint32_t information)
|
||||||
|
{
|
||||||
|
uint32_t remainder = information << 10;
|
||||||
|
uint32_t codeword;
|
||||||
|
|
||||||
|
for (int bit = 30; bit >= 10; bit--) {
|
||||||
|
if (remainder & (1UL << bit))
|
||||||
|
remainder ^= (uint32_t)POCSAG_BCH_POLYNOMIAL << (bit - 10);
|
||||||
|
}
|
||||||
|
|
||||||
|
codeword = (information << 11) | ((remainder & 0x3FFU) << 1);
|
||||||
|
return codeword | parity32(codeword);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void write_word(uint8_t *output, const uint32_t word)
|
||||||
|
{
|
||||||
|
output[0] = (uint8_t)(word >> 24);
|
||||||
|
output[1] = (uint8_t)(word >> 16);
|
||||||
|
output[2] = (uint8_t)(word >> 8);
|
||||||
|
output[3] = (uint8_t)word;
|
||||||
|
}
|
||||||
|
|
||||||
|
static uint32_t read_word(const uint8_t *input, const size_t bit_offset, const bool invert)
|
||||||
|
{
|
||||||
|
uint32_t word = 0;
|
||||||
|
|
||||||
|
for (unsigned bit = 0; bit < 32; bit++) {
|
||||||
|
const size_t position = bit_offset + bit;
|
||||||
|
word = (word << 1) | ((input[position >> 3] >> (7U - (position & 7U))) & 1U);
|
||||||
|
}
|
||||||
|
|
||||||
|
return invert ? ~word : word;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sync codeword match with up to POCSAG_SYNC_MAX_ERRORS wrong bits (like multimon-ng);
|
||||||
|
// an exact match loses the whole batch on a single bit error.
|
||||||
|
#define POCSAG_SYNC_MAX_ERRORS 2U
|
||||||
|
|
||||||
|
static unsigned sync_errors(const uint32_t word)
|
||||||
|
{
|
||||||
|
return (unsigned)__builtin_popcountl(word ^ POCSAG_SYNC_WORD);
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool is_valid_codeword(const uint32_t word)
|
||||||
|
{
|
||||||
|
return make_codeword(word >> 11) == word;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Accepts a codeword with at most one bit error.
|
||||||
|
static bool correct_codeword(uint32_t *word)
|
||||||
|
{
|
||||||
|
if (is_valid_codeword(*word))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
for (unsigned bit = 0; bit < 32; bit++) {
|
||||||
|
const uint32_t candidate = *word ^ (1UL << bit);
|
||||||
|
if (is_valid_codeword(candidate)) {
|
||||||
|
*word = candidate;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void terminate(char *message, const size_t message_capacity, const size_t length)
|
||||||
|
{
|
||||||
|
message[length < message_capacity ? length : message_capacity - 1U] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool decode_after_address(const uint8_t *input, const size_t input_bits,
|
||||||
|
const size_t address_bit, const bool invert, const uint32_t capcode,
|
||||||
|
const unsigned frame, uint32_t *sender, char *message, const size_t message_capacity)
|
||||||
|
{
|
||||||
|
uint32_t address = read_word(input, address_bit, invert);
|
||||||
|
|
||||||
|
if (address == POCSAG_IDLE_WORD || !correct_codeword(&address) || (address >> 31) != 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
const uint32_t found_capcode = (((address >> 13) & 0x3FFFFUL) << 3) | frame;
|
||||||
|
if (capcode != POCSAG_ANY_RIC && found_capcode != capcode)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (sender != NULL)
|
||||||
|
*sender = found_capcode;
|
||||||
|
|
||||||
|
size_t length = 0;
|
||||||
|
uint32_t payload = 0;
|
||||||
|
unsigned payload_bits = 0;
|
||||||
|
bool found_message = false;
|
||||||
|
|
||||||
|
for (size_t position = address_bit + 32U; position + 32U <= input_bits; position += 32U) {
|
||||||
|
uint32_t codeword = read_word(input, position, invert);
|
||||||
|
|
||||||
|
// Messages may continue across a batch boundary.
|
||||||
|
if (sync_errors(codeword) <= POCSAG_SYNC_MAX_ERRORS)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// Idle or a new address codeword ends the message.
|
||||||
|
if (!correct_codeword(&codeword) || (codeword >> 31) == 0)
|
||||||
|
break;
|
||||||
|
|
||||||
|
found_message = true;
|
||||||
|
payload = (payload << 20) | ((codeword >> 11) & 0xFFFFFUL);
|
||||||
|
payload_bits += 20U;
|
||||||
|
|
||||||
|
while (payload_bits >= 7U) {
|
||||||
|
payload_bits -= 7U;
|
||||||
|
const uint8_t bits = (uint8_t)((payload >> payload_bits) & 0x7FU);
|
||||||
|
payload &= (1UL << payload_bits) - 1U;
|
||||||
|
|
||||||
|
// characters are transmitted LSB first
|
||||||
|
uint8_t character = 0;
|
||||||
|
for (unsigned i = 0; i < 7U; i++)
|
||||||
|
character |= ((bits >> (6U - i)) & 1U) << i;
|
||||||
|
|
||||||
|
if (character == '\0' || character == 0x04U) { // NUL padding or EOT
|
||||||
|
terminate(message, message_capacity, length);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (length + 1U < message_capacity)
|
||||||
|
message[length] = (char)character;
|
||||||
|
length++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
terminate(message, message_capacity, length);
|
||||||
|
return found_message;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool POCSAG_Encode(const uint32_t capcode, const char *message, uint8_t *output,
|
||||||
|
const size_t output_capacity, size_t *output_size)
|
||||||
|
{
|
||||||
|
uint32_t slots[POCSAG_TOTAL_SLOTS];
|
||||||
|
uint32_t message_words[POCSAG_MESSAGE_WORDS];
|
||||||
|
size_t message_length;
|
||||||
|
|
||||||
|
if (output_size != NULL)
|
||||||
|
*output_size = 0;
|
||||||
|
if (message == NULL || output == NULL || capcode > POCSAG_MAX_RIC ||
|
||||||
|
output_capacity < POCSAG_MAX_FRAME_SIZE)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
message_length = strlen(message);
|
||||||
|
if (message_length == 0 || message_length > POCSAG_MAX_MESSAGE_LENGTH)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Pack 7 bit characters LSB first into 20 bit message chunks (zero padded).
|
||||||
|
memset(message_words, 0, sizeof(message_words));
|
||||||
|
for (size_t character = 0; character < message_length; character++) {
|
||||||
|
const uint8_t value = (uint8_t)message[character];
|
||||||
|
if (value < 0x20U || value > 0x7EU)
|
||||||
|
return false;
|
||||||
|
for (unsigned bit = 0; bit < 7U; bit++) {
|
||||||
|
const size_t bit_index = character * 7U + bit;
|
||||||
|
if ((value >> bit) & 1U)
|
||||||
|
message_words[bit_index / 20U] |= 1UL << (19U - (bit_index % 20U));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const size_t message_word_count = (message_length * 7U + 19U) / 20U;
|
||||||
|
|
||||||
|
for (size_t i = 0; i < POCSAG_TOTAL_SLOTS; i++)
|
||||||
|
slots[i] = POCSAG_IDLE_WORD;
|
||||||
|
|
||||||
|
// Address codeword: flag 0, upper 18 bits of the capcode, 2 function bits.
|
||||||
|
// The lower 3 bits of the capcode select the frame (slot pair) within the batch.
|
||||||
|
size_t slot = (capcode & 7U) * 2U;
|
||||||
|
slots[slot++] = make_codeword((((capcode >> 3) & 0x3FFFFUL) << 2) | POCSAG_FUNCTION_ALPHA);
|
||||||
|
for (size_t i = 0; i < message_word_count; i++)
|
||||||
|
slots[slot++] = make_codeword((1UL << 20) | message_words[i]);
|
||||||
|
|
||||||
|
memset(output, 0xAA, POCSAG_PREAMBLE_BYTES);
|
||||||
|
uint8_t *out = output + POCSAG_PREAMBLE_BYTES;
|
||||||
|
for (size_t i = 0; i < POCSAG_TOTAL_SLOTS; i++) {
|
||||||
|
if (i % POCSAG_BATCH_WORDS == 0) {
|
||||||
|
write_word(out, POCSAG_SYNC_WORD);
|
||||||
|
out += 4;
|
||||||
|
}
|
||||||
|
write_word(out, slots[i]);
|
||||||
|
out += 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (output_size != NULL)
|
||||||
|
*output_size = POCSAG_MAX_FRAME_SIZE;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool POCSAG_Decode(const uint8_t *input, const size_t input_size, const uint32_t capcode,
|
||||||
|
uint32_t *sender, char *message, const size_t message_capacity)
|
||||||
|
{
|
||||||
|
const size_t input_bits = input_size * 8U;
|
||||||
|
|
||||||
|
if (input == NULL || message == NULL || message_capacity == 0 ||
|
||||||
|
(capcode > POCSAG_MAX_RIC && capcode != POCSAG_ANY_RIC))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
message[0] = '\0';
|
||||||
|
for (size_t bit = 0; bit + 32U <= input_bits; bit++) {
|
||||||
|
const unsigned errors = sync_errors(read_word(input, bit, false));
|
||||||
|
bool invert;
|
||||||
|
|
||||||
|
if (errors <= POCSAG_SYNC_MAX_ERRORS)
|
||||||
|
invert = false;
|
||||||
|
else if (32U - errors <= POCSAG_SYNC_MAX_ERRORS)
|
||||||
|
invert = true;
|
||||||
|
else
|
||||||
|
continue;
|
||||||
|
|
||||||
|
const size_t first_codeword = bit + 32U;
|
||||||
|
for (size_t slot = 0; slot < POCSAG_BATCH_WORDS; slot++) {
|
||||||
|
const size_t address_bit = first_codeword + slot * 32U;
|
||||||
|
if (address_bit + 32U > input_bits)
|
||||||
|
break;
|
||||||
|
if (decode_after_address(input, input_bits, address_bit, invert, capcode,
|
||||||
|
(unsigned)(slot / 2U), sender, message, message_capacity))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bit += 32U * (POCSAG_BATCH_WORDS + 1U) - 1U; // continue at the next batch
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
#ifndef APP_POCSAG_H
|
||||||
|
#define APP_POCSAG_H
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#define POCSAG_SYNC_WORD 0x7CD215D8UL
|
||||||
|
#define POCSAG_IDLE_WORD 0x7A89C197UL
|
||||||
|
|
||||||
|
#define POCSAG_MAX_RIC 0x1FFFFFUL // 21 bit capcode (2097151)
|
||||||
|
#define POCSAG_ANY_RIC 0xFFFFFFFFUL // POCSAG_Decode(): accept any address
|
||||||
|
// Longest alphanumeric message (TX and RX). Also the stored message length, see
|
||||||
|
// app/messages.h. Up to 45 fits the fixed two-batch TX frame (checked in pocsag.c).
|
||||||
|
#ifndef POCSAG_MAX_MESSAGE_LENGTH
|
||||||
|
#define POCSAG_MAX_MESSAGE_LENGTH 40U
|
||||||
|
#endif
|
||||||
|
#define POCSAG_PREAMBLE_BYTES 72U // 576 bits of 1010..., the minimum the spec allows
|
||||||
|
#define POCSAG_BATCH_WORDS 16U
|
||||||
|
#define POCSAG_BATCH_BYTES (4U + POCSAG_BATCH_WORDS * 4U)
|
||||||
|
#define POCSAG_BATCH_COUNT 2U
|
||||||
|
|
||||||
|
// Every frame produced by POCSAG_Encode() is exactly this long: preamble + two batches.
|
||||||
|
// Two batches always hold the address plus a POCSAG_MAX_MESSAGE_LENGTH message followed
|
||||||
|
// by at least one idle codeword (the address sits in slot <= 14).
|
||||||
|
#define POCSAG_MAX_FRAME_SIZE (POCSAG_PREAMBLE_BYTES + POCSAG_BATCH_COUNT * POCSAG_BATCH_BYTES)
|
||||||
|
|
||||||
|
// Encodes an alphanumeric page for the given 21 bit capcode (RIC).
|
||||||
|
// Output is the logical bit stream (MSB of output[0] is sent first, 1 = logical one).
|
||||||
|
bool POCSAG_Encode(uint32_t capcode, const char *message, uint8_t *output,
|
||||||
|
size_t output_capacity, size_t *output_size);
|
||||||
|
|
||||||
|
// Searches the bit stream for a sync codeword (either polarity) and decodes the first
|
||||||
|
// alphanumeric message addressed to capcode. *sender receives the matched capcode.
|
||||||
|
bool POCSAG_Decode(const uint8_t *input, size_t input_size, uint32_t capcode,
|
||||||
|
uint32_t *sender, char *message, size_t message_capacity);
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -347,9 +347,6 @@ void SCANNER_Start(bool singleFreq)
|
|||||||
gUpdateStatus = true;
|
gUpdateStatus = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
DTMF_clear_RX();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
gScanDelay_10ms = scan_delay_10ms;
|
gScanDelay_10ms = scan_delay_10ms;
|
||||||
gScanCssResultCode = 0xFF;
|
gScanCssResultCode = 0xFF;
|
||||||
|
|||||||
+27
-26
@@ -217,8 +217,10 @@ static void DrawVLine(int sy, int ey, int nx, bool fill) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef ENABLE_FEAT_F4HWN
|
// The spectrum layout is made for the 3x5 font (4 px per character). The shared
|
||||||
static void GUI_DisplaySmallest(const char *pString, uint8_t x, uint8_t y,
|
// GUI_DisplaySmallest() in ui/helper.c draws with gFontSmall (7 px) for the
|
||||||
|
// status bar, which makes the spectrum labels overlap, so it keeps its own.
|
||||||
|
static void SPECTRUM_DisplaySmallest(const char *pString, uint8_t x, uint8_t y,
|
||||||
bool statusbar, bool fill)
|
bool statusbar, bool fill)
|
||||||
{
|
{
|
||||||
uint8_t c;
|
uint8_t c;
|
||||||
@@ -246,7 +248,6 @@ static void GUI_DisplaySmallest(const char *pString, uint8_t x, uint8_t y,
|
|||||||
x += 4;
|
x += 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
// Utility functions
|
// Utility functions
|
||||||
|
|
||||||
@@ -794,7 +795,7 @@ static void DrawStatus() {
|
|||||||
#else
|
#else
|
||||||
sprintf(String, "%d/%d", settings.dbMin, settings.dbMax);
|
sprintf(String, "%d/%d", settings.dbMin, settings.dbMax);
|
||||||
#endif
|
#endif
|
||||||
GUI_DisplaySmallest(String, 0, 1, true, true);
|
SPECTRUM_DisplaySmallest(String, 50, 20, true, true);
|
||||||
|
|
||||||
BOARD_ADC_GetBatteryInfo(&gBatteryVoltages[gBatteryCheckCounter++ % 4],
|
BOARD_ADC_GetBatteryInfo(&gBatteryVoltages[gBatteryCheckCounter++ % 4],
|
||||||
&gBatteryCurrent);
|
&gBatteryCurrent);
|
||||||
@@ -806,7 +807,7 @@ static void DrawStatus() {
|
|||||||
unsigned perc = BATTERY_VoltsToPercent(voltage);
|
unsigned perc = BATTERY_VoltsToPercent(voltage);
|
||||||
|
|
||||||
// sprintf(String, "%d %d", voltage, perc);
|
// sprintf(String, "%d %d", voltage, perc);
|
||||||
// GUI_DisplaySmallest(String, 48, 1, true, true);
|
// SPECTRUM_DisplaySmallest(String, 48, 1, true, true);
|
||||||
|
|
||||||
gStatusLine[116] = 0b00011100;
|
gStatusLine[116] = 0b00011100;
|
||||||
gStatusLine[117] = 0b00111110;
|
gStatusLine[117] = 0b00111110;
|
||||||
@@ -835,7 +836,7 @@ static void ShowChannelName(uint32_t f) {
|
|||||||
SETTINGS_FetchChannelName(String, i);
|
SETTINGS_FetchChannelName(String, i);
|
||||||
if (String[0] != 0) {
|
if (String[0] != 0) {
|
||||||
UI_PrintStringSmallBufferNormal(String, gStatusLine + 36);
|
UI_PrintStringSmallBufferNormal(String, gStatusLine + 36);
|
||||||
//GUI_DisplaySmallest(String, 127, 1, true, true);
|
//SPECTRUM_DisplaySmallest(String, 127, 1, true, true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -856,13 +857,13 @@ static void ShowChannelName(uint32_t f) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void DrawF(uint32_t f) {
|
static void DrawF(uint32_t f) {
|
||||||
sprintf(String, "%u.%05u", f / 100000, f % 100000);
|
sprintf(String, "%lu.%05lu", f / 100000, f % 100000);
|
||||||
UI_PrintStringSmallNormal(String, 8, 127, 0);
|
UI_PrintStringSmallNormal(String, 8, 127, 0);
|
||||||
|
|
||||||
sprintf(String, "%3s", gModulationStr[settings.modulationType]);
|
sprintf(String, "%3s", gModulationStr[settings.modulationType]);
|
||||||
GUI_DisplaySmallest(String, 116, 1, false, true);
|
SPECTRUM_DisplaySmallest(String, 95, 1, false, true);
|
||||||
sprintf(String, "%4sk", bwOptions[settings.listenBw]);
|
sprintf(String, "%4sk", bwOptions[settings.listenBw]);
|
||||||
GUI_DisplaySmallest(String, 108, 7, false, true);
|
SPECTRUM_DisplaySmallest(String, 90, 10, false, true);
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_SPECTRUM
|
#ifdef ENABLE_FEAT_F4HWN_SPECTRUM
|
||||||
ShowChannelName(f);
|
ShowChannelName(f);
|
||||||
@@ -873,26 +874,26 @@ static void DrawNums() {
|
|||||||
|
|
||||||
if (currentState == SPECTRUM) {
|
if (currentState == SPECTRUM) {
|
||||||
sprintf(String, "%ux", GetStepsCount());
|
sprintf(String, "%ux", GetStepsCount());
|
||||||
GUI_DisplaySmallest(String, 0, 1, false, true);
|
SPECTRUM_DisplaySmallest(String, 0, 1, false, true);
|
||||||
sprintf(String, "%u.%02uk", GetScanStep() / 100, GetScanStep() % 100);
|
sprintf(String, "%u.%02uk", GetScanStep() / 100, GetScanStep() % 100);
|
||||||
GUI_DisplaySmallest(String, 0, 7, false, true);
|
SPECTRUM_DisplaySmallest(String, 0, 7, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsCenterMode()) {
|
if (IsCenterMode()) {
|
||||||
sprintf(String, "%u.%05u \x7F%u.%02uk", currentFreq / 100000,
|
sprintf(String, "%lu.%05lu \x7F%lu.%02luk", currentFreq / 100000,
|
||||||
currentFreq % 100000, settings.frequencyChangeStep / 100,
|
currentFreq % 100000, settings.frequencyChangeStep / 100,
|
||||||
settings.frequencyChangeStep % 100);
|
settings.frequencyChangeStep % 100);
|
||||||
GUI_DisplaySmallest(String, 36, 49, false, true);
|
SPECTRUM_DisplaySmallest(String, 36, 39, false, true);
|
||||||
} else {
|
} else {
|
||||||
sprintf(String, "%u.%05u", GetFStart() / 100000, GetFStart() % 100000);
|
sprintf(String, "%lu.%05lu", GetFStart() / 100000, GetFStart() % 100000);
|
||||||
GUI_DisplaySmallest(String, 0, 49, false, true);
|
SPECTRUM_DisplaySmallest(String, 0, 49, false, true);
|
||||||
|
|
||||||
sprintf(String, "\x7F%u.%02uk", settings.frequencyChangeStep / 100,
|
sprintf(String, "\x7F%lu.%02luk", settings.frequencyChangeStep / 100,
|
||||||
settings.frequencyChangeStep % 100);
|
settings.frequencyChangeStep % 100);
|
||||||
GUI_DisplaySmallest(String, 48, 49, false, true);
|
SPECTRUM_DisplaySmallest(String, 48, 10, false, true);
|
||||||
|
|
||||||
sprintf(String, "%u.%05u", GetFEnd() / 100000, GetFEnd() % 100000);
|
sprintf(String, "%lu.%05lu", GetFEnd() / 100000, GetFEnd() % 100000);
|
||||||
GUI_DisplaySmallest(String, 93, 49, false, true);
|
SPECTRUM_DisplaySmallest(String, 93, 49, false, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1139,7 +1140,7 @@ void OnKeyDownStill(KEY_Code_t key) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void RenderFreqInput() { UI_PrintString(freqInputString, 2, 127, 0, 8); }
|
static void RenderFreqInput() { UI_PrintString(freqInputString, 2, 127, 0 /*, 8 */); }
|
||||||
|
|
||||||
static void RenderStatus() {
|
static void RenderStatus() {
|
||||||
memset(gStatusLine, 0, sizeof(gStatusLine));
|
memset(gStatusLine, 0, sizeof(gStatusLine));
|
||||||
@@ -1184,17 +1185,17 @@ static void RenderStill() {
|
|||||||
int dbm = Rssi2DBm(scanInfo.rssi);
|
int dbm = Rssi2DBm(scanInfo.rssi);
|
||||||
uint8_t s = DBm2S(dbm);
|
uint8_t s = DBm2S(dbm);
|
||||||
sprintf(String, "S: %u", s);
|
sprintf(String, "S: %u", s);
|
||||||
GUI_DisplaySmallest(String, 4, 25, false, true);
|
SPECTRUM_DisplaySmallest(String, 4, 25, false, true);
|
||||||
sprintf(String, "%d dBm", dbm);
|
sprintf(String, "%d dBm", dbm);
|
||||||
GUI_DisplaySmallest(String, 28, 25, false, true);
|
SPECTRUM_DisplaySmallest(String, 28, 25, false, true);
|
||||||
|
|
||||||
if (!monitorMode) {
|
if (!monitorMode) {
|
||||||
uint8_t x = Rssi2PX(settings.rssiTriggerLevel, 0, 121);
|
uint8_t x = Rssi2PX(settings.rssiTriggerLevel, 0, 121);
|
||||||
gFrameBuffer[2][METER_PAD_LEFT + x] = 0b11111111;
|
gFrameBuffer[2][METER_PAD_LEFT + x] = 0b11111111;
|
||||||
}
|
}
|
||||||
|
|
||||||
const uint8_t PAD_LEFT = 4;
|
const uint8_t PAD_LEFT = 0;
|
||||||
const uint8_t CELL_WIDTH = 30;
|
const uint8_t CELL_WIDTH = 28;
|
||||||
uint8_t offset = PAD_LEFT;
|
uint8_t offset = PAD_LEFT;
|
||||||
uint8_t row = 4;
|
uint8_t row = 4;
|
||||||
|
|
||||||
@@ -1211,10 +1212,10 @@ static void RenderStill() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
sprintf(String, "%s", registerSpecs[idx].name);
|
sprintf(String, "%s", registerSpecs[idx].name);
|
||||||
GUI_DisplaySmallest(String, offset + 2, row * 8 + 2, false,
|
SPECTRUM_DisplaySmallest(String, offset + 2, row * 8 + 2, false,
|
||||||
menuState != idx);
|
menuState != idx);
|
||||||
sprintf(String, "%u", GetRegMenuValue(idx));
|
sprintf(String, "%u", GetRegMenuValue(idx));
|
||||||
GUI_DisplaySmallest(String, offset + 2, (row + 1) * 8 + 1, false,
|
SPECTRUM_DisplaySmallest(String, offset + 2, (row + 1) * 8 + 1, false,
|
||||||
menuState != idx);
|
menuState != idx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-1
@@ -180,8 +180,9 @@ typedef struct PeakInfo
|
|||||||
uint16_t i;
|
uint16_t i;
|
||||||
} PeakInfo;
|
} PeakInfo;
|
||||||
|
|
||||||
|
#ifdef ENABLE_SPECTRUM
|
||||||
void APP_RunSpectrum(void);
|
void APP_RunSpectrum(void);
|
||||||
|
#endif
|
||||||
#endif /* ifndef SPECTRUM_H */
|
#endif /* ifndef SPECTRUM_H */
|
||||||
|
|
||||||
// vim: ft=c
|
// vim: ft=c
|
||||||
+7
-3
@@ -418,9 +418,6 @@ static void CMD_052F(const uint8_t *pBuffer)
|
|||||||
gEeprom.VfoInfo[0].pTX = &gEeprom.VfoInfo[0].freq_config_TX;
|
gEeprom.VfoInfo[0].pTX = &gEeprom.VfoInfo[0].freq_config_TX;
|
||||||
gEeprom.VfoInfo[0].TX_OFFSET_FREQUENCY_DIRECTION = TX_OFFSET_FREQUENCY_DIRECTION_OFF;
|
gEeprom.VfoInfo[0].TX_OFFSET_FREQUENCY_DIRECTION = TX_OFFSET_FREQUENCY_DIRECTION_OFF;
|
||||||
gEeprom.VfoInfo[0].DTMF_PTT_ID_TX_MODE = PTT_ID_OFF;
|
gEeprom.VfoInfo[0].DTMF_PTT_ID_TX_MODE = PTT_ID_OFF;
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
gEeprom.VfoInfo[0].DTMF_DECODING_ENABLE = false;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_NOAA
|
||||||
gIsNoaaMode = false;
|
gIsNoaaMode = false;
|
||||||
@@ -627,5 +624,12 @@ void UART_HandleCommand(void)
|
|||||||
CMD_0602_WriteBK4819Reg(UART_Command.Buffer);
|
CMD_0602_WriteBK4819Reg(UART_Command.Buffer);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
case 0x06FF:
|
||||||
|
UART_Send("Hello", 6);
|
||||||
|
if (UART_Command.Header.Size <= sizeof(dataPacket)) {
|
||||||
|
UART_Send("there", 6);
|
||||||
|
MSG_FSKSendData((DataPacket *) UART_Command.Data);
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -40,10 +40,7 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep)
|
|||||||
if (Beep != BEEP_880HZ_60MS_DOUBLE_BEEP &&
|
if (Beep != BEEP_880HZ_60MS_DOUBLE_BEEP &&
|
||||||
Beep != BEEP_500HZ_60MS_DOUBLE_BEEP &&
|
Beep != BEEP_500HZ_60MS_DOUBLE_BEEP &&
|
||||||
Beep != BEEP_440HZ_500MS &&
|
Beep != BEEP_440HZ_500MS &&
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
Beep != BEEP_880HZ_200MS &&
|
|
||||||
Beep != BEEP_880HZ_500MS &&
|
|
||||||
#endif
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN
|
#ifdef ENABLE_FEAT_F4HWN
|
||||||
Beep != BEEP_400HZ_30MS &&
|
Beep != BEEP_400HZ_30MS &&
|
||||||
Beep != BEEP_500HZ_30MS &&
|
Beep != BEEP_500HZ_30MS &&
|
||||||
|
|||||||
@@ -29,10 +29,6 @@ enum BEEP_Type_t
|
|||||||
BEEP_1KHZ_60MS_OPTIONAL,
|
BEEP_1KHZ_60MS_OPTIONAL,
|
||||||
BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL,
|
BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL,
|
||||||
BEEP_440HZ_500MS,
|
BEEP_440HZ_500MS,
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
BEEP_880HZ_200MS,
|
|
||||||
BEEP_880HZ_500MS,
|
|
||||||
#endif
|
|
||||||
BEEP_500HZ_60MS_DOUBLE_BEEP,
|
BEEP_500HZ_60MS_DOUBLE_BEEP,
|
||||||
#ifdef ENABLE_FEAT_F4HWN
|
#ifdef ENABLE_FEAT_F4HWN
|
||||||
BEEP_400HZ_30MS,
|
BEEP_400HZ_30MS,
|
||||||
|
|||||||
@@ -44,19 +44,6 @@ const uint8_t gFontKeyLock[9] =
|
|||||||
0x7c, 0x46, 0x45, 0x45, 0x45, 0x45, 0x45, 0x46, 0x7c
|
0x7c, 0x46, 0x45, 0x45, 0x45, 0x45, 0x45, 0x46, 0x7c
|
||||||
};
|
};
|
||||||
|
|
||||||
const uint8_t gFontLight[9] =
|
|
||||||
{
|
|
||||||
0b00001100,
|
|
||||||
0b00010010,
|
|
||||||
0b00100001,
|
|
||||||
0b01101101,
|
|
||||||
0b01111001,
|
|
||||||
0b01101101,
|
|
||||||
0b00100001,
|
|
||||||
0b00010010,
|
|
||||||
0b00001100,
|
|
||||||
};
|
|
||||||
|
|
||||||
const uint8_t gFontMute[12] =
|
const uint8_t gFontMute[12] =
|
||||||
{
|
{
|
||||||
0b00011100,
|
0b00011100,
|
||||||
@@ -166,17 +153,6 @@ const uint8_t BITMAP_Antenna[5] =
|
|||||||
0b00000011
|
0b00000011
|
||||||
};
|
};
|
||||||
|
|
||||||
const uint8_t BITMAP_VFO_Lock[7] =
|
|
||||||
{
|
|
||||||
0b01111100,
|
|
||||||
0b01000110,
|
|
||||||
0b01000101,
|
|
||||||
0b01000101,
|
|
||||||
0b01000101,
|
|
||||||
0b01000110,
|
|
||||||
0b01111100,
|
|
||||||
};
|
|
||||||
|
|
||||||
const uint8_t BITMAP_VFO_Default[7] =
|
const uint8_t BITMAP_VFO_Default[7] =
|
||||||
{
|
{
|
||||||
0b01111111,
|
0b01111111,
|
||||||
@@ -302,16 +278,6 @@ const uint8_t BITMAP_ScanListAll[19] =
|
|||||||
0b01111111
|
0b01111111
|
||||||
};
|
};
|
||||||
|
|
||||||
const uint8_t BITMAP_compand[6] =
|
|
||||||
{
|
|
||||||
0b00000000,
|
|
||||||
0b00111100,
|
|
||||||
0b01000010,
|
|
||||||
0b01000010,
|
|
||||||
0b01000010,
|
|
||||||
0b00100100
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
const uint8_t BITMAP_Ready[7] =
|
const uint8_t BITMAP_Ready[7] =
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ extern const uint8_t gFontF[8];
|
|||||||
extern const uint8_t gFontS[6];
|
extern const uint8_t gFontS[6];
|
||||||
|
|
||||||
extern const uint8_t gFontKeyLock[9];
|
extern const uint8_t gFontKeyLock[9];
|
||||||
extern const uint8_t gFontLight[9];
|
|
||||||
extern const uint8_t gFontMute[12];
|
extern const uint8_t gFontMute[12];
|
||||||
|
|
||||||
extern const uint8_t gFontXB[2][6];
|
extern const uint8_t gFontXB[2][6];
|
||||||
@@ -38,7 +37,6 @@ extern const uint8_t BITMAP_NotReady[7];
|
|||||||
extern const uint8_t BITMAP_Antenna[5];
|
extern const uint8_t BITMAP_Antenna[5];
|
||||||
extern const uint8_t BITMAP_VFO_Default[7];
|
extern const uint8_t BITMAP_VFO_Default[7];
|
||||||
extern const uint8_t BITMAP_VFO_NotDefault[7];
|
extern const uint8_t BITMAP_VFO_NotDefault[7];
|
||||||
extern const uint8_t BITMAP_VFO_Lock[7];
|
|
||||||
extern const uint8_t BITMAP_ScanList0[7];
|
extern const uint8_t BITMAP_ScanList0[7];
|
||||||
extern const uint8_t BITMAP_ScanList1[7];
|
extern const uint8_t BITMAP_ScanList1[7];
|
||||||
extern const uint8_t BITMAP_ScanList2[7];
|
extern const uint8_t BITMAP_ScanList2[7];
|
||||||
@@ -47,8 +45,6 @@ extern const uint8_t BITMAP_ScanList123[19];
|
|||||||
extern const uint8_t BITMAP_ScanListAll[19];
|
extern const uint8_t BITMAP_ScanListAll[19];
|
||||||
extern const uint8_t BITMAP_ScanListE[7];
|
extern const uint8_t BITMAP_ScanListE[7];
|
||||||
extern const uint8_t BITMAP_PowerUser[3];
|
extern const uint8_t BITMAP_PowerUser[3];
|
||||||
extern const uint8_t BITMAP_compand[6];
|
|
||||||
|
|
||||||
extern const uint8_t BITMAP_NOAA[12];
|
extern const uint8_t BITMAP_NOAA[12];
|
||||||
|
|
||||||
#ifndef ENABLE_CUSTOM_MENU_LAYOUT
|
#ifndef ENABLE_CUSTOM_MENU_LAYOUT
|
||||||
|
|||||||
@@ -0,0 +1,803 @@
|
|||||||
|
# Quansheng UV-K5 driver for the BRN-POCSAG firmware
|
||||||
|
#
|
||||||
|
# Based on the UV-K5 egzumer driver
|
||||||
|
# (c) 2023 Jacek Lipkowski <sq5bpf@lipkowski.org>, adapted by EGZUMER, JOC2
|
||||||
|
# and template.py Copyright 2012 Dan Smith <dsmith@danplanet.com>
|
||||||
|
#
|
||||||
|
# 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, see <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
# The EEPROM layout is defined in settings.h / app/messages.h of the
|
||||||
|
# firmware. Keep this file in sync with it:
|
||||||
|
# 0x0000 channels 1..114, 32 bytes each (name and 16 bit scrambler inside)
|
||||||
|
# 0x0E40 settings
|
||||||
|
# 0x0F50 channel attributes [207]
|
||||||
|
# 0x1020 VFOs (7 bands x A/B), 32 bytes each
|
||||||
|
# 0x11E0 channels 115..171
|
||||||
|
# 0x1900 message counters, 0x1908 26 messages x 48 bytes
|
||||||
|
# 0x1E00 calibration (only written with "upload calibration")
|
||||||
|
# 0x1FF0 F4HWN settings (written after every upload)
|
||||||
|
|
||||||
|
import logging
|
||||||
|
|
||||||
|
from chirp import chirp_common, directory, bitwise
|
||||||
|
from chirp.drivers import uvk5
|
||||||
|
from chirp.settings import RadioSetting, RadioSettingGroup, \
|
||||||
|
RadioSettingValueBoolean, RadioSettingValueList, \
|
||||||
|
RadioSettingValueInteger, RadioSettingValueString, \
|
||||||
|
RadioSettings
|
||||||
|
|
||||||
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
CHANNELS = 171
|
||||||
|
CHANNELS_A = 114 # channels in the first area (0x0000 .. 0x0E3F)
|
||||||
|
MESSAGES = 26
|
||||||
|
MESSAGE_TEXT = 40
|
||||||
|
SETTINGS_F4HWN = 0x1FF0 # 16 bytes, inside the calibration area
|
||||||
|
|
||||||
|
MEM_FORMAT = """
|
||||||
|
struct chan {
|
||||||
|
ul32 freq;
|
||||||
|
ul32 offset;
|
||||||
|
u8 rxcode;
|
||||||
|
u8 txcode;
|
||||||
|
u8 txcodeflag:4,
|
||||||
|
rxcodeflag:4;
|
||||||
|
u8 modulation:4,
|
||||||
|
shift:4;
|
||||||
|
u8 __unused1:1,
|
||||||
|
bclo:1,
|
||||||
|
txpower:3,
|
||||||
|
bandwidth:2,
|
||||||
|
freq_reverse:1;
|
||||||
|
u8 __unused2:4,
|
||||||
|
dtmf_pttid:3,
|
||||||
|
__unused3:1;
|
||||||
|
u8 step;
|
||||||
|
u8 __unused4;
|
||||||
|
char name[10];
|
||||||
|
ul16 scrambler;
|
||||||
|
u8 __unused5[4];
|
||||||
|
};
|
||||||
|
|
||||||
|
#seekto 0x0000;
|
||||||
|
struct chan channel_a[114];
|
||||||
|
|
||||||
|
#seekto 0x0E40;
|
||||||
|
ul16 fmfreq[20];
|
||||||
|
|
||||||
|
#seekto 0x0E70;
|
||||||
|
u8 call_channel;
|
||||||
|
u8 squelch;
|
||||||
|
u8 max_talk_time;
|
||||||
|
u8 noaa_autoscan;
|
||||||
|
u8 key_lock;
|
||||||
|
u8 vox_switch;
|
||||||
|
u8 vox_level;
|
||||||
|
u8 mic_gain;
|
||||||
|
u8 backlight_min:4,
|
||||||
|
backlight_max:4;
|
||||||
|
u8 channel_display_mode;
|
||||||
|
u8 crossband;
|
||||||
|
u8 battery_save;
|
||||||
|
u8 dual_watch;
|
||||||
|
u8 backlight_time;
|
||||||
|
u8 ste;
|
||||||
|
u8 __unused6:1,
|
||||||
|
current_list:3,
|
||||||
|
current_state:3,
|
||||||
|
vfo_open:1;
|
||||||
|
|
||||||
|
#seekto 0x0E80;
|
||||||
|
u8 ScreenChannel_A;
|
||||||
|
u8 MrChannel_A;
|
||||||
|
u8 FreqChannel_A;
|
||||||
|
u8 ScreenChannel_B;
|
||||||
|
u8 MrChannel_B;
|
||||||
|
u8 FreqChannel_B;
|
||||||
|
u8 NoaaChannel_A;
|
||||||
|
u8 NoaaChannel_B;
|
||||||
|
|
||||||
|
ul16 fm_selfreq;
|
||||||
|
u8 fm_selchn;
|
||||||
|
u8 __unused7:5,
|
||||||
|
fm_band:2,
|
||||||
|
fm_ismrmode:1;
|
||||||
|
|
||||||
|
#seekto 0x0E90;
|
||||||
|
u8 keyM_longpress_action:7,
|
||||||
|
button_beep:1;
|
||||||
|
u8 key1_shortpress_action;
|
||||||
|
u8 key1_longpress_action;
|
||||||
|
u8 key2_shortpress_action;
|
||||||
|
u8 key2_longpress_action;
|
||||||
|
u8 scan_resume_mode;
|
||||||
|
u8 auto_keypad_lock;
|
||||||
|
u8 fsk_mode;
|
||||||
|
|
||||||
|
#seekto 0x0EA8;
|
||||||
|
u8 alarm_mode;
|
||||||
|
u8 roger_beep;
|
||||||
|
u8 rp_ste;
|
||||||
|
u8 TX_VFO;
|
||||||
|
u8 battery_type;
|
||||||
|
|
||||||
|
#seekto 0x0ED0;
|
||||||
|
u8 dtmf_side_tone;
|
||||||
|
u8 __unused8[4];
|
||||||
|
u8 dtmf_preload_time;
|
||||||
|
|
||||||
|
#seekto 0x0EF8;
|
||||||
|
char dtmf_up_code[16];
|
||||||
|
char dtmf_down_code[16];
|
||||||
|
|
||||||
|
#seekto 0x0F18;
|
||||||
|
u8 slDef;
|
||||||
|
u8 sl_enabled;
|
||||||
|
u8 sl1PriorCh1;
|
||||||
|
u8 sl1PriorCh2;
|
||||||
|
u8 sl2PriorCh1;
|
||||||
|
u8 sl2PriorCh2;
|
||||||
|
u8 sl3PriorCh1;
|
||||||
|
u8 sl3PriorCh2;
|
||||||
|
|
||||||
|
ul32 fsk_src;
|
||||||
|
u8 __unused9:3,
|
||||||
|
fm_deemphasis:2,
|
||||||
|
fm_blend:2,
|
||||||
|
fm_agc:1;
|
||||||
|
u8 pocsag_monitor;
|
||||||
|
|
||||||
|
#seekto 0x0F40;
|
||||||
|
u8 int_flock;
|
||||||
|
u8 __unused10[6];
|
||||||
|
u8 backlight_on_TX_RX:2,
|
||||||
|
__unused11:1,
|
||||||
|
mic_bar:1,
|
||||||
|
battery_text:2,
|
||||||
|
live_DTMF_decoder:1,
|
||||||
|
__unused12:1;
|
||||||
|
|
||||||
|
#seekto 0x0F50;
|
||||||
|
struct {
|
||||||
|
u8 scanlist3:1,
|
||||||
|
scanlist2:1,
|
||||||
|
scanlist1:1,
|
||||||
|
compander:2,
|
||||||
|
band:3;
|
||||||
|
} channel_attributes[207];
|
||||||
|
|
||||||
|
#seekto 0x1020;
|
||||||
|
struct chan vfo[14];
|
||||||
|
|
||||||
|
#seekto 0x11E0;
|
||||||
|
struct chan channel_b[57];
|
||||||
|
|
||||||
|
#seekto 0x1900;
|
||||||
|
u8 msg_seq;
|
||||||
|
u8 msg_latest;
|
||||||
|
u8 __unused13[6];
|
||||||
|
struct {
|
||||||
|
ul32 src;
|
||||||
|
u8 seq;
|
||||||
|
u8 ttl;
|
||||||
|
u8 flags;
|
||||||
|
char text[41];
|
||||||
|
} message[26];
|
||||||
|
|
||||||
|
#seekto 0x1F8E;
|
||||||
|
u8 volume_gain;
|
||||||
|
|
||||||
|
#seekto 0x1FF4;
|
||||||
|
u8 set_off:7,
|
||||||
|
set_tmr:1;
|
||||||
|
u8 __unused14:3,
|
||||||
|
set_inv:1,
|
||||||
|
__unused15:4;
|
||||||
|
u8 __unused16;
|
||||||
|
u8 __unused17:4,
|
||||||
|
set_ptt:4;
|
||||||
|
"""
|
||||||
|
|
||||||
|
POWER_LEVELS = [chirp_common.PowerLevel("Low1", watts=0.02),
|
||||||
|
chirp_common.PowerLevel("Low2", watts=0.125),
|
||||||
|
chirp_common.PowerLevel("Low3", watts=0.25),
|
||||||
|
chirp_common.PowerLevel("Low4", watts=0.5),
|
||||||
|
chirp_common.PowerLevel("Low5", watts=1.0),
|
||||||
|
chirp_common.PowerLevel("Mid", watts=2.0),
|
||||||
|
chirp_common.PowerLevel("High", watts=5.0)]
|
||||||
|
|
||||||
|
STEPS = [2.5, 5, 6.25, 10, 12.5, 25, 8.33, 0.01, 0.05, 0.1, 0.25, 0.5, 1,
|
||||||
|
1.25, 9, 15, 20, 30, 50, 100, 125, 200, 250, 500]
|
||||||
|
|
||||||
|
# frequencyBandTable with ENABLE_WIDE_RX, lower edges in Hz
|
||||||
|
BAND_LOWER = [18000000, 108000000, 137000000, 174000000, 350000000,
|
||||||
|
400000000, 470000000]
|
||||||
|
BAND_UPPER = 1300000000
|
||||||
|
BAND_NAMES = ["18M-108M", "108M-137M", "137M-174M", "174M-350M",
|
||||||
|
"350M-400M", "400M-470M", "470M-1300M"]
|
||||||
|
|
||||||
|
DEMODULATIONS = ["FM", "AM", "USB", "BYP", "RAW", "ALM", "BEE", "CTC",
|
||||||
|
"FSA", "UN4", "UN5", "UN6", "UN7", "UN8", "UN9"]
|
||||||
|
BANDWIDTHS = ["Wide", "Narrow", "Narrower", "FSKQ (FSK width)"]
|
||||||
|
COMPANDER_LIST = ["Off", "TX", "RX", "TX/RX"]
|
||||||
|
PTTID_LIST = ["Off", "Up code", "Down code", "Up+Down code",
|
||||||
|
"Apollo Quindar"]
|
||||||
|
|
||||||
|
FSK_MODES = ["FSK 450", "FSK 700", "FSK 1200", "FSK 2400", "AFSK 1200",
|
||||||
|
"AFSK 2400", "NOAA SAME", "POCSAG 1200", "POCSAG 512",
|
||||||
|
"POCSAG 2400"]
|
||||||
|
POCSAG_MODES = (7, 8, 9)
|
||||||
|
POCSAG_MAX_RIC = 2097151
|
||||||
|
POCSAG_MONITOR_ON = 0x5A
|
||||||
|
MESSAGE_FLAG_POCSAG = 0x20
|
||||||
|
|
||||||
|
# ACTION_OPT_* values of the actions this build offers
|
||||||
|
KEY_ACTIONS = [("None", 0), ("Flashlight", 1), ("TX power", 2),
|
||||||
|
("Monitor", 3), ("Scan", 4), ("FM radio", 7),
|
||||||
|
("Keypad lock", 9), ("Switch VFO A/B", 10),
|
||||||
|
("VFO / memory", 11), ("Switch demodulation", 12),
|
||||||
|
("RX mode", 14), ("PTT mode", 15), ("Wide / narrow", 16),
|
||||||
|
("Mute", 18)]
|
||||||
|
|
||||||
|
RXMODE_LIST = ["Main only", "Dual RX, respond", "Crossband",
|
||||||
|
"Dual RX, TX on main"]
|
||||||
|
CHANNELDISP_LIST = ["Frequency", "Channel number", "Name", "Name + Frequency"]
|
||||||
|
BATSAVE_LIST = ["Off", "1:1", "1:2", "1:3", "1:4", "1:5"]
|
||||||
|
BATTYPE_LIST = ["1600 mAh", "2200 mAh", "3500 mAh"]
|
||||||
|
BAT_TXT_LIST = ["None", "Voltage", "Percentage"]
|
||||||
|
BACKLIGHT_TX_RX_LIST = ["Off", "TX", "RX", "TX/RX"]
|
||||||
|
ROGER_LIST = ["Off", "Roger beep", "MDC data burst"]
|
||||||
|
RP_STE_LIST = ["Off"] + ["%d ms" % (i * 100) for i in range(1, 11)]
|
||||||
|
FLOCK_LIST = ["Default (137-174, 400-470)", "Disable all TX",
|
||||||
|
"Unlock all TX"]
|
||||||
|
SLIST_LIST = ["No list", "List 1", "List 2", "List 3", "Lists 1+2+3", "All"]
|
||||||
|
MIC_GAIN_LIST = ["+1.1dB", "+4.0dB", "+8.0dB", "+12.0dB", "+15.1dB"]
|
||||||
|
SET_PTT_LIST = ["Hold", "Toggle"]
|
||||||
|
FM_BANDS = ["76-108 MHz", "65-76 MHz", "76-90 MHz", "64-76 MHz"]
|
||||||
|
FM_BLEND = ["0", "1", "2", "3"]
|
||||||
|
FM_DEEMPHASIS = ["0", "1", "2", "3"]
|
||||||
|
DTMF_CHARS = "0123456789ABCDabcd#* "
|
||||||
|
|
||||||
|
|
||||||
|
def _minsec(seconds):
|
||||||
|
return "%d:%02d" % (seconds // 60, seconds % 60)
|
||||||
|
|
||||||
|
|
||||||
|
# menu value <-> text, same formulas as the firmware menu
|
||||||
|
TOT_VALUES = list(range(5, 180))
|
||||||
|
TOT_LIST = [_minsec((v + 1) * 5) for v in TOT_VALUES]
|
||||||
|
KEYLOCK_LIST = ["Off"] + [_minsec(v * 15) for v in range(1, 41)]
|
||||||
|
BACKLIGHT_LIST = ["Off"] + [_minsec(v * 5) for v in range(1, 61)] + ["On"]
|
||||||
|
SCANREV_LIST = (["Stop"] +
|
||||||
|
["Carrier %d.%02ds" % (v * 250 // 1000, v * 250 % 1000 // 10)
|
||||||
|
for v in range(1, 81)] +
|
||||||
|
["Timeout " + _minsec((v - 80) * 5) for v in range(81, 105)])
|
||||||
|
SET_OFF_LIST = ["Off"] + ["%dh:%02dm" % (v // 60, v % 60)
|
||||||
|
for v in range(1, 121)]
|
||||||
|
|
||||||
|
|
||||||
|
def scr_to_hz(raw):
|
||||||
|
"""BK4819 scrambler register value -> Hz (inverse_scale_freq)"""
|
||||||
|
return 0 if raw in (0, 0xFFFF) else ((raw << 17) - (1 << 16)) // 1353245
|
||||||
|
|
||||||
|
|
||||||
|
def hz_to_scr(hz):
|
||||||
|
"""Hz -> BK4819 scrambler register value (scale_freq)"""
|
||||||
|
return 0 if hz <= 0 else min(0xFFFF, (hz * 1353245 + (1 << 16)) >> 17)
|
||||||
|
|
||||||
|
|
||||||
|
def find_band(hz):
|
||||||
|
"""FREQUENCY_GetBand(): highest band whose lower edge is <= hz"""
|
||||||
|
for band in range(len(BAND_LOWER) - 1, -1, -1):
|
||||||
|
if hz >= BAND_LOWER[band]:
|
||||||
|
return band
|
||||||
|
return 0
|
||||||
|
|
||||||
|
|
||||||
|
def list_index(value, lst, default=0):
|
||||||
|
return value if 0 <= value < len(lst) else default
|
||||||
|
|
||||||
|
|
||||||
|
@directory.register
|
||||||
|
@directory.detected_by(uvk5.UVK5Radio)
|
||||||
|
class UVK5RadioBrnPocsag(uvk5.UVK5RadioBase):
|
||||||
|
"""Quansheng UV-K5 (BRN-POCSAG)"""
|
||||||
|
VENDOR = "Quansheng"
|
||||||
|
MODEL = "UV-K5"
|
||||||
|
VARIANT = "BRN-POCSAG"
|
||||||
|
BAUD_RATE = 38400
|
||||||
|
NEEDS_COMPAT_SERIAL = False
|
||||||
|
_cal_start = 0x1E00
|
||||||
|
prog_size = 0x1E00 # channels, settings and the message store
|
||||||
|
_steps = STEPS
|
||||||
|
_pttid_list = PTTID_LIST
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def k5_approve_firmware(cls, firmware):
|
||||||
|
return firmware.startswith("BRN-POCSAG")
|
||||||
|
|
||||||
|
# ---------------------------------------------------------- upload
|
||||||
|
|
||||||
|
def _write_mem_block(self, serport, data, offset):
|
||||||
|
result = super()._write_mem_block(serport, data, offset)
|
||||||
|
# The F4HWN settings live in the calibration area, which a normal
|
||||||
|
# upload skips. Write that one block (no calibration in it) last.
|
||||||
|
if not self._upload_calibration and \
|
||||||
|
offset + len(data) >= self.prog_size:
|
||||||
|
block = self.get_mmap()[SETTINGS_F4HWN:SETTINGS_F4HWN + 16]
|
||||||
|
super()._write_mem_block(serport, block, SETTINGS_F4HWN)
|
||||||
|
return result
|
||||||
|
|
||||||
|
# ---------------------------------------------------------- memories
|
||||||
|
|
||||||
|
def _vfo_names(self):
|
||||||
|
names = []
|
||||||
|
for band, name in enumerate(BAND_NAMES):
|
||||||
|
names.append("F%d(%s)A" % (band + 1, name))
|
||||||
|
names.append("F%d(%s)B" % (band + 1, name))
|
||||||
|
return names
|
||||||
|
|
||||||
|
def get_features(self):
|
||||||
|
rf = super().get_features()
|
||||||
|
rf.memory_bounds = (1, CHANNELS)
|
||||||
|
rf.valid_special_chans = self._vfo_names()
|
||||||
|
rf.valid_modes = ["FM", "NFM", "AM", "NAM", "USB"]
|
||||||
|
rf.valid_power_levels = POWER_LEVELS
|
||||||
|
rf.valid_tuning_steps = list(STEPS)
|
||||||
|
rf.valid_bands = [(BAND_LOWER[0], BAND_UPPER)]
|
||||||
|
rf.valid_name_length = 10
|
||||||
|
return rf
|
||||||
|
|
||||||
|
def process_mmap(self):
|
||||||
|
self._check_firmware_at_load()
|
||||||
|
self._memobj = bitwise.parse(MEM_FORMAT, self._mmap)
|
||||||
|
|
||||||
|
def _find_band(self, hz):
|
||||||
|
return find_band(hz) if BAND_LOWER[0] <= hz <= BAND_UPPER else False
|
||||||
|
|
||||||
|
def _slot(self, number):
|
||||||
|
"""number (1-based, or a VFO name) -> (record, attributes or None,
|
||||||
|
is_vfo, chirp number)"""
|
||||||
|
names = self._vfo_names()
|
||||||
|
if isinstance(number, str):
|
||||||
|
idx = names.index(number)
|
||||||
|
return self._memobj.vfo[idx], None, True, CHANNELS + 1 + idx
|
||||||
|
if number > CHANNELS:
|
||||||
|
idx = number - CHANNELS - 1
|
||||||
|
return self._memobj.vfo[idx], None, True, number
|
||||||
|
index = number - 1
|
||||||
|
if index < CHANNELS_A:
|
||||||
|
rec = self._memobj.channel_a[index]
|
||||||
|
else:
|
||||||
|
rec = self._memobj.channel_b[index - CHANNELS_A]
|
||||||
|
return rec, self._memobj.channel_attributes[index], False, number
|
||||||
|
|
||||||
|
def get_raw_memory(self, number):
|
||||||
|
rec, attr, _, _ = self._slot(number)
|
||||||
|
return repr(rec) + ("\n" + repr(attr) if attr is not None else "")
|
||||||
|
|
||||||
|
def get_memory(self, number):
|
||||||
|
_mem, _attr, is_vfo, chirp_number = self._slot(number)
|
||||||
|
mem = chirp_common.Memory()
|
||||||
|
mem.number = chirp_number
|
||||||
|
if isinstance(number, str):
|
||||||
|
mem.extd_number = number
|
||||||
|
elif is_vfo:
|
||||||
|
mem.extd_number = self._vfo_names()[chirp_number - CHANNELS - 1]
|
||||||
|
|
||||||
|
raw = _mem.get_raw()
|
||||||
|
mem.empty = (int(_mem.freq) in (0, 0xFFFFFFFF) or
|
||||||
|
(_attr is not None and _attr.get_raw()[0] == 0xFF))
|
||||||
|
|
||||||
|
mem.extra = RadioSettingGroup("Extra", "extra")
|
||||||
|
valid = not mem.empty
|
||||||
|
bw = int(_mem.bandwidth) if valid else 0
|
||||||
|
demod = int(_mem.modulation) if valid else 0
|
||||||
|
mem.extra.append(RadioSetting(
|
||||||
|
"bandwidth", "Bandwidth",
|
||||||
|
RadioSettingValueList(BANDWIDTHS, current_index=bw)))
|
||||||
|
mem.extra.append(RadioSetting(
|
||||||
|
"demod", "Demodulation",
|
||||||
|
RadioSettingValueList(DEMODULATIONS,
|
||||||
|
current_index=list_index(demod,
|
||||||
|
DEMODULATIONS))))
|
||||||
|
mem.extra.append(RadioSetting(
|
||||||
|
"bclo", "Busy channel lockout",
|
||||||
|
RadioSettingValueBoolean(valid and bool(_mem.bclo))))
|
||||||
|
mem.extra.append(RadioSetting(
|
||||||
|
"frev", "Frequency reverse",
|
||||||
|
RadioSettingValueBoolean(valid and bool(_mem.freq_reverse))))
|
||||||
|
mem.extra.append(RadioSetting(
|
||||||
|
"pttid", "PTT ID", RadioSettingValueList(
|
||||||
|
PTTID_LIST, current_index=list_index(
|
||||||
|
int(_mem.dtmf_pttid) if valid else 0, PTTID_LIST))))
|
||||||
|
mem.extra.append(RadioSetting(
|
||||||
|
"scrambler", "Scrambler (Hz, 0 = off)",
|
||||||
|
RadioSettingValueInteger(0, scr_to_hz(0xFFFE),
|
||||||
|
scr_to_hz(int(_mem.scrambler))
|
||||||
|
if valid else 0)))
|
||||||
|
if _attr is not None:
|
||||||
|
mem.extra.append(RadioSetting(
|
||||||
|
"compander", "Compander", RadioSettingValueList(
|
||||||
|
COMPANDER_LIST, current_index=int(_attr.compander)
|
||||||
|
if valid else 0)))
|
||||||
|
for n in (1, 2, 3):
|
||||||
|
on = valid and bool(getattr(_attr, "scanlist%d" % n))
|
||||||
|
mem.extra.append(RadioSetting(
|
||||||
|
"scanlist%d" % n, "Scan list %d" % n,
|
||||||
|
RadioSettingValueBoolean(on)))
|
||||||
|
|
||||||
|
if mem.empty:
|
||||||
|
return mem
|
||||||
|
|
||||||
|
if is_vfo:
|
||||||
|
mem.immutable = ["name"]
|
||||||
|
else:
|
||||||
|
mem.name = self._decode_name(bytes(raw[16:26]))
|
||||||
|
|
||||||
|
mem.freq = int(_mem.freq) * 10
|
||||||
|
mem.offset = int(_mem.offset) * 10
|
||||||
|
if mem.offset == 0:
|
||||||
|
mem.duplex = ""
|
||||||
|
elif _mem.shift == uvk5.FLAGS1_OFFSET_MINUS:
|
||||||
|
if _mem.freq == _mem.offset:
|
||||||
|
mem.duplex, mem.offset = "off", 0 # TX disabled
|
||||||
|
else:
|
||||||
|
mem.duplex = "-"
|
||||||
|
elif _mem.shift == uvk5.FLAGS1_OFFSET_PLUS:
|
||||||
|
mem.duplex = "+"
|
||||||
|
else:
|
||||||
|
mem.duplex = ""
|
||||||
|
|
||||||
|
self._get_tone(mem, _mem)
|
||||||
|
|
||||||
|
if demod == 1:
|
||||||
|
mem.mode = "NAM" if bw else "AM"
|
||||||
|
elif demod == 2:
|
||||||
|
mem.mode = "USB"
|
||||||
|
else:
|
||||||
|
mem.mode = "NFM" if bw else "FM"
|
||||||
|
|
||||||
|
mem.tuning_step = STEPS[_mem.step] if _mem.step < len(STEPS) else 2.5
|
||||||
|
mem.power = POWER_LEVELS[min(int(_mem.txpower), len(POWER_LEVELS) - 1)]
|
||||||
|
return mem
|
||||||
|
|
||||||
|
def set_memory(self, mem):
|
||||||
|
_mem, _attr, is_vfo, _ = self._slot(
|
||||||
|
mem.extd_number if mem.extd_number else mem.number)
|
||||||
|
|
||||||
|
if mem.empty:
|
||||||
|
_mem.set_raw(b"\xFF" * 32)
|
||||||
|
if _attr is not None:
|
||||||
|
_attr.set_raw(b"\xFF")
|
||||||
|
return mem
|
||||||
|
|
||||||
|
raw = bytearray(_mem.get_raw())
|
||||||
|
if raw[0] == 0xFF:
|
||||||
|
raw = bytearray(32) # was empty
|
||||||
|
else:
|
||||||
|
raw[0:16] = bytes(16) # rebuilt below; name / scrambler kept
|
||||||
|
_mem.set_raw(bytes(raw))
|
||||||
|
|
||||||
|
_mem.freq = mem.freq // 10
|
||||||
|
_mem.offset = mem.offset // 10
|
||||||
|
if mem.duplex == "":
|
||||||
|
_mem.offset = 0
|
||||||
|
_mem.shift = 0
|
||||||
|
elif mem.duplex == "-":
|
||||||
|
_mem.shift = uvk5.FLAGS1_OFFSET_MINUS
|
||||||
|
elif mem.duplex == "+":
|
||||||
|
_mem.shift = uvk5.FLAGS1_OFFSET_PLUS
|
||||||
|
elif mem.duplex == "off":
|
||||||
|
_mem.shift = uvk5.FLAGS1_OFFSET_MINUS # TX disabled
|
||||||
|
_mem.offset = _mem.freq
|
||||||
|
|
||||||
|
demod = {"AM": 1, "NAM": 1, "USB": 2}.get(mem.mode, 0)
|
||||||
|
bw = 1 if mem.mode in ("NFM", "NAM", "USB") else 0
|
||||||
|
self._set_tone(mem, _mem)
|
||||||
|
_mem.step = STEPS.index(mem.tuning_step) \
|
||||||
|
if mem.tuning_step in STEPS else 0
|
||||||
|
_mem.txpower = POWER_LEVELS.index(mem.power) \
|
||||||
|
if mem.power in POWER_LEVELS else 0
|
||||||
|
|
||||||
|
scanlists = [False, False, False]
|
||||||
|
compander = 0
|
||||||
|
for setting in mem.extra:
|
||||||
|
name = setting.get_name()
|
||||||
|
value = setting.value.get_value()
|
||||||
|
if name == "bandwidth" and BANDWIDTHS.index(value) >= 2:
|
||||||
|
bw = BANDWIDTHS.index(value) # narrower / FSKQ
|
||||||
|
elif name == "demod" and DEMODULATIONS.index(value) >= 3:
|
||||||
|
demod = DEMODULATIONS.index(value) # experimental modes
|
||||||
|
elif name == "bclo":
|
||||||
|
_mem.bclo = 1 if value else 0
|
||||||
|
elif name == "frev":
|
||||||
|
_mem.freq_reverse = 1 if value else 0
|
||||||
|
elif name == "pttid":
|
||||||
|
_mem.dtmf_pttid = PTTID_LIST.index(value)
|
||||||
|
elif name == "scrambler":
|
||||||
|
hz = int(value)
|
||||||
|
if hz != scr_to_hz(int(_mem.scrambler)):
|
||||||
|
_mem.scrambler = hz_to_scr(hz)
|
||||||
|
elif name == "compander":
|
||||||
|
compander = COMPANDER_LIST.index(value)
|
||||||
|
elif name.startswith("scanlist"):
|
||||||
|
scanlists[int(name[-1]) - 1] = bool(value)
|
||||||
|
_mem.modulation = demod
|
||||||
|
_mem.bandwidth = bw
|
||||||
|
|
||||||
|
if not is_vfo:
|
||||||
|
name = mem.name.encode("latin-1", "replace")[:10]
|
||||||
|
raw = bytearray(_mem.get_raw())
|
||||||
|
raw[16:26] = name.ljust(10, b"\x00")
|
||||||
|
_mem.set_raw(bytes(raw))
|
||||||
|
_attr.band = find_band(mem.freq)
|
||||||
|
_attr.compander = compander
|
||||||
|
_attr.scanlist1, _attr.scanlist2, _attr.scanlist3 = scanlists
|
||||||
|
return mem
|
||||||
|
|
||||||
|
# ---------------------------------------------------------- settings
|
||||||
|
|
||||||
|
def _messages(self):
|
||||||
|
"""message slots, newest first"""
|
||||||
|
latest = int(self._memobj.msg_latest)
|
||||||
|
if latest >= MESSAGES:
|
||||||
|
latest = MESSAGES - 1
|
||||||
|
return [(latest - k) % MESSAGES for k in range(MESSAGES)]
|
||||||
|
|
||||||
|
def get_settings(self):
|
||||||
|
_mem = self._memobj
|
||||||
|
top = RadioSettings()
|
||||||
|
|
||||||
|
def group(name, label):
|
||||||
|
grp = RadioSettingGroup(name, label)
|
||||||
|
top.append(grp)
|
||||||
|
return grp
|
||||||
|
|
||||||
|
def add(grp, name, label, value):
|
||||||
|
grp.append(RadioSetting(name, label, value))
|
||||||
|
|
||||||
|
def lst(options, index):
|
||||||
|
return RadioSettingValueList(
|
||||||
|
options, current_index=list_index(int(index), options))
|
||||||
|
|
||||||
|
def boolean(value):
|
||||||
|
return RadioSettingValueBoolean(bool(value))
|
||||||
|
|
||||||
|
actions = [a[0] for a in KEY_ACTIONS]
|
||||||
|
|
||||||
|
def action(value):
|
||||||
|
values = [a[1] for a in KEY_ACTIONS]
|
||||||
|
index = values.index(int(value)) if int(value) in values else 0
|
||||||
|
return RadioSettingValueList(actions, current_index=index)
|
||||||
|
|
||||||
|
basic = group("basic", "Basic settings")
|
||||||
|
add(basic, "squelch", "Squelch (Sql)",
|
||||||
|
RadioSettingValueInteger(0, 9, min(int(_mem.squelch), 9)))
|
||||||
|
tot = int(_mem.max_talk_time)
|
||||||
|
add(basic, "tot", "TX timeout (TXTime)", RadioSettingValueList(
|
||||||
|
TOT_LIST, current_index=TOT_VALUES.index(tot)
|
||||||
|
if tot in TOT_VALUES else TOT_VALUES.index(11)))
|
||||||
|
add(basic, "mic_gain", "Mic gain (Mic)", lst(MIC_GAIN_LIST,
|
||||||
|
_mem.mic_gain))
|
||||||
|
rxmode = (bool(_mem.crossband) << 1) | bool(_mem.dual_watch)
|
||||||
|
add(basic, "rx_mode", "RX mode (RxMode)", lst(RXMODE_LIST, rxmode))
|
||||||
|
add(basic, "TX_VFO", "Main VFO", lst(["A", "B"], _mem.TX_VFO))
|
||||||
|
add(basic, "battery_save", "Battery save (BatSav)",
|
||||||
|
lst(BATSAVE_LIST, _mem.battery_save))
|
||||||
|
add(basic, "roger_beep", "Roger", lst(ROGER_LIST, _mem.roger_beep))
|
||||||
|
add(basic, "ste", "Squelch tail elimination (STE)", boolean(_mem.ste))
|
||||||
|
add(basic, "rp_ste", "Repeater STE (RP STE)",
|
||||||
|
lst(RP_STE_LIST, _mem.rp_ste))
|
||||||
|
add(basic, "button_beep", "Key beep (Beep)", boolean(_mem.button_beep))
|
||||||
|
call = int(_mem.call_channel)
|
||||||
|
add(basic, "call_channel", "1 Call channel",
|
||||||
|
RadioSettingValueInteger(1, CHANNELS,
|
||||||
|
call + 1 if call < CHANNELS else 1))
|
||||||
|
add(basic, "int_flock", "TX band lock (F Lock)",
|
||||||
|
lst(FLOCK_LIST, _mem.int_flock))
|
||||||
|
|
||||||
|
disp = group("display", "Display")
|
||||||
|
add(disp, "channel_display_mode", "Channel display (ChDisp)",
|
||||||
|
lst(CHANNELDISP_LIST, _mem.channel_display_mode))
|
||||||
|
add(disp, "backlight_time", "Backlight time (BLTime)",
|
||||||
|
lst(BACKLIGHT_LIST, _mem.backlight_time))
|
||||||
|
add(disp, "backlight_min", "Backlight min (BLMin)",
|
||||||
|
RadioSettingValueInteger(0, 9, min(int(_mem.backlight_min), 9)))
|
||||||
|
add(disp, "backlight_max", "Backlight max (BLMax)",
|
||||||
|
RadioSettingValueInteger(1, 10, max(1, min(
|
||||||
|
int(_mem.backlight_max), 10))))
|
||||||
|
add(disp, "backlight_on_TX_RX", "Backlight on TX/RX (BLTxRx)",
|
||||||
|
lst(BACKLIGHT_TX_RX_LIST, _mem.backlight_on_TX_RX))
|
||||||
|
add(disp, "battery_text", "Battery text (BatTxt)",
|
||||||
|
lst(BAT_TXT_LIST, _mem.battery_text))
|
||||||
|
add(disp, "mic_bar", "Mic bar (MicBar)", boolean(_mem.mic_bar))
|
||||||
|
add(disp, "set_inv", "Inverted display (SInv)", boolean(_mem.set_inv))
|
||||||
|
add(disp, "set_tmr", "RX/TX timer (STmr)", boolean(_mem.set_tmr))
|
||||||
|
|
||||||
|
keys = group("keys", "Keys")
|
||||||
|
add(keys, "key1_shortpress_action", "Side key 1 short (F1S)",
|
||||||
|
action(_mem.key1_shortpress_action))
|
||||||
|
add(keys, "key1_longpress_action", "Side key 1 long (F1L)",
|
||||||
|
action(_mem.key1_longpress_action))
|
||||||
|
add(keys, "key2_shortpress_action", "Side key 2 short (F2S)",
|
||||||
|
action(_mem.key2_shortpress_action))
|
||||||
|
add(keys, "key2_longpress_action", "Side key 2 long (F2L)",
|
||||||
|
action(_mem.key2_longpress_action))
|
||||||
|
add(keys, "keyM_longpress_action", "M long (ML)",
|
||||||
|
action(_mem.keyM_longpress_action))
|
||||||
|
add(keys, "key_lock", "Keypad locked", boolean(_mem.key_lock))
|
||||||
|
add(keys, "auto_keypad_lock", "Auto keypad lock (KeyLck)",
|
||||||
|
lst(KEYLOCK_LIST, _mem.auto_keypad_lock))
|
||||||
|
add(keys, "set_ptt", "PTT mode (SPTT)", lst(SET_PTT_LIST,
|
||||||
|
_mem.set_ptt))
|
||||||
|
|
||||||
|
scan = group("scan", "Scan")
|
||||||
|
add(scan, "slDef", "Scan list (SList)", lst(SLIST_LIST, _mem.slDef))
|
||||||
|
add(scan, "scan_resume_mode", "Scan resume (ScnRev)",
|
||||||
|
lst(SCANREV_LIST, _mem.scan_resume_mode))
|
||||||
|
|
||||||
|
power = group("power", "Power")
|
||||||
|
add(power, "battery_type", "Battery type (BatTyp)",
|
||||||
|
lst(BATTYPE_LIST, _mem.battery_type))
|
||||||
|
add(power, "set_off", "Auto power off (SOff)",
|
||||||
|
lst(SET_OFF_LIST, _mem.set_off))
|
||||||
|
vol = RadioSettingValueInteger(0, 63, min(int(_mem.volume_gain), 63))
|
||||||
|
vol.set_mutable(False)
|
||||||
|
add(power, "volume_gain", "Volume gain (SVol, set on the radio)", vol)
|
||||||
|
|
||||||
|
dtmf = group("dtmf", "DTMF")
|
||||||
|
add(dtmf, "dtmf_side_tone", "DTMF side tone (L DTMF)",
|
||||||
|
boolean(_mem.dtmf_side_tone == 1))
|
||||||
|
add(dtmf, "dtmf_preload_time", "Preload time x10 ms (D Prel)",
|
||||||
|
RadioSettingValueInteger(3, 99, max(3, min(
|
||||||
|
int(_mem.dtmf_preload_time), 99))))
|
||||||
|
add(dtmf, "live_DTMF_decoder", "Live DTMF decoder (D Live)",
|
||||||
|
boolean(_mem.live_DTMF_decoder))
|
||||||
|
for name, label in (("dtmf_up_code", "Up code (UPCode)"),
|
||||||
|
("dtmf_down_code", "Down code (DNCode)")):
|
||||||
|
code = str(getattr(_mem, name)).split("\x00")[0] \
|
||||||
|
.replace("\xff", "").rstrip()
|
||||||
|
add(dtmf, name, label, RadioSettingValueString(
|
||||||
|
0, 16, code, False, DTMF_CHARS))
|
||||||
|
|
||||||
|
data = group("data", "POCSAG / SMS")
|
||||||
|
add(data, "fsk_mode", "Modem (FSKMod)", lst(FSK_MODES, _mem.fsk_mode))
|
||||||
|
src = int(_mem.fsk_src)
|
||||||
|
add(data, "fsk_src", "Own address / RIC (FSKSRC)",
|
||||||
|
RadioSettingValueInteger(0, 99999999,
|
||||||
|
src if src <= 99999999 else 0))
|
||||||
|
add(data, "pocsag_monitor", "POCSAG monitor, all RICs (PocMon)",
|
||||||
|
boolean(_mem.pocsag_monitor == POCSAG_MONITOR_ON))
|
||||||
|
|
||||||
|
fm = group("fm", "FM radio")
|
||||||
|
add(fm, "fm_band", "Band", lst(FM_BANDS, _mem.fm_band))
|
||||||
|
add(fm, "fm_agc", "AGC", boolean(_mem.fm_agc))
|
||||||
|
add(fm, "fm_blend", "Stereo blend", lst(FM_BLEND, _mem.fm_blend))
|
||||||
|
add(fm, "fm_deemphasis", "De-emphasis",
|
||||||
|
lst(FM_DEEMPHASIS, _mem.fm_deemphasis))
|
||||||
|
for i in range(20):
|
||||||
|
freq = int(_mem.fmfreq[i])
|
||||||
|
text = "%.1f" % (freq / 10.0) if 640 <= freq <= 1080 else ""
|
||||||
|
add(fm, "fmfreq%d" % i, "Preset %d (MHz)" % (i + 1),
|
||||||
|
RadioSettingValueString(0, 5, text, False, "0123456789. "))
|
||||||
|
|
||||||
|
msgs = group("messages", "Messages")
|
||||||
|
add(msgs, "msg_clear", "Delete all messages on upload",
|
||||||
|
boolean(False))
|
||||||
|
for rank, slot in enumerate(self._messages()):
|
||||||
|
msg = _mem.message[slot]
|
||||||
|
raw = bytes(msg.get_raw())
|
||||||
|
text = raw[7:7 + MESSAGE_TEXT].split(b"\x00")[0]
|
||||||
|
empty = raw[0:4] == b"\xff" * 4 or text[:1] in (b"", b"\xff")
|
||||||
|
text = "" if empty else "".join(
|
||||||
|
chr(c) if 32 <= c < 127 else "?" for c in text)
|
||||||
|
kind = "POCSAG RIC" if int(msg.flags) & MESSAGE_FLAG_POCSAG \
|
||||||
|
else "SMS from"
|
||||||
|
label = "#%d %s" % (rank + 1, "(empty)" if empty else
|
||||||
|
"%s %d" % (kind, int(msg.src)))
|
||||||
|
value = RadioSettingValueString(0, MESSAGE_TEXT, text, False)
|
||||||
|
add(msgs, "msg%d" % slot, label, value)
|
||||||
|
|
||||||
|
return top
|
||||||
|
|
||||||
|
def set_settings(self, settings):
|
||||||
|
_mem = self._memobj
|
||||||
|
actions = dict(KEY_ACTIONS)
|
||||||
|
index_lists = {
|
||||||
|
"mic_gain": MIC_GAIN_LIST, "battery_save": BATSAVE_LIST,
|
||||||
|
"roger_beep": ROGER_LIST, "rp_ste": RP_STE_LIST,
|
||||||
|
"int_flock": FLOCK_LIST,
|
||||||
|
"channel_display_mode": CHANNELDISP_LIST,
|
||||||
|
"backlight_time": BACKLIGHT_LIST,
|
||||||
|
"backlight_on_TX_RX": BACKLIGHT_TX_RX_LIST,
|
||||||
|
"battery_text": BAT_TXT_LIST, "auto_keypad_lock": KEYLOCK_LIST,
|
||||||
|
"set_ptt": SET_PTT_LIST, "slDef": SLIST_LIST,
|
||||||
|
"scan_resume_mode": SCANREV_LIST, "battery_type": BATTYPE_LIST,
|
||||||
|
"set_off": SET_OFF_LIST, "fsk_mode": FSK_MODES,
|
||||||
|
"fm_band": FM_BANDS, "fm_blend": FM_BLEND,
|
||||||
|
"fm_deemphasis": FM_DEEMPHASIS, "TX_VFO": ["A", "B"],
|
||||||
|
}
|
||||||
|
plain = ("squelch", "backlight_min", "backlight_max", "ste",
|
||||||
|
"button_beep", "mic_bar", "set_inv", "set_tmr", "key_lock",
|
||||||
|
"live_DTMF_decoder", "fm_agc", "dtmf_preload_time")
|
||||||
|
clear_messages = False
|
||||||
|
|
||||||
|
for element in settings:
|
||||||
|
if not isinstance(element, RadioSetting):
|
||||||
|
self.set_settings(element)
|
||||||
|
continue
|
||||||
|
if not element.value.get_mutable():
|
||||||
|
continue
|
||||||
|
name = element.get_name()
|
||||||
|
value = element.value.get_value()
|
||||||
|
|
||||||
|
if name in index_lists:
|
||||||
|
setattr(_mem, name, index_lists[name].index(value))
|
||||||
|
elif name in plain:
|
||||||
|
setattr(_mem, name, int(value))
|
||||||
|
elif name == "tot":
|
||||||
|
_mem.max_talk_time = TOT_VALUES[TOT_LIST.index(value)]
|
||||||
|
elif name == "rx_mode":
|
||||||
|
mode = RXMODE_LIST.index(value)
|
||||||
|
main = int(_mem.TX_VFO) + 1
|
||||||
|
_mem.crossband = main if mode & 0b10 else 0
|
||||||
|
_mem.dual_watch = main if mode & 0b01 else 0
|
||||||
|
elif name == "call_channel":
|
||||||
|
_mem.call_channel = int(value) - 1
|
||||||
|
elif name.endswith("press_action"):
|
||||||
|
setattr(_mem, name, actions[value])
|
||||||
|
elif name == "dtmf_side_tone":
|
||||||
|
_mem.dtmf_side_tone = 1 if value else 0
|
||||||
|
elif name in ("dtmf_up_code", "dtmf_down_code"):
|
||||||
|
setattr(_mem, name,
|
||||||
|
str(value).rstrip().ljust(16, "\x00")[:16])
|
||||||
|
elif name == "fsk_src":
|
||||||
|
src = int(value)
|
||||||
|
if _mem.fsk_mode in POCSAG_MODES:
|
||||||
|
src = min(src, POCSAG_MAX_RIC)
|
||||||
|
_mem.fsk_src = src
|
||||||
|
elif name == "pocsag_monitor":
|
||||||
|
_mem.pocsag_monitor = POCSAG_MONITOR_ON if value else 0
|
||||||
|
elif name.startswith("fmfreq"):
|
||||||
|
text = str(value).strip()
|
||||||
|
try:
|
||||||
|
freq = int(round(float(text) * 10)) if text else 0xFFFF
|
||||||
|
except ValueError:
|
||||||
|
freq = 0xFFFF
|
||||||
|
if freq != 0xFFFF and not 640 <= freq <= 1080:
|
||||||
|
freq = 0xFFFF
|
||||||
|
_mem.fmfreq[int(name[6:])] = freq
|
||||||
|
elif name == "msg_clear":
|
||||||
|
clear_messages = bool(value)
|
||||||
|
elif name.startswith("msg"):
|
||||||
|
self._set_message(int(name[3:]), str(value))
|
||||||
|
|
||||||
|
if clear_messages:
|
||||||
|
for slot in range(MESSAGES):
|
||||||
|
_mem.message[slot].set_raw(b"\xFF" * 48)
|
||||||
|
_mem.msg_latest = MESSAGES - 1
|
||||||
|
|
||||||
|
def _set_message(self, slot, text):
|
||||||
|
msg = self._memobj.message[slot]
|
||||||
|
raw = bytearray(msg.get_raw())
|
||||||
|
old = bytes(raw[7:7 + MESSAGE_TEXT]).split(b"\x00")[0]
|
||||||
|
new = "".join(c if 32 <= ord(c) < 127 else "?"
|
||||||
|
for c in text.rstrip())[:MESSAGE_TEXT].encode("ascii")
|
||||||
|
if new == old or (not new and old[:1] in (b"", b"\xff")):
|
||||||
|
return
|
||||||
|
if raw[0:4] == b"\xff" * 4: # empty slot: a local message
|
||||||
|
raw[0:7] = bytes(7)
|
||||||
|
raw[7:48] = new.ljust(41, b"\x00")
|
||||||
|
msg.set_raw(bytes(raw))
|
||||||
+4
-118
@@ -2,7 +2,8 @@
|
|||||||
#export DOCKER_DEFAULT_PLATFORM=linux/amd64
|
#export DOCKER_DEFAULT_PLATFORM=linux/amd64
|
||||||
#export DOCKER_NETWORK="--network=host"
|
#export DOCKER_NETWORK="--network=host"
|
||||||
IMAGE_NAME="uvk5"
|
IMAGE_NAME="uvk5"
|
||||||
rm "${PWD}/compiled-firmware/*"
|
rm -rf "${PWD}/compiled-firmware/*"
|
||||||
|
mkdir -p "${PWD}/compiled-firmware"
|
||||||
echo "Building docker image $IMAGE_NAME"
|
echo "Building docker image $IMAGE_NAME"
|
||||||
if ! docker build -t $DOCKER_NETWORK $IMAGE_NAME .
|
if ! docker build -t $DOCKER_NETWORK $IMAGE_NAME .
|
||||||
then
|
then
|
||||||
@@ -10,121 +11,6 @@ then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
custom() {
|
|
||||||
echo "Custom compilation..."
|
echo "Custom compilation..."
|
||||||
docker run --rm -v "${PWD}/compiled-firmware/:/app/compiled-firmware" $IMAGE_NAME /bin/bash -c "rm ./compiled-firmware/*; cd /app && make -s \
|
docker run --rm -v "${PWD}/compiled-firmware:/app/compiled-firmware" $IMAGE_NAME \
|
||||||
EDITION_STRING=Custom \
|
/bin/bash -c "cd /app && make -j && cp f4hwn* /app/compiled-firmware/ && ls -l /app/compiled-firmware/ || echo 'No files to copy'"
|
||||||
TARGET=f4hwn.custom \
|
|
||||||
&& cp f4hwn.custom* compiled-firmware/"
|
|
||||||
}
|
|
||||||
|
|
||||||
standard() {
|
|
||||||
echo "Standard compilation..."
|
|
||||||
docker run --rm -v "${PWD}/compiled-firmware:/app/compiled-firmware" $IMAGE_NAME /bin/bash -c "rm ./compiled-firmware/*; cd /app && make -s \
|
|
||||||
ENABLE_SPECTRUM=0 \
|
|
||||||
ENABLE_FMRADIO=0 \
|
|
||||||
ENABLE_AIRCOPY=0 \
|
|
||||||
ENABLE_NOAA=0 \
|
|
||||||
EDITION_STRING=Standard \
|
|
||||||
TARGET=f4hwn.standard \
|
|
||||||
&& cp f4hwn.standard* compiled-firmware/"
|
|
||||||
}
|
|
||||||
|
|
||||||
bandscope() {
|
|
||||||
echo "Bandscope compilation..."
|
|
||||||
docker run --rm -v "${PWD}/compiled-firmware/:/app/compiled-firmware" $IMAGE_NAME /bin/bash -c "rm ./compiled-firmware/*; cd /app && make -s \
|
|
||||||
ENABLE_SPECTRUM=1 \
|
|
||||||
ENABLE_FMRADIO=0 \
|
|
||||||
ENABLE_AIRCOPY=1 \
|
|
||||||
ENABLE_FEAT_F4HWN_PMR=1 \
|
|
||||||
ENABLE_FEAT_F4HWN_GMRS_FRS_MURS=1 \
|
|
||||||
ENABLE_NOAA=0 \
|
|
||||||
ENABLE_FEAT_F4HWN_RESCUE_OPS=0 \
|
|
||||||
EDITION_STRING=Bandscope \
|
|
||||||
TARGET=f4hwn.bandscope \
|
|
||||||
&& cp f4hwn.bandscope* compiled-firmware/"
|
|
||||||
}
|
|
||||||
|
|
||||||
broadcast() {
|
|
||||||
echo "Broadcast compilation..."
|
|
||||||
docker run --rm -v "${PWD}/compiled-firmware:/app/compiled-firmware" $IMAGE_NAME /bin/bash -c "cd /app && make -s \
|
|
||||||
ENABLE_SPECTRUM=0 \
|
|
||||||
ENABLE_FMRADIO=1 \
|
|
||||||
ENABLE_AIRCOPY=1 \
|
|
||||||
ENABLE_FEAT_F4HWN_PMR=1 \
|
|
||||||
ENABLE_FEAT_F4HWN_GMRS_FRS_MURS=1 \
|
|
||||||
ENABLE_NOAA=0 \
|
|
||||||
EDITION_STRING=Broadcast \
|
|
||||||
ENABLE_FEAT_F4HWN_RESCUE_OPS=0 \
|
|
||||||
TARGET=f4hwn.broadcast \
|
|
||||||
&& cp f4hwn.broadcast* compiled-firmware/"
|
|
||||||
}
|
|
||||||
|
|
||||||
basic() {
|
|
||||||
echo "Basic compilation..."
|
|
||||||
docker run --rm -v "${PWD}/compiled-firmware:/app/compiled-firmware" $IMAGE_NAME /bin/bash -c "cd /app && make -s \
|
|
||||||
ENABLE_SPECTRUM=1 \
|
|
||||||
ENABLE_FMRADIO=1 \
|
|
||||||
ENABLE_VOX=0 \
|
|
||||||
ENABLE_AIRCOPY=0 \
|
|
||||||
ENABLE_AUDIO_BAR=0 \
|
|
||||||
ENABLE_FEAT_F4HWN_SPECTRUM=0 \
|
|
||||||
ENABLE_FEAT_F4HWN_PMR=1 \
|
|
||||||
ENABLE_FEAT_F4HWN_GMRS_FRS_MURS=1 \
|
|
||||||
ENABLE_NOAA=0 \
|
|
||||||
ENABLE_FEAT_F4HWN_RESUME_STATE=0 \
|
|
||||||
ENABLE_FEAT_F4HWN_CHARGING_C=0 \
|
|
||||||
ENABLE_FEAT_F4HWN_INV=1 \
|
|
||||||
ENABLE_FEAT_F4HWN_CTR=0 \
|
|
||||||
ENABLE_FEAT_F4HWN_NARROWER=0 \
|
|
||||||
ENABLE_FEAT_F4HWN_RESCUE_OPS=0 \
|
|
||||||
EDITION_STRING=Basic \
|
|
||||||
TARGET=f4hwn.basic \
|
|
||||||
&& cp f4hwn.basic* compiled-firmware/"
|
|
||||||
}
|
|
||||||
|
|
||||||
rescueops() {
|
|
||||||
echo "RescueOps compilation..."
|
|
||||||
docker run --rm -v "${PWD}/compiled-firmware:/app/compiled-firmware" $IMAGE_NAME /bin/bash -c "cd /app && make -s \
|
|
||||||
ENABLE_SPECTRUM=0 \
|
|
||||||
ENABLE_FMRADIO=0 \
|
|
||||||
ENABLE_AIRCOPY=1 \
|
|
||||||
ENABLE_FEAT_F4HWN_PMR=1 \
|
|
||||||
ENABLE_FEAT_F4HWN_GMRS_FRS_MURS=1 \
|
|
||||||
ENABLE_NOAA=1 \
|
|
||||||
ENABLE_FEAT_F4HWN_RESCUE_OPS=1 \
|
|
||||||
EDITION_STRING=RescueOps \
|
|
||||||
TARGET=f4hwn.rescueops \
|
|
||||||
&& cp f4hwn.rescueops* compiled-firmware/"
|
|
||||||
}
|
|
||||||
|
|
||||||
case "$1" in
|
|
||||||
custom)
|
|
||||||
custom
|
|
||||||
;;
|
|
||||||
standard)
|
|
||||||
standard
|
|
||||||
;;
|
|
||||||
bandscope)
|
|
||||||
bandscope
|
|
||||||
;;
|
|
||||||
broadcast)
|
|
||||||
broadcast
|
|
||||||
;;
|
|
||||||
basic)
|
|
||||||
basic
|
|
||||||
;;
|
|
||||||
rescueops)
|
|
||||||
rescueops
|
|
||||||
;;
|
|
||||||
all)
|
|
||||||
bandscope
|
|
||||||
broadcast
|
|
||||||
rescueops
|
|
||||||
basic
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "Usage: $0 {custom|bandscope|broadcast|basic|standard|all}"
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
@@ -66,12 +66,6 @@ void BACKLIGHT_InitHardware()
|
|||||||
0;
|
0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void BACKLIGHT_Sound(void)
|
|
||||||
{
|
|
||||||
gK5startup = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void BACKLIGHT_TurnOn(void)
|
void BACKLIGHT_TurnOn(void)
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_FEAT_F4HWN_SLEEP
|
#ifdef ENABLE_FEAT_F4HWN_SLEEP
|
||||||
@@ -84,38 +78,11 @@ void BACKLIGHT_TurnOn(void)
|
|||||||
|
|
||||||
if (gEeprom.BACKLIGHT_TIME == 0) {
|
if (gEeprom.BACKLIGHT_TIME == 0) {
|
||||||
BACKLIGHT_TurnOff();
|
BACKLIGHT_TurnOff();
|
||||||
#ifdef ENABLE_FEAT_F4HWN
|
|
||||||
if(gK5startup == true)
|
|
||||||
{
|
|
||||||
BACKLIGHT_Sound();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
backlightOn = true;
|
backlightOn = true;
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN
|
|
||||||
if(gK5startup == true) {
|
|
||||||
#if defined(ENABLE_FMRADIO) && defined(ENABLE_SPECTRUM)
|
|
||||||
BACKLIGHT_SetBrightness(gEeprom.BACKLIGHT_MAX);
|
|
||||||
#else
|
|
||||||
for(uint8_t i = 0; i <= gEeprom.BACKLIGHT_MAX; i++)
|
|
||||||
{
|
|
||||||
BACKLIGHT_SetBrightness(i);
|
|
||||||
SYSTEM_DelayMs(50);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
BACKLIGHT_Sound();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
BACKLIGHT_SetBrightness(gEeprom.BACKLIGHT_MAX);
|
BACKLIGHT_SetBrightness(gEeprom.BACKLIGHT_MAX);
|
||||||
}
|
|
||||||
#else
|
|
||||||
BACKLIGHT_SetBrightness(gEeprom.BACKLIGHT_MAX);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
switch (gEeprom.BACKLIGHT_TIME) {
|
switch (gEeprom.BACKLIGHT_TIME) {
|
||||||
default:
|
default:
|
||||||
|
|||||||
+34
-6
@@ -18,15 +18,43 @@
|
|||||||
#define BK1080_REGS_H
|
#define BK1080_REGS_H
|
||||||
|
|
||||||
enum BK1080_Register_t {
|
enum BK1080_Register_t {
|
||||||
BK1080_REG_00 = 0x00U,
|
BK1080_REG_00 = 0x00U,
|
||||||
BK1080_REG_02_POWER_CONFIGURATION = 0x02U,
|
BK1080_REG_01_CHIP_ID = 0x01U,
|
||||||
BK1080_REG_03_CHANNEL = 0x03U,
|
BK1080_REG_02_POWER_CONFIGURATION = 0x02U,
|
||||||
|
BK1080_REG_03_CHANNEL = 0x03U,
|
||||||
|
BK1080_REG_04_SYSTEM_CONFIGURATION1 = 0x04U,
|
||||||
BK1080_REG_05_SYSTEM_CONFIGURATION2 = 0x05U,
|
BK1080_REG_05_SYSTEM_CONFIGURATION2 = 0x05U,
|
||||||
BK1080_REG_07 = 0x07U,
|
BK1080_REG_06_SYSTEM_CONFIGURATION3 = 0x06U,
|
||||||
BK1080_REG_10 = 0x0AU,
|
BK1080_REG_07_TEST1 = 0x07U,
|
||||||
BK1080_REG_25_INTERNAL = 0x19U,
|
BK1080_REG_08_TEST2 = 0x08U,
|
||||||
|
BK1080_REG_09_BOOT_CONFIGURATION = 0x09U,
|
||||||
|
BK1080_REG_10_RSSI_STATUS = 0x0AU,
|
||||||
|
BK1080_REG_11_RSSI_THRESHOLD = 0x0BU,
|
||||||
|
BK1080_REG_12_INTERNAL = 0x0CU,
|
||||||
|
BK1080_REG_13_INTERNAL = 0x0DU,
|
||||||
|
BK1080_REG_14_INTERNAL = 0x0EU,
|
||||||
|
BK1080_REG_15_INTERNAL = 0x0FU,
|
||||||
|
BK1080_REG_16_INTERNAL = 0x10U,
|
||||||
|
BK1080_REG_17_INTERNAL = 0x11U,
|
||||||
|
BK1080_REG_18_INTERNAL = 0x12U,
|
||||||
|
BK1080_REG_19_INTERNAL = 0x13U,
|
||||||
|
BK1080_REG_20_INTERNAL = 0x14U,
|
||||||
|
BK1080_REG_21_INTERNAL = 0x15U,
|
||||||
|
BK1080_REG_22_INTERNAL = 0x16U,
|
||||||
|
BK1080_REG_23_INTERNAL = 0x17U,
|
||||||
|
BK1080_REG_24_INTERNAL = 0x18U,
|
||||||
|
BK1080_REG_25_INTERNAL = 0x19U,
|
||||||
|
BK1080_REG_26_INTERNAL = 0x1AU,
|
||||||
|
BK1080_REG_27_INTERNAL = 0x1BU,
|
||||||
|
BK1080_REG_28_INTERNAL = 0x1CU,
|
||||||
|
BK1080_REG_29_INTERNAL = 0x1DU,
|
||||||
|
BK1080_REG_30_INTERNAL = 0x1EU,
|
||||||
|
BK1080_REG_31_INTERNAL = 0x1FU,
|
||||||
|
BK1080_REG_32_INTERNAL = 0x20U,
|
||||||
|
BK1080_REG_33_INTERNAL = 0x21U,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
typedef enum BK1080_Register_t BK1080_Register_t;
|
typedef enum BK1080_Register_t BK1080_Register_t;
|
||||||
|
|
||||||
// REG 07
|
// REG 07
|
||||||
|
|||||||
+13
-2
@@ -19,6 +19,7 @@
|
|||||||
#include "driver/gpio.h"
|
#include "driver/gpio.h"
|
||||||
#include "driver/i2c.h"
|
#include "driver/i2c.h"
|
||||||
#include "driver/system.h"
|
#include "driver/system.h"
|
||||||
|
#include "../settings.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
|
|
||||||
#ifndef ARRAY_SIZE
|
#ifndef ARRAY_SIZE
|
||||||
@@ -69,10 +70,11 @@ void BK1080_Init(uint16_t freq, uint8_t band/*, uint8_t space*/)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN
|
#ifdef ENABLE_FEAT_F4HWN
|
||||||
BK1080_WriteRegister(BK1080_REG_05_SYSTEM_CONFIGURATION2, gMute ? 0x0A10 : 0x0A1F);
|
BK1080_WriteRegister(BK1080_REG_05_SYSTEM_CONFIGURATION2, 0x0A10 | (gEeprom.VOLUME_GAIN >> 2));
|
||||||
#else
|
#else
|
||||||
BK1080_WriteRegister(BK1080_REG_05_SYSTEM_CONFIGURATION2, 0x0A1F);
|
BK1080_WriteRegister(BK1080_REG_05_SYSTEM_CONFIGURATION2, 0x0A1F);
|
||||||
#endif
|
#endif
|
||||||
|
BK1080_UpdateSysconf();
|
||||||
BK1080_SetFrequency(freq, band/*, space*/);
|
BK1080_SetFrequency(freq, band/*, space*/);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -104,6 +106,15 @@ void BK1080_WriteRegister(BK1080_Register_t Register, uint16_t Value)
|
|||||||
I2C_Stop();
|
I2C_Stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BK1080_UpdateSysconf(void) {
|
||||||
|
BK1080_WriteRegister(BK1080_REG_04_SYSTEM_CONFIGURATION1,
|
||||||
|
(gEeprom.BK1080_DEEMPHASIS_CONFIG == DEEMPHASIS_OFF ? BK1080_DEEMPHASIS_OFF : BK1080_DEEMPHASIS_ON) |
|
||||||
|
(gEeprom.BK1080_DEEMPHASIS_CONFIG == DEEMPHASIS_EUR ? BK1080_DEEMPHASIS_EUR : BK1080_DEEMPHASIS_USA) |
|
||||||
|
(gEeprom.BK1080_AGC_ENABLED ? BK1080_AGC_ON : BK1080_AGC_OFF) |
|
||||||
|
(gEeprom.BK1080_BLEND_CONFIG << 6)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
void BK1080_Mute(bool Mute)
|
void BK1080_Mute(bool Mute)
|
||||||
{
|
{
|
||||||
BK1080_WriteRegister(BK1080_REG_02_POWER_CONFIGURATION, Mute ? 0x4201 : 0x0201);
|
BK1080_WriteRegister(BK1080_REG_02_POWER_CONFIGURATION, Mute ? 0x4201 : 0x0201);
|
||||||
@@ -130,7 +141,7 @@ void BK1080_SetFrequency(uint16_t frequency, uint8_t band/*, uint8_t space*/)
|
|||||||
void BK1080_GetFrequencyDeviation(uint16_t Frequency)
|
void BK1080_GetFrequencyDeviation(uint16_t Frequency)
|
||||||
{
|
{
|
||||||
BK1080_BaseFrequency = Frequency;
|
BK1080_BaseFrequency = Frequency;
|
||||||
BK1080_FrequencyDeviation = BK1080_ReadRegister(BK1080_REG_07) / 16;
|
BK1080_FrequencyDeviation = BK1080_ReadRegister(BK1080_REG_07_TEST1) / 16;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t BK1080_GetFreqLoLimit(uint8_t band)
|
uint16_t BK1080_GetFreqLoLimit(uint8_t band)
|
||||||
|
|||||||
@@ -24,10 +24,20 @@
|
|||||||
extern uint16_t BK1080_BaseFrequency;
|
extern uint16_t BK1080_BaseFrequency;
|
||||||
extern uint16_t BK1080_FrequencyDeviation;
|
extern uint16_t BK1080_FrequencyDeviation;
|
||||||
|
|
||||||
|
#define BK1080_DEEMPHASIS_USA (0 << 11)
|
||||||
|
#define BK1080_DEEMPHASIS_EUR (1 << 11)
|
||||||
|
|
||||||
|
#define BK1080_DEEMPHASIS_ON (0 << 13)
|
||||||
|
#define BK1080_DEEMPHASIS_OFF (1 << 13)
|
||||||
|
|
||||||
|
#define BK1080_AGC_ON (0 << 10)
|
||||||
|
#define BK1080_AGC_OFF (1 << 10)
|
||||||
|
|
||||||
void BK1080_Init0(void);
|
void BK1080_Init0(void);
|
||||||
void BK1080_Init(uint16_t Frequency, uint8_t band/*, uint8_t space*/);
|
void BK1080_Init(uint16_t Frequency, uint8_t band/*, uint8_t space*/);
|
||||||
uint16_t BK1080_ReadRegister(BK1080_Register_t Register);
|
uint16_t BK1080_ReadRegister(BK1080_Register_t Register);
|
||||||
void BK1080_WriteRegister(BK1080_Register_t Register, uint16_t Value);
|
void BK1080_WriteRegister(BK1080_Register_t Register, uint16_t Value);
|
||||||
|
void BK1080_UpdateSysconf(void);
|
||||||
void BK1080_Mute(bool Mute);
|
void BK1080_Mute(bool Mute);
|
||||||
uint16_t BK1080_GetFreqLoLimit(uint8_t band);
|
uint16_t BK1080_GetFreqLoLimit(uint8_t band);
|
||||||
uint16_t BK1080_GetFreqHiLimit(uint8_t band);
|
uint16_t BK1080_GetFreqHiLimit(uint8_t band);
|
||||||
|
|||||||
@@ -86,6 +86,8 @@ enum BK4819_REGISTER_t {
|
|||||||
// REG_49<13:7> 0x50; RF AGC high threshold, 1 dB/LSB
|
// REG_49<13:7> 0x50; RF AGC high threshold, 1 dB/LSB
|
||||||
// REG_49<6:0> 0x30; RF AGC low threshold, 1 dB/LSB
|
// REG_49<6:0> 0x30; RF AGC low threshold, 1 dB/LSB
|
||||||
BK4819_REG_49 = 0x49U,
|
BK4819_REG_49 = 0x49U,
|
||||||
|
// REG_4B<5> 1 = TX ALC disable
|
||||||
|
BK4819_REG_4B = 0x4BU,
|
||||||
BK4819_REG_4D = 0x4DU,
|
BK4819_REG_4D = 0x4DU,
|
||||||
BK4819_REG_4E = 0x4EU,
|
BK4819_REG_4E = 0x4EU,
|
||||||
BK4819_REG_4F = 0x4FU,
|
BK4819_REG_4F = 0x4FU,
|
||||||
|
|||||||
+68
-12
@@ -42,12 +42,18 @@ static uint16_t gBK4819_GpioOutState;
|
|||||||
|
|
||||||
bool gRxIdleMode;
|
bool gRxIdleMode;
|
||||||
|
|
||||||
__inline uint16_t scale_freq(const uint16_t freq)
|
__inline uint16_t scale_freq(uint16_t freq)
|
||||||
{
|
{
|
||||||
// return (((uint32_t)freq * 1032444u) + 50000u) / 100000u; // with rounding
|
// return (((uint32_t)freq * 1032444u) + 50000u) / 100000u; // with rounding
|
||||||
return (((uint32_t)freq * 1353245u) + (1u << 16)) >> 17; // with rounding
|
return (((uint32_t)freq * 1353245u) + (1u << 16)) >> 17; // with rounding
|
||||||
}
|
}
|
||||||
|
|
||||||
|
__inline uint16_t inverse_scale_freq(uint16_t scaled_freq)
|
||||||
|
{
|
||||||
|
return (((uint32_t)scaled_freq << 17) - (1u << 16)) / 1353245u;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void BK4819_FskEnableTx(void){
|
void BK4819_FskEnableTx(void){
|
||||||
const uint16_t fsk_reg59 = BK4819_ReadRegister(BK4819_REG_59);
|
const uint16_t fsk_reg59 = BK4819_ReadRegister(BK4819_REG_59);
|
||||||
BK4819_WriteRegister(BK4819_REG_59, (1u << 11) | fsk_reg59);
|
BK4819_WriteRegister(BK4819_REG_59, (1u << 11) | fsk_reg59);
|
||||||
@@ -388,6 +394,54 @@ void BK4819_ToggleGpioOut(BK4819_GPIO_PIN_t Pin, bool bSet)
|
|||||||
BK4819_WriteRegister(BK4819_REG_33, gBK4819_GpioOutState);
|
BK4819_WriteRegister(BK4819_REG_33, gBK4819_GpioOutState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ~250 ns at 48 MHz (call + return + 6 nops): keeps the bit-banged SPI clock around
|
||||||
|
// 1 MHz. A real function, so the wait is not inlined at every clock edge.
|
||||||
|
static void __attribute__((noinline)) BK4819_FastSpiWait(void)
|
||||||
|
{
|
||||||
|
__asm volatile ("nop\n nop\n nop\n nop\n nop\n nop");
|
||||||
|
}
|
||||||
|
#define BK4819_FAST_SPI_WAIT() BK4819_FastSpiWait()
|
||||||
|
|
||||||
|
// BK4819_WriteRegister() without the SYSTICK_DelayUs(1) calls (their overhead makes a
|
||||||
|
// write take ~300 us).
|
||||||
|
static void BK4819_WriteRegisterFast(BK4819_REGISTER_t Register, uint16_t Data)
|
||||||
|
{
|
||||||
|
uint32_t word = ((uint32_t) Register << 16) | Data;
|
||||||
|
|
||||||
|
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_BK4819_SCN);
|
||||||
|
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_BK4819_SCL);
|
||||||
|
BK4819_FAST_SPI_WAIT();
|
||||||
|
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_BK4819_SCN);
|
||||||
|
|
||||||
|
for (unsigned int i = 0; i < 24; i++) {
|
||||||
|
if (word & 0x800000U)
|
||||||
|
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_BK4819_SDA);
|
||||||
|
else
|
||||||
|
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_BK4819_SDA);
|
||||||
|
BK4819_FAST_SPI_WAIT();
|
||||||
|
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_BK4819_SCL);
|
||||||
|
BK4819_FAST_SPI_WAIT();
|
||||||
|
word <<= 1;
|
||||||
|
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_BK4819_SCL);
|
||||||
|
BK4819_FAST_SPI_WAIT();
|
||||||
|
}
|
||||||
|
|
||||||
|
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_BK4819_SCN);
|
||||||
|
BK4819_FAST_SPI_WAIT();
|
||||||
|
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_BK4819_SCL);
|
||||||
|
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_BK4819_SDA);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BK4819_ToggleGpioOutFast(BK4819_GPIO_PIN_t Pin, bool bSet)
|
||||||
|
{
|
||||||
|
if (bSet)
|
||||||
|
gBK4819_GpioOutState |= (0x40u >> Pin);
|
||||||
|
else
|
||||||
|
gBK4819_GpioOutState &= ~(0x40u >> Pin);
|
||||||
|
|
||||||
|
BK4819_WriteRegisterFast(BK4819_REG_33, gBK4819_GpioOutState);
|
||||||
|
}
|
||||||
|
|
||||||
void BK4819_SetCDCSSCodeWord(uint32_t CodeWord)
|
void BK4819_SetCDCSSCodeWord(uint32_t CodeWord)
|
||||||
{
|
{
|
||||||
// REG_51
|
// REG_51
|
||||||
@@ -670,7 +724,9 @@ void BK4819_SetFilterBandwidth(const BK4819_FilterBandwidth_t Bandwidth, const b
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
BK4819_WriteRegister(BK4819_REG_43, val);
|
if (Bandwidth != BK4819_FILTER_BW_FSK_OFFLOAD) {
|
||||||
|
BK4819_WriteRegister(BK4819_REG_43, val);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BK4819_SetupPowerAmplifier(const uint8_t bias, const uint32_t frequency)
|
void BK4819_SetupPowerAmplifier(const uint8_t bias, const uint32_t frequency)
|
||||||
@@ -854,18 +910,18 @@ void BK4819_PickRXFilterPathBasedOnFrequency(uint32_t Frequency)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BK4819_DisableScramble(void)
|
void BK4819_SetScramble(uint16_t Freq)
|
||||||
{
|
{
|
||||||
const uint16_t Value = BK4819_ReadRegister(BK4819_REG_31);
|
uint16_t Value = BK4819_ReadRegister(BK4819_REG_31);
|
||||||
BK4819_WriteRegister(BK4819_REG_31, Value & ~(1u << 1));
|
if (Freq) {
|
||||||
}
|
Value |= (1u << 1);
|
||||||
|
} else {
|
||||||
|
Value &= ~(1u << 1);
|
||||||
|
}
|
||||||
|
BK4819_WriteRegister(BK4819_REG_31, Value);
|
||||||
|
|
||||||
void BK4819_EnableScramble(uint8_t Type)
|
//BK4819_WriteRegister(BK4819_REG_71, 0x68DC + (Freq * 1032)); // 0110 1000 1101 1100
|
||||||
{
|
BK4819_WriteRegister(BK4819_REG_71, Freq);
|
||||||
const uint16_t Value = BK4819_ReadRegister(BK4819_REG_31);
|
|
||||||
BK4819_WriteRegister(BK4819_REG_31, Value | (1u << 1));
|
|
||||||
|
|
||||||
BK4819_WriteRegister(BK4819_REG_71, 0x68DC + (Type * 1032)); // 0110 1000 1101 1100
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BK4819_CompanderEnabled(void)
|
bool BK4819_CompanderEnabled(void)
|
||||||
|
|||||||
+9
-3
@@ -48,7 +48,8 @@ enum BK4819_FilterBandwidth_t
|
|||||||
{
|
{
|
||||||
BK4819_FILTER_BW_WIDE = 0,
|
BK4819_FILTER_BW_WIDE = 0,
|
||||||
BK4819_FILTER_BW_NARROW,
|
BK4819_FILTER_BW_NARROW,
|
||||||
BK4819_FILTER_BW_NARROWER
|
BK4819_FILTER_BW_NARROWER,
|
||||||
|
BK4819_FILTER_BW_FSK_OFFLOAD
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef enum BK4819_FilterBandwidth_t BK4819_FilterBandwidth_t;
|
typedef enum BK4819_FilterBandwidth_t BK4819_FilterBandwidth_t;
|
||||||
@@ -65,6 +66,9 @@ typedef enum BK4819_CssScanResult_t BK4819_CssScanResult_t;
|
|||||||
// radio is asleep, not listening
|
// radio is asleep, not listening
|
||||||
extern bool gRxIdleMode;
|
extern bool gRxIdleMode;
|
||||||
|
|
||||||
|
uint16_t inverse_scale_freq(uint16_t scaled_freq);
|
||||||
|
uint16_t scale_freq(uint16_t freq);
|
||||||
|
|
||||||
void BK4819_Init(void);
|
void BK4819_Init(void);
|
||||||
uint16_t BK4819_ReadRegister(BK4819_REGISTER_t Register);
|
uint16_t BK4819_ReadRegister(BK4819_REGISTER_t Register);
|
||||||
void BK4819_WriteRegister(BK4819_REGISTER_t Register, uint16_t Data);
|
void BK4819_WriteRegister(BK4819_REGISTER_t Register, uint16_t Data);
|
||||||
@@ -76,6 +80,9 @@ void BK4819_SetAGC(bool enable);
|
|||||||
void BK4819_InitAGC(bool amModulation);
|
void BK4819_InitAGC(bool amModulation);
|
||||||
|
|
||||||
void BK4819_ToggleGpioOut(BK4819_GPIO_PIN_t Pin, bool bSet);
|
void BK4819_ToggleGpioOut(BK4819_GPIO_PIN_t Pin, bool bSet);
|
||||||
|
// Same as BK4819_ToggleGpioOut() with a fast SPI write (~25 us instead of ~300 us),
|
||||||
|
// for timing critical keying such as OOK.
|
||||||
|
void BK4819_ToggleGpioOutFast(BK4819_GPIO_PIN_t Pin, bool bSet);
|
||||||
|
|
||||||
void BK4819_ResetFSK(void);
|
void BK4819_ResetFSK(void);
|
||||||
void BK4819_FskClearFifo(void);
|
void BK4819_FskClearFifo(void);
|
||||||
@@ -100,8 +107,7 @@ void BK4819_SetupSquelch(
|
|||||||
void BK4819_SetAF(BK4819_AF_Type_t AF);
|
void BK4819_SetAF(BK4819_AF_Type_t AF);
|
||||||
void BK4819_RX_TurnOn(void);
|
void BK4819_RX_TurnOn(void);
|
||||||
void BK4819_PickRXFilterPathBasedOnFrequency(uint32_t Frequency);
|
void BK4819_PickRXFilterPathBasedOnFrequency(uint32_t Frequency);
|
||||||
void BK4819_DisableScramble(void);
|
void BK4819_SetScramble(uint16_t Freq);
|
||||||
void BK4819_EnableScramble(uint8_t Type);
|
|
||||||
|
|
||||||
bool BK4819_CompanderEnabled(void);
|
bool BK4819_CompanderEnabled(void);
|
||||||
void BK4819_SetCompander(const unsigned int mode);
|
void BK4819_SetCompander(const unsigned int mode);
|
||||||
|
|||||||
+17
-17
@@ -202,7 +202,7 @@ uint8_t cmds[] = {
|
|||||||
ST7565_WriteByte(ST7565_CMD_INVERSE_DISPLAY | gSetting_set_inv);
|
ST7565_WriteByte(ST7565_CMD_INVERSE_DISPLAY | gSetting_set_inv);
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
ST7565_WriteByte(21 + gSetting_set_ctr);
|
ST7565_WriteByte(21 + ST7565_CTR_SETTING_VAL);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ST7565_WriteByte(cmds[i]);
|
ST7565_WriteByte(cmds[i]);
|
||||||
@@ -226,22 +226,22 @@ uint8_t cmds[] = {
|
|||||||
return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
|
return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
|
// #if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
|
||||||
void ST7565_Gauge(uint8_t line, uint8_t min, uint8_t max, uint8_t value)
|
// void ST7565_Gauge(uint8_t line, uint8_t min, uint8_t max, uint8_t value)
|
||||||
{
|
// {
|
||||||
gFrameBuffer[line][54] = 0x0c;
|
// gFrameBuffer[line][54] = 0x0c;
|
||||||
gFrameBuffer[line][55] = 0x12;
|
// gFrameBuffer[line][55] = 0x12;
|
||||||
|
//
|
||||||
gFrameBuffer[line][121] = 0x12;
|
// gFrameBuffer[line][121] = 0x12;
|
||||||
gFrameBuffer[line][122] = 0x0c;
|
// gFrameBuffer[line][122] = 0x0c;
|
||||||
|
//
|
||||||
uint8_t filled = map(value, min, max, 56, 120);
|
// uint8_t filled = map(value, min, max, 56, 120);
|
||||||
|
//
|
||||||
for (uint8_t i = 56; i <= 120; i++) {
|
// for (uint8_t i = 56; i <= 120; i++) {
|
||||||
gFrameBuffer[line][i] = (i <= filled) ? 0x2d : 0x21;
|
// gFrameBuffer[line][i] = (i <= filled) ? 0x2d : 0x21;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
#endif
|
// #endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void ST7565_Init(void)
|
void ST7565_Init(void)
|
||||||
|
|||||||
@@ -27,6 +27,8 @@
|
|||||||
extern uint8_t gStatusLine[LCD_WIDTH];
|
extern uint8_t gStatusLine[LCD_WIDTH];
|
||||||
extern uint8_t gFrameBuffer[FRAME_LINES][LCD_WIDTH];
|
extern uint8_t gFrameBuffer[FRAME_LINES][LCD_WIDTH];
|
||||||
|
|
||||||
|
#define ST7565_CTR_SETTING_VAL (15)
|
||||||
|
|
||||||
void ST7565_DrawLine(const unsigned int Column, const unsigned int Line, const uint8_t *pBitmap, const unsigned int Size);
|
void ST7565_DrawLine(const unsigned int Column, const unsigned int Line, const uint8_t *pBitmap, const unsigned int Size);
|
||||||
void ST7565_BlitFullScreen(void);
|
void ST7565_BlitFullScreen(void);
|
||||||
void ST7565_BlitLine(unsigned line);
|
void ST7565_BlitLine(unsigned line);
|
||||||
|
|||||||
+31
-32
@@ -15,6 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
#include <string.h>
|
||||||
#include "bsp/dp32g030/dma.h"
|
#include "bsp/dp32g030/dma.h"
|
||||||
#include "bsp/dp32g030/syscon.h"
|
#include "bsp/dp32g030/syscon.h"
|
||||||
#include "bsp/dp32g030/uart.h"
|
#include "bsp/dp32g030/uart.h"
|
||||||
@@ -23,8 +24,7 @@
|
|||||||
static bool UART_IsLogEnabled;
|
static bool UART_IsLogEnabled;
|
||||||
uint8_t UART_DMA_Buffer[256];
|
uint8_t UART_DMA_Buffer[256];
|
||||||
|
|
||||||
void UART_Init(void)
|
void UART_Init(void) {
|
||||||
{
|
|
||||||
uint32_t Delta;
|
uint32_t Delta;
|
||||||
uint32_t Positive;
|
uint32_t Positive;
|
||||||
uint32_t Frequency;
|
uint32_t Frequency;
|
||||||
@@ -48,35 +48,32 @@ void UART_Init(void)
|
|||||||
|
|
||||||
DMA_CTR = (DMA_CTR & ~DMA_CTR_DMAEN_MASK) | DMA_CTR_DMAEN_BITS_DISABLE;
|
DMA_CTR = (DMA_CTR & ~DMA_CTR_DMAEN_MASK) | DMA_CTR_DMAEN_BITS_DISABLE;
|
||||||
|
|
||||||
DMA_CH0->MSADDR = (uint32_t)(uintptr_t)&UART1->RDR;
|
DMA_CH0->MSADDR = (uint32_t) (uintptr_t) &UART1->RDR;
|
||||||
DMA_CH0->MDADDR = (uint32_t)(uintptr_t)UART_DMA_Buffer;
|
DMA_CH0->MDADDR = (uint32_t) (uintptr_t) UART_DMA_Buffer;
|
||||||
DMA_CH0->MOD = 0
|
DMA_CH0->MOD = 0
|
||||||
// Source
|
// Source
|
||||||
| DMA_CH_MOD_MS_ADDMOD_BITS_NONE
|
| DMA_CH_MOD_MS_ADDMOD_BITS_NONE
|
||||||
| DMA_CH_MOD_MS_SIZE_BITS_8BIT
|
| DMA_CH_MOD_MS_SIZE_BITS_8BIT
|
||||||
| DMA_CH_MOD_MS_SEL_BITS_HSREQ_MS1
|
| DMA_CH_MOD_MS_SEL_BITS_HSREQ_MS1
|
||||||
// Destination
|
// Destination
|
||||||
| DMA_CH_MOD_MD_ADDMOD_BITS_INCREMENT
|
| DMA_CH_MOD_MD_ADDMOD_BITS_INCREMENT
|
||||||
| DMA_CH_MOD_MD_SIZE_BITS_8BIT
|
| DMA_CH_MOD_MD_SIZE_BITS_8BIT
|
||||||
| DMA_CH_MOD_MD_SEL_BITS_SRAM
|
| DMA_CH_MOD_MD_SEL_BITS_SRAM;
|
||||||
;
|
|
||||||
DMA_INTEN = 0;
|
DMA_INTEN = 0;
|
||||||
DMA_INTST = 0
|
DMA_INTST = 0
|
||||||
| DMA_INTST_CH0_TC_INTST_BITS_SET
|
| DMA_INTST_CH0_TC_INTST_BITS_SET
|
||||||
| DMA_INTST_CH1_TC_INTST_BITS_SET
|
| DMA_INTST_CH1_TC_INTST_BITS_SET
|
||||||
| DMA_INTST_CH2_TC_INTST_BITS_SET
|
| DMA_INTST_CH2_TC_INTST_BITS_SET
|
||||||
| DMA_INTST_CH3_TC_INTST_BITS_SET
|
| DMA_INTST_CH3_TC_INTST_BITS_SET
|
||||||
| DMA_INTST_CH0_THC_INTST_BITS_SET
|
| DMA_INTST_CH0_THC_INTST_BITS_SET
|
||||||
| DMA_INTST_CH1_THC_INTST_BITS_SET
|
| DMA_INTST_CH1_THC_INTST_BITS_SET
|
||||||
| DMA_INTST_CH2_THC_INTST_BITS_SET
|
| DMA_INTST_CH2_THC_INTST_BITS_SET
|
||||||
| DMA_INTST_CH3_THC_INTST_BITS_SET
|
| DMA_INTST_CH3_THC_INTST_BITS_SET;
|
||||||
;
|
|
||||||
DMA_CH0->CTR = 0
|
DMA_CH0->CTR = 0
|
||||||
| DMA_CH_CTR_CH_EN_BITS_ENABLE
|
| DMA_CH_CTR_CH_EN_BITS_ENABLE
|
||||||
| ((0xFF << DMA_CH_CTR_LENGTH_SHIFT) & DMA_CH_CTR_LENGTH_MASK)
|
| ((0xFF << DMA_CH_CTR_LENGTH_SHIFT) & DMA_CH_CTR_LENGTH_MASK)
|
||||||
| DMA_CH_CTR_LOOP_BITS_ENABLE
|
| DMA_CH_CTR_LOOP_BITS_ENABLE
|
||||||
| DMA_CH_CTR_PRI_BITS_MEDIUM
|
| DMA_CH_CTR_PRI_BITS_MEDIUM;
|
||||||
;
|
|
||||||
UART1->IF = UART_IF_RXTO_BITS_SET;
|
UART1->IF = UART_IF_RXTO_BITS_SET;
|
||||||
|
|
||||||
DMA_CTR = (DMA_CTR & ~DMA_CTR_DMAEN_MASK) | DMA_CTR_DMAEN_BITS_ENABLE;
|
DMA_CTR = (DMA_CTR & ~DMA_CTR_DMAEN_MASK) | DMA_CTR_DMAEN_BITS_ENABLE;
|
||||||
@@ -84,9 +81,8 @@ void UART_Init(void)
|
|||||||
UART1->CTRL |= UART_CTRL_UARTEN_BITS_ENABLE;
|
UART1->CTRL |= UART_CTRL_UARTEN_BITS_ENABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UART_Send(const void *pBuffer, uint32_t Size)
|
void UART_Send(const void *pBuffer, uint32_t Size) {
|
||||||
{
|
const uint8_t *pData = (const uint8_t *) pBuffer;
|
||||||
const uint8_t *pData = (const uint8_t *)pBuffer;
|
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
|
|
||||||
for (i = 0; i < Size; i++) {
|
for (i = 0; i < Size; i++) {
|
||||||
@@ -96,8 +92,11 @@ void UART_Send(const void *pBuffer, uint32_t Size)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UART_LogSend(const void *pBuffer, uint32_t Size)
|
void UART_String(const char *str) {
|
||||||
{
|
UART_Send(str, strlen(str));
|
||||||
|
}
|
||||||
|
|
||||||
|
void UART_LogSend(const void *pBuffer, uint32_t Size) {
|
||||||
if (UART_IsLogEnabled) {
|
if (UART_IsLogEnabled) {
|
||||||
UART_Send(pBuffer, Size);
|
UART_Send(pBuffer, Size);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ extern uint8_t UART_DMA_Buffer[256];
|
|||||||
void UART_Init(void);
|
void UART_Init(void);
|
||||||
void UART_Send(const void *pBuffer, uint32_t Size);
|
void UART_Send(const void *pBuffer, uint32_t Size);
|
||||||
void UART_LogSend(const void *pBuffer, uint32_t Size);
|
void UART_LogSend(const void *pBuffer, uint32_t Size);
|
||||||
|
void UART_String(const char *str);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Vendored
+420
-407
@@ -40,7 +40,10 @@
|
|||||||
// printf_config.h header file
|
// printf_config.h header file
|
||||||
// default: undefined
|
// default: undefined
|
||||||
#ifdef PRINTF_INCLUDE_CONFIG_H
|
#ifdef PRINTF_INCLUDE_CONFIG_H
|
||||||
#include "printf_config.h"
|
#define PRINTF_DISABLE_SUPPORT_LONG_LONG
|
||||||
|
#define PRINTF_DISABLE_SUPPORT_EXPONENTIAL
|
||||||
|
#define PRINTF_DISABLE_SUPPORT_PTRDIFF_T
|
||||||
|
#define PRINTF_DISABLE_SUPPORT_FLOAT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@@ -119,185 +122,183 @@
|
|||||||
|
|
||||||
|
|
||||||
// output function type
|
// output function type
|
||||||
typedef void (*out_fct_type)(char character, void* buffer, size_t idx, size_t maxlen);
|
typedef void (*out_fct_type)(char character, void *buffer, size_t idx, size_t maxlen);
|
||||||
|
|
||||||
|
|
||||||
// wrapper (used as buffer) for output function type
|
// wrapper (used as buffer) for output function type
|
||||||
typedef struct {
|
typedef struct {
|
||||||
void (*fct)(char character, void* arg);
|
void (*fct)(char character, void *arg);
|
||||||
void* arg;
|
|
||||||
|
void *arg;
|
||||||
} out_fct_wrap_type;
|
} out_fct_wrap_type;
|
||||||
|
|
||||||
|
|
||||||
// internal buffer output
|
// internal buffer output
|
||||||
static inline void _out_buffer(char character, void* buffer, size_t idx, size_t maxlen)
|
static inline void _out_buffer(char character, void *buffer, size_t idx, size_t maxlen) {
|
||||||
{
|
if (idx < maxlen) {
|
||||||
if (idx < maxlen) {
|
((char *) buffer)[idx] = character;
|
||||||
((char*)buffer)[idx] = character;
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// internal null output
|
// internal null output
|
||||||
static inline void _out_null(char character, void* buffer, size_t idx, size_t maxlen)
|
static inline void _out_null(char character, void *buffer, size_t idx, size_t maxlen) {
|
||||||
{
|
(void) character;
|
||||||
(void)character; (void)buffer; (void)idx; (void)maxlen;
|
(void) buffer;
|
||||||
|
(void) idx;
|
||||||
|
(void) maxlen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// internal _putchar wrapper
|
// internal _putchar wrapper
|
||||||
static inline void _out_char(char character, void* buffer, size_t idx, size_t maxlen)
|
static inline void _out_char(char character, void *buffer, size_t idx, size_t maxlen) {
|
||||||
{
|
(void) buffer;
|
||||||
(void)buffer; (void)idx; (void)maxlen;
|
(void) idx;
|
||||||
if (character) {
|
(void) maxlen;
|
||||||
_putchar(character);
|
if (character) {
|
||||||
}
|
_putchar(character);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// internal output function wrapper
|
// internal output function wrapper
|
||||||
static inline void _out_fct(char character, void* buffer, size_t idx, size_t maxlen)
|
static inline void _out_fct(char character, void *buffer, size_t idx, size_t maxlen) {
|
||||||
{
|
(void) idx;
|
||||||
(void)idx; (void)maxlen;
|
(void) maxlen;
|
||||||
if (character) {
|
if (character) {
|
||||||
// buffer is the output fct pointer
|
// buffer is the output fct pointer
|
||||||
((out_fct_wrap_type*)buffer)->fct(character, ((out_fct_wrap_type*)buffer)->arg);
|
((out_fct_wrap_type *) buffer)->fct(character, ((out_fct_wrap_type *) buffer)->arg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// internal secure strlen
|
// internal secure strlen
|
||||||
// \return The length of the string (excluding the terminating 0) limited by 'maxsize'
|
// \return The length of the string (excluding the terminating 0) limited by 'maxsize'
|
||||||
static inline unsigned int _strnlen_s(const char* str, size_t maxsize)
|
static inline unsigned int _strnlen_s(const char *str, size_t maxsize) {
|
||||||
{
|
const char *s;
|
||||||
const char* s;
|
for (s = str; *s && maxsize--; ++s);
|
||||||
for (s = str; *s && maxsize--; ++s);
|
return (unsigned int) (s - str);
|
||||||
return (unsigned int)(s - str);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// internal test if char is a digit (0-9)
|
// internal test if char is a digit (0-9)
|
||||||
// \return true if char is a digit
|
// \return true if char is a digit
|
||||||
static inline bool _is_digit(char ch)
|
static inline bool _is_digit(char ch) {
|
||||||
{
|
return (ch >= '0') && (ch <= '9');
|
||||||
return (ch >= '0') && (ch <= '9');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// internal ASCII string to unsigned int conversion
|
// internal ASCII string to unsigned int conversion
|
||||||
static unsigned int _atoi(const char** str)
|
static unsigned int _atoi(const char **str) {
|
||||||
{
|
unsigned int i = 0U;
|
||||||
unsigned int i = 0U;
|
while (_is_digit(**str)) {
|
||||||
while (_is_digit(**str)) {
|
i = i * 10U + (unsigned int) (*((*str)++) - '0');
|
||||||
i = i * 10U + (unsigned int)(*((*str)++) - '0');
|
}
|
||||||
}
|
return i;
|
||||||
return i;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// output the specified string in reverse, taking care of any zero-padding
|
// output the specified string in reverse, taking care of any zero-padding
|
||||||
static size_t _out_rev(out_fct_type out, char* buffer, size_t idx, size_t maxlen, const char* buf, size_t len, unsigned int width, unsigned int flags)
|
static size_t
|
||||||
{
|
_out_rev(out_fct_type out, char *buffer, size_t idx, size_t maxlen, const char *buf, size_t len, unsigned int width,
|
||||||
const size_t start_idx = idx;
|
unsigned int flags) {
|
||||||
|
const size_t start_idx = idx;
|
||||||
|
|
||||||
// pad spaces up to given width
|
// pad spaces up to given width
|
||||||
if (!(flags & FLAGS_LEFT) && !(flags & FLAGS_ZEROPAD)) {
|
if (!(flags & FLAGS_LEFT) && !(flags & FLAGS_ZEROPAD)) {
|
||||||
for (size_t i = len; i < width; i++) {
|
for (size_t i = len; i < width; i++) {
|
||||||
out(' ', buffer, idx++, maxlen);
|
out(' ', buffer, idx++, maxlen);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// reverse string
|
// reverse string
|
||||||
while (len) {
|
while (len) {
|
||||||
out(buf[--len], buffer, idx++, maxlen);
|
out(buf[--len], buffer, idx++, maxlen);
|
||||||
}
|
|
||||||
|
|
||||||
// append pad spaces up to given width
|
|
||||||
if (flags & FLAGS_LEFT) {
|
|
||||||
while (idx - start_idx < width) {
|
|
||||||
out(' ', buffer, idx++, maxlen);
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return idx;
|
// append pad spaces up to given width
|
||||||
|
if (flags & FLAGS_LEFT) {
|
||||||
|
while (idx - start_idx < width) {
|
||||||
|
out(' ', buffer, idx++, maxlen);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return idx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// internal itoa format
|
// internal itoa format
|
||||||
static size_t _ntoa_format(out_fct_type out, char* buffer, size_t idx, size_t maxlen, char* buf, size_t len, bool negative, unsigned int base, unsigned int prec, unsigned int width, unsigned int flags)
|
static size_t
|
||||||
{
|
_ntoa_format(out_fct_type out, char *buffer, size_t idx, size_t maxlen, char *buf, size_t len, bool negative,
|
||||||
// pad leading zeros
|
unsigned int base, unsigned int prec, unsigned int width, unsigned int flags) {
|
||||||
if (!(flags & FLAGS_LEFT)) {
|
// pad leading zeros
|
||||||
if (width && (flags & FLAGS_ZEROPAD) && (negative || (flags & (FLAGS_PLUS | FLAGS_SPACE)))) {
|
if (!(flags & FLAGS_LEFT)) {
|
||||||
width--;
|
if (width && (flags & FLAGS_ZEROPAD) && (negative || (flags & (FLAGS_PLUS | FLAGS_SPACE)))) {
|
||||||
|
width--;
|
||||||
|
}
|
||||||
|
while ((len < prec) && (len < PRINTF_NTOA_BUFFER_SIZE)) {
|
||||||
|
buf[len++] = '0';
|
||||||
|
}
|
||||||
|
while ((flags & FLAGS_ZEROPAD) && (len < width) && (len < PRINTF_NTOA_BUFFER_SIZE)) {
|
||||||
|
buf[len++] = '0';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
while ((len < prec) && (len < PRINTF_NTOA_BUFFER_SIZE)) {
|
|
||||||
buf[len++] = '0';
|
|
||||||
}
|
|
||||||
while ((flags & FLAGS_ZEROPAD) && (len < width) && (len < PRINTF_NTOA_BUFFER_SIZE)) {
|
|
||||||
buf[len++] = '0';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// handle hash
|
// handle hash
|
||||||
if (flags & FLAGS_HASH) {
|
if (flags & FLAGS_HASH) {
|
||||||
if (!(flags & FLAGS_PRECISION) && len && ((len == prec) || (len == width))) {
|
if (!(flags & FLAGS_PRECISION) && len && ((len == prec) || (len == width))) {
|
||||||
len--;
|
len--;
|
||||||
if (len && (base == 16U)) {
|
if (len && (base == 16U)) {
|
||||||
len--;
|
len--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((base == 16U) && !(flags & FLAGS_UPPERCASE) && (len < PRINTF_NTOA_BUFFER_SIZE)) {
|
if ((base == 16U) && !(flags & FLAGS_UPPERCASE) && (len < PRINTF_NTOA_BUFFER_SIZE)) {
|
||||||
buf[len++] = 'x';
|
buf[len++] = 'x';
|
||||||
}
|
} else if ((base == 16U) && (flags & FLAGS_UPPERCASE) && (len < PRINTF_NTOA_BUFFER_SIZE)) {
|
||||||
else if ((base == 16U) && (flags & FLAGS_UPPERCASE) && (len < PRINTF_NTOA_BUFFER_SIZE)) {
|
buf[len++] = 'X';
|
||||||
buf[len++] = 'X';
|
} else if ((base == 2U) && (len < PRINTF_NTOA_BUFFER_SIZE)) {
|
||||||
}
|
buf[len++] = 'b';
|
||||||
else if ((base == 2U) && (len < PRINTF_NTOA_BUFFER_SIZE)) {
|
}
|
||||||
buf[len++] = 'b';
|
if (len < PRINTF_NTOA_BUFFER_SIZE) {
|
||||||
|
buf[len++] = '0';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (len < PRINTF_NTOA_BUFFER_SIZE) {
|
if (len < PRINTF_NTOA_BUFFER_SIZE) {
|
||||||
buf[len++] = '0';
|
if (negative) {
|
||||||
|
buf[len++] = '-';
|
||||||
|
} else if (flags & FLAGS_PLUS) {
|
||||||
|
buf[len++] = '+'; // ignore the space if the '+' exists
|
||||||
|
} else if (flags & FLAGS_SPACE) {
|
||||||
|
buf[len++] = ' ';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (len < PRINTF_NTOA_BUFFER_SIZE) {
|
return _out_rev(out, buffer, idx, maxlen, buf, len, width, flags);
|
||||||
if (negative) {
|
|
||||||
buf[len++] = '-';
|
|
||||||
}
|
|
||||||
else if (flags & FLAGS_PLUS) {
|
|
||||||
buf[len++] = '+'; // ignore the space if the '+' exists
|
|
||||||
}
|
|
||||||
else if (flags & FLAGS_SPACE) {
|
|
||||||
buf[len++] = ' ';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return _out_rev(out, buffer, idx, maxlen, buf, len, width, flags);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// internal itoa for 'long' type
|
// internal itoa for 'long' type
|
||||||
static size_t _ntoa_long(out_fct_type out, char* buffer, size_t idx, size_t maxlen, unsigned long value, bool negative, unsigned long base, unsigned int prec, unsigned int width, unsigned int flags)
|
static size_t _ntoa_long(out_fct_type out, char *buffer, size_t idx, size_t maxlen, unsigned long value, bool negative,
|
||||||
{
|
unsigned long base, unsigned int prec, unsigned int width, unsigned int flags) {
|
||||||
char buf[PRINTF_NTOA_BUFFER_SIZE];
|
char buf[PRINTF_NTOA_BUFFER_SIZE];
|
||||||
size_t len = 0U;
|
size_t len = 0U;
|
||||||
|
|
||||||
// no hash for 0 values
|
// no hash for 0 values
|
||||||
if (!value) {
|
if (!value) {
|
||||||
flags &= ~FLAGS_HASH;
|
flags &= ~FLAGS_HASH;
|
||||||
}
|
}
|
||||||
|
|
||||||
// write if precision != 0 and value is != 0
|
// write if precision != 0 and value is != 0
|
||||||
if (!(flags & FLAGS_PRECISION) || value) {
|
if (!(flags & FLAGS_PRECISION) || value) {
|
||||||
do {
|
do {
|
||||||
const char digit = (char)(value % base);
|
const char digit = (char) (value % base);
|
||||||
buf[len++] = digit < 10 ? '0' + digit : (flags & FLAGS_UPPERCASE ? 'A' : 'a') + digit - 10;
|
buf[len++] = digit < 10 ? '0' + digit : (flags & FLAGS_UPPERCASE ? 'A' : 'a') + digit - 10;
|
||||||
value /= base;
|
value /= base;
|
||||||
} while (value && (len < PRINTF_NTOA_BUFFER_SIZE));
|
} while (value && (len < PRINTF_NTOA_BUFFER_SIZE));
|
||||||
}
|
}
|
||||||
|
|
||||||
return _ntoa_format(out, buffer, idx, maxlen, buf, len, negative, (unsigned int)base, prec, width, flags);
|
return _ntoa_format(out, buffer, idx, maxlen, buf, len, negative, (unsigned int) base, prec, width, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -574,341 +575,353 @@ static size_t _etoa(out_fct_type out, char* buffer, size_t idx, size_t maxlen, d
|
|||||||
|
|
||||||
|
|
||||||
// internal vsnprintf
|
// internal vsnprintf
|
||||||
static int _vsnprintf(out_fct_type out, char* buffer, const size_t maxlen, const char* format, va_list va)
|
static int _vsnprintf(out_fct_type out, char *buffer, const size_t maxlen, const char *format, va_list va) {
|
||||||
{
|
unsigned int flags, width, precision, n;
|
||||||
unsigned int flags, width, precision, n;
|
size_t idx = 0U;
|
||||||
size_t idx = 0U;
|
|
||||||
|
|
||||||
if (!buffer) {
|
if (!buffer) {
|
||||||
// use null output function
|
// use null output function
|
||||||
out = _out_null;
|
out = _out_null;
|
||||||
}
|
|
||||||
|
|
||||||
while (*format)
|
|
||||||
{
|
|
||||||
// format specifier? %[flags][width][.precision][length]
|
|
||||||
if (*format != '%') {
|
|
||||||
// no
|
|
||||||
out(*format, buffer, idx++, maxlen);
|
|
||||||
format++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// yes, evaluate it
|
|
||||||
format++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// evaluate flags
|
while (*format) {
|
||||||
flags = 0U;
|
// format specifier? %[flags][width][.precision][length]
|
||||||
do {
|
if (*format != '%') {
|
||||||
switch (*format) {
|
// no
|
||||||
case '0': flags |= FLAGS_ZEROPAD; format++; n = 1U; break;
|
out(*format, buffer, idx++, maxlen);
|
||||||
case '-': flags |= FLAGS_LEFT; format++; n = 1U; break;
|
format++;
|
||||||
case '+': flags |= FLAGS_PLUS; format++; n = 1U; break;
|
continue;
|
||||||
case ' ': flags |= FLAGS_SPACE; format++; n = 1U; break;
|
} else {
|
||||||
case '#': flags |= FLAGS_HASH; format++; n = 1U; break;
|
// yes, evaluate it
|
||||||
default : n = 0U; break;
|
format++;
|
||||||
}
|
|
||||||
} while (n);
|
|
||||||
|
|
||||||
// evaluate width field
|
|
||||||
width = 0U;
|
|
||||||
if (_is_digit(*format)) {
|
|
||||||
width = _atoi(&format);
|
|
||||||
}
|
|
||||||
else if (*format == '*') {
|
|
||||||
const int w = va_arg(va, int);
|
|
||||||
if (w < 0) {
|
|
||||||
flags |= FLAGS_LEFT; // reverse padding
|
|
||||||
width = (unsigned int)-w;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
width = (unsigned int)w;
|
|
||||||
}
|
|
||||||
format++;
|
|
||||||
}
|
|
||||||
|
|
||||||
// evaluate precision field
|
|
||||||
precision = 0U;
|
|
||||||
if (*format == '.') {
|
|
||||||
flags |= FLAGS_PRECISION;
|
|
||||||
format++;
|
|
||||||
if (_is_digit(*format)) {
|
|
||||||
precision = _atoi(&format);
|
|
||||||
}
|
|
||||||
else if (*format == '*') {
|
|
||||||
const int prec = (int)va_arg(va, int);
|
|
||||||
precision = prec > 0 ? (unsigned int)prec : 0U;
|
|
||||||
format++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// evaluate length field
|
|
||||||
switch (*format) {
|
|
||||||
case 'l' :
|
|
||||||
flags |= FLAGS_LONG;
|
|
||||||
format++;
|
|
||||||
if (*format == 'l') {
|
|
||||||
flags |= FLAGS_LONG_LONG;
|
|
||||||
format++;
|
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
case 'h' :
|
// evaluate flags
|
||||||
flags |= FLAGS_SHORT;
|
flags = 0U;
|
||||||
format++;
|
do {
|
||||||
if (*format == 'h') {
|
switch (*format) {
|
||||||
flags |= FLAGS_CHAR;
|
case '0':
|
||||||
format++;
|
flags |= FLAGS_ZEROPAD;
|
||||||
|
format++;
|
||||||
|
n = 1U;
|
||||||
|
break;
|
||||||
|
case '-':
|
||||||
|
flags |= FLAGS_LEFT;
|
||||||
|
format++;
|
||||||
|
n = 1U;
|
||||||
|
break;
|
||||||
|
case '+':
|
||||||
|
flags |= FLAGS_PLUS;
|
||||||
|
format++;
|
||||||
|
n = 1U;
|
||||||
|
break;
|
||||||
|
case ' ':
|
||||||
|
flags |= FLAGS_SPACE;
|
||||||
|
format++;
|
||||||
|
n = 1U;
|
||||||
|
break;
|
||||||
|
case '#':
|
||||||
|
flags |= FLAGS_HASH;
|
||||||
|
format++;
|
||||||
|
n = 1U;
|
||||||
|
break;
|
||||||
|
default :
|
||||||
|
n = 0U;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} while (n);
|
||||||
|
|
||||||
|
// evaluate width field
|
||||||
|
width = 0U;
|
||||||
|
if (_is_digit(*format)) {
|
||||||
|
width = _atoi(&format);
|
||||||
|
} else if (*format == '*') {
|
||||||
|
const int w = va_arg(va, int);
|
||||||
|
if (w < 0) {
|
||||||
|
flags |= FLAGS_LEFT; // reverse padding
|
||||||
|
width = (unsigned int) -w;
|
||||||
|
} else {
|
||||||
|
width = (unsigned int) w;
|
||||||
|
}
|
||||||
|
format++;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
|
// evaluate precision field
|
||||||
|
precision = 0U;
|
||||||
|
if (*format == '.') {
|
||||||
|
flags |= FLAGS_PRECISION;
|
||||||
|
format++;
|
||||||
|
if (_is_digit(*format)) {
|
||||||
|
precision = _atoi(&format);
|
||||||
|
} else if (*format == '*') {
|
||||||
|
const int prec = (int) va_arg(va, int);
|
||||||
|
precision = prec > 0 ? (unsigned int) prec : 0U;
|
||||||
|
format++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// evaluate length field
|
||||||
|
switch (*format) {
|
||||||
|
case 'l' :
|
||||||
|
flags |= FLAGS_LONG;
|
||||||
|
format++;
|
||||||
|
if (*format == 'l') {
|
||||||
|
flags |= FLAGS_LONG_LONG;
|
||||||
|
format++;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'h' :
|
||||||
|
flags |= FLAGS_SHORT;
|
||||||
|
format++;
|
||||||
|
if (*format == 'h') {
|
||||||
|
flags |= FLAGS_CHAR;
|
||||||
|
format++;
|
||||||
|
}
|
||||||
|
break;
|
||||||
#if defined(PRINTF_SUPPORT_PTRDIFF_T)
|
#if defined(PRINTF_SUPPORT_PTRDIFF_T)
|
||||||
case 't' :
|
case 't' :
|
||||||
flags |= (sizeof(ptrdiff_t) == sizeof(long) ? FLAGS_LONG : FLAGS_LONG_LONG);
|
flags |= (sizeof(ptrdiff_t) == sizeof(long) ? FLAGS_LONG : FLAGS_LONG_LONG);
|
||||||
format++;
|
format++;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case 'j' :
|
case 'j' :
|
||||||
flags |= (sizeof(intmax_t) == sizeof(long) ? FLAGS_LONG : FLAGS_LONG_LONG);
|
flags |= (sizeof(intmax_t) == sizeof(long) ? FLAGS_LONG : FLAGS_LONG_LONG);
|
||||||
format++;
|
format++;
|
||||||
break;
|
break;
|
||||||
case 'z' :
|
case 'z' :
|
||||||
flags |= (sizeof(size_t) == sizeof(long) ? FLAGS_LONG : FLAGS_LONG_LONG);
|
flags |= (sizeof(size_t) == sizeof(long) ? FLAGS_LONG : FLAGS_LONG_LONG);
|
||||||
format++;
|
format++;
|
||||||
break;
|
break;
|
||||||
default :
|
default :
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
// evaluate specifier
|
|
||||||
switch (*format) {
|
|
||||||
case 'd' :
|
|
||||||
case 'i' :
|
|
||||||
case 'u' :
|
|
||||||
case 'x' :
|
|
||||||
case 'X' :
|
|
||||||
case 'o' :
|
|
||||||
case 'b' : {
|
|
||||||
// set the base
|
|
||||||
unsigned int base;
|
|
||||||
if (*format == 'x' || *format == 'X') {
|
|
||||||
base = 16U;
|
|
||||||
}
|
|
||||||
else if (*format == 'o') {
|
|
||||||
base = 8U;
|
|
||||||
}
|
|
||||||
else if (*format == 'b') {
|
|
||||||
base = 2U;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
base = 10U;
|
|
||||||
flags &= ~FLAGS_HASH; // no hash for dec format
|
|
||||||
}
|
|
||||||
// uppercase
|
|
||||||
if (*format == 'X') {
|
|
||||||
flags |= FLAGS_UPPERCASE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// no plus or space flag for u, x, X, o, b
|
// evaluate specifier
|
||||||
if ((*format != 'i') && (*format != 'd')) {
|
switch (*format) {
|
||||||
flags &= ~(FLAGS_PLUS | FLAGS_SPACE);
|
case 'd' :
|
||||||
}
|
case 'i' :
|
||||||
|
case 'u' :
|
||||||
|
case 'x' :
|
||||||
|
case 'X' :
|
||||||
|
case 'o' :
|
||||||
|
case 'b' : {
|
||||||
|
// set the base
|
||||||
|
unsigned int base;
|
||||||
|
if (*format == 'x' || *format == 'X') {
|
||||||
|
base = 16U;
|
||||||
|
} else if (*format == 'o') {
|
||||||
|
base = 8U;
|
||||||
|
} else if (*format == 'b') {
|
||||||
|
base = 2U;
|
||||||
|
} else {
|
||||||
|
base = 10U;
|
||||||
|
flags &= ~FLAGS_HASH; // no hash for dec format
|
||||||
|
}
|
||||||
|
// uppercase
|
||||||
|
if (*format == 'X') {
|
||||||
|
flags |= FLAGS_UPPERCASE;
|
||||||
|
}
|
||||||
|
|
||||||
// ignore '0' flag when precision is given
|
// no plus or space flag for u, x, X, o, b
|
||||||
if (flags & FLAGS_PRECISION) {
|
if ((*format != 'i') && (*format != 'd')) {
|
||||||
flags &= ~FLAGS_ZEROPAD;
|
flags &= ~(FLAGS_PLUS | FLAGS_SPACE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// convert the integer
|
// ignore '0' flag when precision is given
|
||||||
if ((*format == 'i') || (*format == 'd')) {
|
if (flags & FLAGS_PRECISION) {
|
||||||
// signed
|
flags &= ~FLAGS_ZEROPAD;
|
||||||
if (flags & FLAGS_LONG_LONG) {
|
}
|
||||||
|
|
||||||
|
// convert the integer
|
||||||
|
if ((*format == 'i') || (*format == 'd')) {
|
||||||
|
// signed
|
||||||
|
if (flags & FLAGS_LONG_LONG) {
|
||||||
#if defined(PRINTF_SUPPORT_LONG_LONG)
|
#if defined(PRINTF_SUPPORT_LONG_LONG)
|
||||||
const long long value = va_arg(va, long long);
|
const long long value = va_arg(va, long long);
|
||||||
idx = _ntoa_long_long(out, buffer, idx, maxlen, (unsigned long long)(value > 0 ? value : 0 - value), value < 0, base, precision, width, flags);
|
idx = _ntoa_long_long(out, buffer, idx, maxlen, (unsigned long long)(value > 0 ? value : 0 - value), value < 0, base, precision, width, flags);
|
||||||
#endif
|
#endif
|
||||||
}
|
} else if (flags & FLAGS_LONG) {
|
||||||
else if (flags & FLAGS_LONG) {
|
const long value = va_arg(va, long);
|
||||||
const long value = va_arg(va, long);
|
idx = _ntoa_long(out, buffer, idx, maxlen, (unsigned long) (value > 0 ? value : 0 - value),
|
||||||
idx = _ntoa_long(out, buffer, idx, maxlen, (unsigned long)(value > 0 ? value : 0 - value), value < 0, base, precision, width, flags);
|
value < 0, base, precision, width, flags);
|
||||||
}
|
} else {
|
||||||
else {
|
const int value = (flags & FLAGS_CHAR) ? (char) va_arg(va, int) : (flags & FLAGS_SHORT)
|
||||||
const int value = (flags & FLAGS_CHAR) ? (char)va_arg(va, int) : (flags & FLAGS_SHORT) ? (short int)va_arg(va, int) : va_arg(va, int);
|
? (short int) va_arg(va, int)
|
||||||
idx = _ntoa_long(out, buffer, idx, maxlen, (unsigned int)(value > 0 ? value : 0 - value), value < 0, base, precision, width, flags);
|
: va_arg(va, int);
|
||||||
}
|
idx = _ntoa_long(out, buffer, idx, maxlen, (unsigned int) (value > 0 ? value : 0 - value),
|
||||||
}
|
value < 0, base, precision, width, flags);
|
||||||
else {
|
}
|
||||||
// unsigned
|
} else {
|
||||||
if (flags & FLAGS_LONG_LONG) {
|
// unsigned
|
||||||
|
if (flags & FLAGS_LONG_LONG) {
|
||||||
#if defined(PRINTF_SUPPORT_LONG_LONG)
|
#if defined(PRINTF_SUPPORT_LONG_LONG)
|
||||||
idx = _ntoa_long_long(out, buffer, idx, maxlen, va_arg(va, unsigned long long), false, base, precision, width, flags);
|
idx = _ntoa_long_long(out, buffer, idx, maxlen, va_arg(va, unsigned long long), false, base, precision, width, flags);
|
||||||
#endif
|
#endif
|
||||||
}
|
} else if (flags & FLAGS_LONG) {
|
||||||
else if (flags & FLAGS_LONG) {
|
idx = _ntoa_long(out, buffer, idx, maxlen, va_arg(va, unsigned long), false, base, precision,
|
||||||
idx = _ntoa_long(out, buffer, idx, maxlen, va_arg(va, unsigned long), false, base, precision, width, flags);
|
width, flags);
|
||||||
}
|
} else {
|
||||||
else {
|
const unsigned int value = (flags & FLAGS_CHAR) ? (unsigned char) va_arg(va, unsigned int)
|
||||||
const unsigned int value = (flags & FLAGS_CHAR) ? (unsigned char)va_arg(va, unsigned int) : (flags & FLAGS_SHORT) ? (unsigned short int)va_arg(va, unsigned int) : va_arg(va, unsigned int);
|
: (flags & FLAGS_SHORT)
|
||||||
idx = _ntoa_long(out, buffer, idx, maxlen, value, false, base, precision, width, flags);
|
? (unsigned short int) va_arg(va,
|
||||||
}
|
unsigned int)
|
||||||
}
|
: va_arg(va, unsigned int);
|
||||||
format++;
|
idx = _ntoa_long(out, buffer, idx, maxlen, value, false, base, precision, width, flags);
|
||||||
break;
|
}
|
||||||
}
|
}
|
||||||
|
format++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
#if defined(PRINTF_SUPPORT_FLOAT)
|
#if defined(PRINTF_SUPPORT_FLOAT)
|
||||||
case 'f' :
|
case 'f' :
|
||||||
case 'F' :
|
case 'F' :
|
||||||
if (*format == 'F') flags |= FLAGS_UPPERCASE;
|
if (*format == 'F') flags |= FLAGS_UPPERCASE;
|
||||||
idx = _ftoa(out, buffer, idx, maxlen, va_arg(va, double), precision, width, flags);
|
idx = _ftoa(out, buffer, idx, maxlen, va_arg(va, double), precision, width, flags);
|
||||||
format++;
|
format++;
|
||||||
break;
|
break;
|
||||||
#if defined(PRINTF_SUPPORT_EXPONENTIAL)
|
#if defined(PRINTF_SUPPORT_EXPONENTIAL)
|
||||||
case 'e':
|
case 'e':
|
||||||
case 'E':
|
case 'E':
|
||||||
case 'g':
|
case 'g':
|
||||||
case 'G':
|
case 'G':
|
||||||
if ((*format == 'g')||(*format == 'G')) flags |= FLAGS_ADAPT_EXP;
|
if ((*format == 'g')||(*format == 'G')) flags |= FLAGS_ADAPT_EXP;
|
||||||
if ((*format == 'E')||(*format == 'G')) flags |= FLAGS_UPPERCASE;
|
if ((*format == 'E')||(*format == 'G')) flags |= FLAGS_UPPERCASE;
|
||||||
idx = _etoa(out, buffer, idx, maxlen, va_arg(va, double), precision, width, flags);
|
idx = _etoa(out, buffer, idx, maxlen, va_arg(va, double), precision, width, flags);
|
||||||
format++;
|
format++;
|
||||||
break;
|
break;
|
||||||
#endif // PRINTF_SUPPORT_EXPONENTIAL
|
#endif // PRINTF_SUPPORT_EXPONENTIAL
|
||||||
#endif // PRINTF_SUPPORT_FLOAT
|
#endif // PRINTF_SUPPORT_FLOAT
|
||||||
case 'c' : {
|
case 'c' : {
|
||||||
unsigned int l = 1U;
|
unsigned int l = 1U;
|
||||||
// pre padding
|
// pre padding
|
||||||
if (!(flags & FLAGS_LEFT)) {
|
if (!(flags & FLAGS_LEFT)) {
|
||||||
while (l++ < width) {
|
while (l++ < width) {
|
||||||
out(' ', buffer, idx++, maxlen);
|
out(' ', buffer, idx++, maxlen);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// char output
|
// char output
|
||||||
out((char)va_arg(va, int), buffer, idx++, maxlen);
|
out((char) va_arg(va, int), buffer, idx++, maxlen);
|
||||||
// post padding
|
// post padding
|
||||||
if (flags & FLAGS_LEFT) {
|
if (flags & FLAGS_LEFT) {
|
||||||
while (l++ < width) {
|
while (l++ < width) {
|
||||||
out(' ', buffer, idx++, maxlen);
|
out(' ', buffer, idx++, maxlen);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
format++;
|
format++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case 's' : {
|
case 's' : {
|
||||||
const char* p = va_arg(va, char*);
|
const char *p = va_arg(va, char*);
|
||||||
unsigned int l = _strnlen_s(p, precision ? precision : (size_t)-1);
|
unsigned int l = _strnlen_s(p, precision ? precision : (size_t) -1);
|
||||||
// pre padding
|
// pre padding
|
||||||
if (flags & FLAGS_PRECISION) {
|
if (flags & FLAGS_PRECISION) {
|
||||||
l = (l < precision ? l : precision);
|
l = (l < precision ? l : precision);
|
||||||
}
|
}
|
||||||
if (!(flags & FLAGS_LEFT)) {
|
if (!(flags & FLAGS_LEFT)) {
|
||||||
while (l++ < width) {
|
while (l++ < width) {
|
||||||
out(' ', buffer, idx++, maxlen);
|
out(' ', buffer, idx++, maxlen);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// string output
|
// string output
|
||||||
while ((*p != 0) && (!(flags & FLAGS_PRECISION) || precision--)) {
|
while ((*p != 0) && (!(flags & FLAGS_PRECISION) || precision--)) {
|
||||||
out(*(p++), buffer, idx++, maxlen);
|
out(*(p++), buffer, idx++, maxlen);
|
||||||
}
|
}
|
||||||
// post padding
|
// post padding
|
||||||
if (flags & FLAGS_LEFT) {
|
if (flags & FLAGS_LEFT) {
|
||||||
while (l++ < width) {
|
while (l++ < width) {
|
||||||
out(' ', buffer, idx++, maxlen);
|
out(' ', buffer, idx++, maxlen);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
format++;
|
format++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case 'p' : {
|
case 'p' : {
|
||||||
width = sizeof(void*) * 2U;
|
width = sizeof(void *) * 2U;
|
||||||
flags |= FLAGS_ZEROPAD | FLAGS_UPPERCASE;
|
flags |= FLAGS_ZEROPAD | FLAGS_UPPERCASE;
|
||||||
#if defined(PRINTF_SUPPORT_LONG_LONG)
|
#if defined(PRINTF_SUPPORT_LONG_LONG)
|
||||||
const bool is_ll = sizeof(uintptr_t) == sizeof(long long);
|
const bool is_ll = sizeof(uintptr_t) == sizeof(long long);
|
||||||
if (is_ll) {
|
if (is_ll) {
|
||||||
idx = _ntoa_long_long(out, buffer, idx, maxlen, (uintptr_t)va_arg(va, void*), false, 16U, precision, width, flags);
|
idx = _ntoa_long_long(out, buffer, idx, maxlen, (uintptr_t)va_arg(va, void*), false, 16U, precision, width, flags);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
#endif
|
#endif
|
||||||
idx = _ntoa_long(out, buffer, idx, maxlen, (unsigned long)((uintptr_t)va_arg(va, void*)), false, 16U, precision, width, flags);
|
idx = _ntoa_long(out, buffer, idx, maxlen, (unsigned long) ((uintptr_t) va_arg(va, void*)), false, 16U,
|
||||||
|
precision, width, flags);
|
||||||
#if defined(PRINTF_SUPPORT_LONG_LONG)
|
#if defined(PRINTF_SUPPORT_LONG_LONG)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
format++;
|
format++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case '%' :
|
case '%' :
|
||||||
out('%', buffer, idx++, maxlen);
|
out('%', buffer, idx++, maxlen);
|
||||||
format++;
|
format++;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default :
|
default :
|
||||||
out(*format, buffer, idx++, maxlen);
|
out(*format, buffer, idx++, maxlen);
|
||||||
format++;
|
format++;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// termination
|
// termination
|
||||||
out((char)0, buffer, idx < maxlen ? idx : maxlen - 1U, maxlen);
|
out((char) 0, buffer, idx < maxlen ? idx : maxlen - 1U, maxlen);
|
||||||
|
|
||||||
// return written chars without terminating \0
|
// return written chars without terminating \0
|
||||||
return (int)idx;
|
return (int) idx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
int printf_(const char* format, ...)
|
int printf_(const char *format, ...) {
|
||||||
{
|
va_list va;
|
||||||
va_list va;
|
va_start(va, format);
|
||||||
va_start(va, format);
|
char buffer[1];
|
||||||
char buffer[1];
|
const int ret = _vsnprintf(_out_char, buffer, (size_t) -1, format, va);
|
||||||
const int ret = _vsnprintf(_out_char, buffer, (size_t)-1, format, va);
|
va_end(va);
|
||||||
va_end(va);
|
return ret;
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int sprintf_(char* buffer, const char* format, ...)
|
int sprintf_(char *buffer, const char *format, ...) {
|
||||||
{
|
va_list va;
|
||||||
va_list va;
|
va_start(va, format);
|
||||||
va_start(va, format);
|
const int ret = _vsnprintf(_out_buffer, buffer, (size_t) -1, format, va);
|
||||||
const int ret = _vsnprintf(_out_buffer, buffer, (size_t)-1, format, va);
|
va_end(va);
|
||||||
va_end(va);
|
return ret;
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int snprintf_(char* buffer, size_t count, const char* format, ...)
|
int snprintf_(char *buffer, size_t count, const char *format, ...) {
|
||||||
{
|
va_list va;
|
||||||
va_list va;
|
va_start(va, format);
|
||||||
va_start(va, format);
|
const int ret = _vsnprintf(_out_buffer, buffer, count, format, va);
|
||||||
const int ret = _vsnprintf(_out_buffer, buffer, count, format, va);
|
va_end(va);
|
||||||
va_end(va);
|
return ret;
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int vprintf_(const char* format, va_list va)
|
int vprintf_(const char *format, va_list va) {
|
||||||
{
|
char buffer[1];
|
||||||
char buffer[1];
|
return _vsnprintf(_out_char, buffer, (size_t) -1, format, va);
|
||||||
return _vsnprintf(_out_char, buffer, (size_t)-1, format, va);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int vsnprintf_(char* buffer, size_t count, const char* format, va_list va)
|
int vsnprintf_(char *buffer, size_t count, const char *format, va_list va) {
|
||||||
{
|
return _vsnprintf(_out_buffer, buffer, count, format, va);
|
||||||
return _vsnprintf(_out_buffer, buffer, count, format, va);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int fctprintf(void (*out)(char character, void* arg), void* arg, const char* format, ...)
|
int fctprintf(void (*out)(char character, void *arg), void *arg, const char *format, ...) {
|
||||||
{
|
va_list va;
|
||||||
va_list va;
|
va_start(va, format);
|
||||||
va_start(va, format);
|
const out_fct_wrap_type out_fct_wrap = {out, arg};
|
||||||
const out_fct_wrap_type out_fct_wrap = { out, arg };
|
const int ret = _vsnprintf(_out_fct, (char *) (uintptr_t) &out_fct_wrap, (size_t) -1, format, va);
|
||||||
const int ret = _vsnprintf(_out_fct, (char*)(uintptr_t)&out_fct_wrap, (size_t)-1, format, va);
|
va_end(va);
|
||||||
va_end(va);
|
return ret;
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
@@ -16,273 +16,6 @@
|
|||||||
|
|
||||||
#include "font.h"
|
#include "font.h"
|
||||||
|
|
||||||
// removed last and middle column which was all 0x00
|
|
||||||
// also the space char is not needed
|
|
||||||
//const uint8_t gFontBig[95 - 1][16 - 2] =
|
|
||||||
//{
|
|
||||||
//#if 0
|
|
||||||
//// {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // , 0x00}, // ' '
|
|
||||||
// {0x00, 0x00, 0x70, 0xF8, 0xF8, 0x70, 0x00, /*0x00,*/ 0x00, 0x00, 0x00, 0x1B, 0x1B, 0x00, 0x00}, // , 0x00}, // '!'
|
|
||||||
// {0x00, 0x1E, 0x3E, 0x00, 0x00, 0x3E, 0x1E, /*0x00,*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // , 0x00}, // '"'
|
|
||||||
// {0x40, 0xF0, 0xF0, 0x40, 0xF0, 0xF0, 0x40, /*0x00,*/ 0x04, 0x1F, 0x1F, 0x04, 0x1F, 0x1F, 0x04}, // , 0x00}, // '#'
|
|
||||||
// {0x70, 0xF8, 0x88, 0x8F, 0x8F, 0x98, 0x30, /*0x00,*/ 0x06, 0x0C, 0x08, 0x38, 0x38, 0x0F, 0x07}, // , 0x00}, // '$'
|
|
||||||
// {0x60, 0x60, 0x00, 0x00, 0x80, 0xC0, 0x60, /*0x00,*/ 0x18, 0x0C, 0x06, 0x03, 0x01, 0x18, 0x18}, // , 0x00}, // '%'
|
|
||||||
// {0x00, 0xB0, 0xF8, 0xC8, 0x78, 0xB0, 0x80, /*0x00,*/ 0x0F, 0x1F, 0x10, 0x11, 0x0F, 0x1F, 0x10}, // , 0x00}, // '&'
|
|
||||||
// {0x00, 0x20, 0x3E, 0x1E, 0x00, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // , 0x00}, // '''
|
|
||||||
// {0x00, 0x00, 0xE0, 0xF0, 0x18, 0x08, 0x00, /*0x00,*/ 0x00, 0x00, 0x07, 0x0F, 0x18, 0x10, 0x00}, // , 0x00}, // '('
|
|
||||||
// {0x00, 0x00, 0x08, 0x18, 0xF0, 0xE0, 0x00, /*0x00,*/ 0x00, 0x00, 0x10, 0x18, 0x0F, 0x07, 0x00}, // , 0x00}, // ')'
|
|
||||||
// {0x00, 0x40, 0xC0, 0x80, 0x80, 0xC0, 0x40, /*0x00,*/ 0x01, 0x05, 0x07, 0x03, 0x03, 0x07, 0x05}, // , 0x01}, // '*'
|
|
||||||
// {0x00, 0x00, 0x00, 0xC0, 0xC0, 0x00, 0x00, /*0x00,*/ 0x00, 0x01, 0x01, 0x07, 0x07, 0x01, 0x01}, // , 0x00}, // '+'
|
|
||||||
// {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x20, 0x3C, 0x1C, 0x00, 0x00}, // , 0x00}, // ','
|
|
||||||
// {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x00,*/ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}, // , 0x00}, // '-'
|
|
||||||
// {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00}, // , 0x00}, // '.'
|
|
||||||
// {0x00, 0x00, 0x00, 0x00, 0x80, 0xC0, 0x60, /*0x00,*/ 0x18, 0x0C, 0x06, 0x03, 0x01, 0x00, 0x00}, // , 0x00}, // '/'
|
|
||||||
// {0xF0, 0xF8, 0x08, 0x88, 0x48, 0xF8, 0xF0, /*0x00,*/ 0x0F, 0x1F, 0x12, 0x11, 0x10, 0x1F, 0x0F}, // , 0x00}, // '0'
|
|
||||||
// {0x00, 0x20, 0x30, 0xF8, 0xF8, 0x00, 0x00, /*0x00,*/ 0x00, 0x10, 0x10, 0x1F, 0x1F, 0x10, 0x10}, // , 0x00}, // '1'
|
|
||||||
// {0x10, 0x18, 0x08, 0x88, 0xC8, 0x78, 0x30, /*0x00,*/ 0x1C, 0x1E, 0x13, 0x11, 0x10, 0x18, 0x18}, // , 0x00}, // '2'
|
|
||||||
// {0x10, 0x18, 0x88, 0x88, 0x88, 0xF8, 0x70, /*0x00,*/ 0x08, 0x18, 0x10, 0x10, 0x10, 0x1F, 0x0F}, // , 0x00}, // '3'
|
|
||||||
// {0x80, 0xC0, 0x60, 0x30, 0xF8, 0xF8, 0x00, /*0x00,*/ 0x01, 0x01, 0x01, 0x11, 0x1F, 0x1F, 0x11}, // , 0x00}, // '4'
|
|
||||||
// {0xF8, 0xF8, 0x88, 0x88, 0x88, 0x88, 0x08, /*0x00,*/ 0x08, 0x18, 0x10, 0x10, 0x11, 0x1F, 0x0F}, // , 0x00}, // '5'
|
|
||||||
// {0xE0, 0xF0, 0x98, 0x88, 0x88, 0x80, 0x00, /*0x00,*/ 0x0F, 0x1F, 0x10, 0x10, 0x10, 0x1F, 0x0F}, // , 0x00}, // '6'
|
|
||||||
// {0x18, 0x18, 0x08, 0x08, 0x88, 0xF8, 0x78, /*0x00,*/ 0x00, 0x00, 0x1E, 0x1F, 0x01, 0x00, 0x00}, // , 0x00}, // '7'
|
|
||||||
// {0x70, 0xF8, 0x88, 0x88, 0x88, 0xF8, 0x70, /*0x00,*/ 0x0F, 0x1F, 0x10, 0x10, 0x10, 0x1F, 0x0F}, // , 0x00}, // '8'
|
|
||||||
// {0x70, 0xF8, 0x88, 0x88, 0x88, 0xF8, 0xF0, /*0x00,*/ 0x00, 0x10, 0x10, 0x10, 0x18, 0x0F, 0x07}, // , 0x00}, // '9'
|
|
||||||
// {0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x00, 0x0C, 0x0C, 0x00, 0x00}, // , 0x00}, // ':'
|
|
||||||
// {0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x10, 0x1C, 0x0C, 0x00, 0x00}, // , 0x00}, // ';'
|
|
||||||
// {0x00, 0x00, 0x80, 0xC0, 0x60, 0x30, 0x10, /*0x00,*/ 0x00, 0x01, 0x03, 0x06, 0x0C, 0x18, 0x10}, // , 0x00}, // '<'
|
|
||||||
// {0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, /*0x00,*/ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04}, // , 0x00}, // '='
|
|
||||||
// {0x00, 0x10, 0x30, 0x60, 0xC0, 0x80, 0x00, /*0x00,*/ 0x00, 0x10, 0x18, 0x0C, 0x06, 0x03, 0x01}, // , 0x00}, // '>'
|
|
||||||
// {0x30, 0x38, 0x08, 0x88, 0xC8, 0x78, 0x30, /*0x00,*/ 0x00, 0x00, 0x00, 0x1B, 0x1B, 0x00, 0x00}, // , 0x00}, // '?'
|
|
||||||
// {0xE0, 0xF0, 0x10, 0x90, 0x90, 0xF0, 0xE0, /*0x00,*/ 0x0F, 0x1F, 0x10, 0x17, 0x17, 0x17, 0x03}, // , 0x00}, // '@'
|
|
||||||
// {0xC0, 0xE0, 0x30, 0x18, 0x30, 0xE0, 0xC0, /*0x00,*/ 0x1F, 0x1F, 0x01, 0x01, 0x01, 0x1F, 0x1F}, // , 0x00}, // 'A'
|
|
||||||
// {0x08, 0xF8, 0xF8, 0x88, 0x88, 0xF8, 0x70, /*0x00,*/ 0x10, 0x1F, 0x1F, 0x10, 0x10, 0x1F, 0x0F}, // , 0x00}, // 'B'
|
|
||||||
// {0xE0, 0xF0, 0x18, 0x08, 0x08, 0x18, 0x30, /*0x00,*/ 0x07, 0x0F, 0x18, 0x10, 0x10, 0x18, 0x0C}, // , 0x00}, // 'C'
|
|
||||||
// {0x08, 0xF8, 0xF8, 0x08, 0x18, 0xF0, 0xE0, /*0x00,*/ 0x10, 0x1F, 0x1F, 0x10, 0x18, 0x0F, 0x07}, // , 0x00}, // 'D'
|
|
||||||
// {0x08, 0xF8, 0xF8, 0x88, 0xC8, 0x18, 0x38, /*0x00,*/ 0x10, 0x1F, 0x1F, 0x10, 0x11, 0x18, 0x1C}, // , 0x00}, // 'E'
|
|
||||||
// {0x08, 0xF8, 0xF8, 0x88, 0xC8, 0x18, 0x38, /*0x00,*/ 0x10, 0x1F, 0x1F, 0x10, 0x01, 0x00, 0x00}, // , 0x00}, // 'F'
|
|
||||||
// {0xE0, 0xF0, 0x18, 0x08, 0x08, 0x18, 0x30, /*0x00,*/ 0x07, 0x0F, 0x18, 0x11, 0x11, 0x0F, 0x1F}, // , 0x00}, // 'G'
|
|
||||||
// {0xF8, 0xF8, 0x80, 0x80, 0x80, 0xF8, 0xF8, /*0x00,*/ 0x1F, 0x1F, 0x00, 0x00, 0x00, 0x1F, 0x1F}, // , 0x00}, // 'H'
|
|
||||||
// {0x00, 0x00, 0x08, 0xF8, 0xF8, 0x08, 0x00, /*0x00,*/ 0x00, 0x00, 0x10, 0x1F, 0x1F, 0x10, 0x00}, // , 0x00}, // 'I'
|
|
||||||
// {0x00, 0x00, 0x00, 0x08, 0xF8, 0xF8, 0x08, /*0x00,*/ 0x0E, 0x1E, 0x10, 0x10, 0x1F, 0x0F, 0x00}, // , 0x00}, // 'J'
|
|
||||||
// {0x08, 0xF8, 0xF8, 0x80, 0xE0, 0x78, 0x18, /*0x00,*/ 0x10, 0x1F, 0x1F, 0x01, 0x03, 0x1E, 0x1C}, // , 0x00}, // 'K'
|
|
||||||
// {0x08, 0xF8, 0xF8, 0x08, 0x00, 0x00, 0x00, /*0x00,*/ 0x10, 0x1F, 0x1F, 0x10, 0x10, 0x18, 0x1C}, // , 0x00}, // 'L'
|
|
||||||
// {0xF8, 0xF8, 0x70, 0xE0, 0x70, 0xF8, 0xF8, /*0x00,*/ 0x1F, 0x1F, 0x00, 0x00, 0x00, 0x1F, 0x1F}, // , 0x00}, // 'M'
|
|
||||||
// {0xF8, 0xF8, 0x70, 0xE0, 0xC0, 0xF8, 0xF8, /*0x00,*/ 0x1F, 0x1F, 0x00, 0x00, 0x01, 0x1F, 0x1F}, // , 0x00}, // 'N'
|
|
||||||
// {0xE0, 0xF0, 0x18, 0x08, 0x18, 0xF0, 0xE0, /*0x00,*/ 0x07, 0x0F, 0x18, 0x10, 0x18, 0x0F, 0x07}, // , 0x00}, // 'O'
|
|
||||||
// {0x08, 0xF8, 0xF8, 0x88, 0x88, 0xF8, 0x70, /*0x00,*/ 0x10, 0x1F, 0x1F, 0x10, 0x00, 0x00, 0x00}, // , 0x00}, // 'P'
|
|
||||||
// {0xF0, 0xF8, 0x08, 0x08, 0x08, 0xF8, 0xF0, /*0x00,*/ 0x0F, 0x1F, 0x10, 0x1C, 0x78, 0x7F, 0x4F}, // , 0x00}, // 'Q'
|
|
||||||
// {0x08, 0xF8, 0xF8, 0x88, 0x88, 0xF8, 0x70, /*0x00,*/ 0x10, 0x1F, 0x1F, 0x00, 0x01, 0x1F, 0x1E}, // , 0x00}, // 'R'
|
|
||||||
// {0x30, 0x78, 0xC8, 0x88, 0x88, 0x38, 0x30, /*0x00,*/ 0x0C, 0x1C, 0x10, 0x10, 0x11, 0x1F, 0x0E}, // , 0x00}, // 'S'
|
|
||||||
// {0x00, 0x38, 0x18, 0xF8, 0xF8, 0x18, 0x38, /*0x00,*/ 0x00, 0x00, 0x10, 0x1F, 0x1F, 0x10, 0x00}, // , 0x00}, // 'T'
|
|
||||||
// {0xF8, 0xF8, 0x00, 0x00, 0x00, 0xF8, 0xF8, /*0x00,*/ 0x0F, 0x1F, 0x10, 0x10, 0x10, 0x1F, 0x0F}, // , 0x00}, // 'U'
|
|
||||||
// {0xF8, 0xF8, 0x00, 0x00, 0x00, 0xF8, 0xF8, /*0x00,*/ 0x03, 0x07, 0x0C, 0x18, 0x0C, 0x07, 0x03}, // , 0x00}, // 'V'
|
|
||||||
// {0xF8, 0xF8, 0x00, 0x00, 0x00, 0xF8, 0xF8, /*0x00,*/ 0x07, 0x1F, 0x1C, 0x07, 0x1C, 0x1F, 0x07}, // , 0x00}, // 'W'
|
|
||||||
// {0x18, 0x78, 0xE0, 0x80, 0xE0, 0x78, 0x18, /*0x00,*/ 0x18, 0x1E, 0x07, 0x01, 0x07, 0x1E, 0x18}, // , 0x00}, // 'X'
|
|
||||||
// {0x00, 0x78, 0xF8, 0x80, 0x80, 0xF8, 0x78, /*0x00,*/ 0x00, 0x00, 0x10, 0x1F, 0x1F, 0x10, 0x00}, // , 0x00}, // 'Y'
|
|
||||||
// {0x38, 0x18, 0x08, 0x88, 0xC8, 0x78, 0x38, /*0x00,*/ 0x1C, 0x1E, 0x13, 0x11, 0x10, 0x18, 0x1C}, // , 0x00}, // 'Z'
|
|
||||||
// {0x00, 0x00, 0xF8, 0xF8, 0x08, 0x08, 0x00, /*0x00,*/ 0x00, 0x00, 0x1F, 0x1F, 0x10, 0x10, 0x00}, // , 0x00}, // '['
|
|
||||||
// {0x70, 0xE0, 0xC0, 0x80, 0x00, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x01, 0x03, 0x07, 0x0E, 0x1C}, // , 0x00}, // '"\'
|
|
||||||
// {0x00, 0x00, 0x08, 0x08, 0xF8, 0xF8, 0x00, /*0x00,*/ 0x00, 0x00, 0x10, 0x10, 0x1F, 0x1F, 0x00}, // , 0x00}, // ']'
|
|
||||||
// {0x10, 0x18, 0x0E, 0x07, 0x0E, 0x18, 0x10, /*0x00,*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // , 0x00}, // '^'
|
|
||||||
// {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x00,*/ 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40}, // , 0x40}, // '_'
|
|
||||||
// {0x00, 0x00, 0x07, 0x0F, 0x08, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // , 0x00}, // '`'
|
|
||||||
// {0x00, 0x40, 0x40, 0x40, 0xC0, 0x80, 0x00, /*0x00,*/ 0x0E, 0x1F, 0x11, 0x11, 0x0F, 0x1F, 0x10}, // , 0x00}, // 'a'
|
|
||||||
// {0x08, 0xF8, 0xF8, 0x40, 0xC0, 0x80, 0x00, /*0x00,*/ 0x10, 0x1F, 0x0F, 0x10, 0x10, 0x1F, 0x0F}, // , 0x00}, // 'b'
|
|
||||||
// {0x80, 0xC0, 0x40, 0x40, 0x40, 0xC0, 0x80, /*0x00,*/ 0x0F, 0x1F, 0x10, 0x10, 0x10, 0x18, 0x08}, // , 0x00}, // 'c'
|
|
||||||
// {0x00, 0x80, 0xC0, 0x48, 0xF8, 0xF8, 0x00, /*0x00,*/ 0x0F, 0x1F, 0x10, 0x10, 0x0F, 0x1F, 0x10}, // , 0x00}, // 'd'
|
|
||||||
// {0x80, 0xC0, 0x40, 0x40, 0x40, 0xC0, 0x80, /*0x00,*/ 0x0F, 0x1F, 0x11, 0x11, 0x11, 0x19, 0x09}, // , 0x00}, // 'e'
|
|
||||||
// {0x80, 0xF0, 0xF8, 0x88, 0x18, 0x30, 0x00, /*0x00,*/ 0x10, 0x1F, 0x1F, 0x10, 0x00, 0x00, 0x00}, // , 0x00}, // 'f'
|
|
||||||
// {0x80, 0xC0, 0x40, 0x40, 0x80, 0xC0, 0x40, /*0x00,*/ 0x4F, 0xDF, 0x90, 0x90, 0xFF, 0x7F, 0x00}, // , 0x00}, // 'g'
|
|
||||||
// {0x08, 0xF8, 0xF8, 0x80, 0x40, 0xC0, 0x80, /*0x00,*/ 0x10, 0x1F, 0x1F, 0x00, 0x00, 0x1F, 0x1F}, // , 0x00}, // 'h'
|
|
||||||
// {0x00, 0x00, 0x40, 0xD8, 0xD8, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x10, 0x1F, 0x1F, 0x10, 0x00}, // , 0x00}, // 'i'
|
|
||||||
// {0x00, 0x00, 0x00, 0x00, 0x40, 0xD8, 0xD8, /*0x00,*/ 0x00, 0x60, 0xE0, 0x80, 0x80, 0xFF, 0x7F}, // , 0x00}, // 'j'
|
|
||||||
// {0x08, 0xF8, 0xF8, 0x00, 0x80, 0xC0, 0x40, /*0x00,*/ 0x10, 0x1F, 0x1F, 0x03, 0x07, 0x1C, 0x18}, // , 0x00}, // 'k'
|
|
||||||
// {0x00, 0x00, 0x08, 0xF8, 0xF8, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x10, 0x1F, 0x1F, 0x10, 0x00}, // , 0x00}, // 'l'
|
|
||||||
// {0xC0, 0xC0, 0xC0, 0x80, 0xC0, 0xC0, 0x80, /*0x00,*/ 0x1F, 0x1F, 0x00, 0x1F, 0x00, 0x1F, 0x1F}, // , 0x00}, // 'm'
|
|
||||||
// {0x40, 0xC0, 0x80, 0x40, 0x40, 0xC0, 0x80, /*0x00,*/ 0x00, 0x1F, 0x1F, 0x00, 0x00, 0x1F, 0x1F}, // , 0x00}, // 'n'
|
|
||||||
// {0x80, 0xC0, 0x40, 0x40, 0x40, 0xC0, 0x80, /*0x00,*/ 0x0F, 0x1F, 0x10, 0x10, 0x10, 0x1F, 0x0F}, // , 0x00}, // 'o'
|
|
||||||
// {0x40, 0xC0, 0x80, 0x40, 0x40, 0xC0, 0x80, /*0x00,*/ 0x80, 0xFF, 0xFF, 0x90, 0x10, 0x1F, 0x0F}, // , 0x00}, // 'p'
|
|
||||||
// {0x80, 0xC0, 0x40, 0x40, 0x80, 0xC0, 0x40, /*0x00,*/ 0x0F, 0x1F, 0x10, 0x90, 0xFF, 0xFF, 0x80}, // , 0x00}, // 'q'
|
|
||||||
// {0x40, 0xC0, 0x80, 0xC0, 0x40, 0xC0, 0x80, /*0x00,*/ 0x10, 0x1F, 0x1F, 0x10, 0x00, 0x00, 0x01}, // , 0x00}, // 'r'
|
|
||||||
// {0x80, 0xC0, 0x40, 0x40, 0x40, 0xC0, 0x80, /*0x00,*/ 0x08, 0x19, 0x13, 0x12, 0x16, 0x1C, 0x08}, // , 0x00}, // 's'
|
|
||||||
// {0x40, 0x40, 0xF0, 0xF8, 0x40, 0x40, 0x00, /*0x00,*/ 0x00, 0x00, 0x0F, 0x1F, 0x10, 0x18, 0x08}, // , 0x00}, // 't'
|
|
||||||
// {0xC0, 0xC0, 0x00, 0x00, 0xC0, 0xC0, 0x00, /*0x00,*/ 0x0F, 0x1F, 0x10, 0x10, 0x0F, 0x1F, 0x10}, // , 0x00}, // 'u'
|
|
||||||
// {0x00, 0xC0, 0xC0, 0x00, 0x00, 0xC0, 0xC0, /*0x00,*/ 0x00, 0x07, 0x0F, 0x18, 0x18, 0x0F, 0x07}, // , 0x00}, // 'v'
|
|
||||||
// {0xC0, 0xC0, 0x00, 0x00, 0x00, 0xC0, 0xC0, /*0x00,*/ 0x0F, 0x1F, 0x18, 0x0E, 0x18, 0x1F, 0x0F}, // , 0x00}, // 'w'
|
|
||||||
// {0x40, 0xC0, 0x80, 0x00, 0x80, 0xC0, 0x40, /*0x00,*/ 0x10, 0x18, 0x0F, 0x07, 0x0F, 0x18, 0x10}, // , 0x00}, // 'x'
|
|
||||||
// {0xC0, 0xC0, 0x00, 0x00, 0x00, 0xC0, 0xC0, /*0x00,*/ 0x8F, 0x9F, 0x90, 0x90, 0xD0, 0x7F, 0x3F}, // , 0x00}, // 'y'
|
|
||||||
// {0xC0, 0xC0, 0x40, 0x40, 0xC0, 0xC0, 0x40, /*0x00,*/ 0x18, 0x1C, 0x16, 0x13, 0x11, 0x18, 0x18}, // , 0x00}, // 'z'
|
|
||||||
// {0x00, 0x80, 0x80, 0xF0, 0x78, 0x08, 0x08, /*0x00,*/ 0x00, 0x00, 0x00, 0x0F, 0x1F, 0x10, 0x10}, // , 0x00}, // '{'
|
|
||||||
// {0x00, 0x00, 0x00, 0x78, 0x78, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x00, 0x1F, 0x1F, 0x00, 0x00}, // , 0x00}, // '|'
|
|
||||||
// {0x00, 0x08, 0x08, 0x78, 0xF0, 0x80, 0x80, /*0x00,*/ 0x00, 0x10, 0x10, 0x1F, 0x0F, 0x00, 0x00}, // , 0x00}, // '}'
|
|
||||||
// {0x10, 0x18, 0x08, 0x18, 0x10, 0x18, 0x08, /*0x00,*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} // , 0x00} // '->'
|
|
||||||
//#else
|
|
||||||
// // {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // ' '
|
|
||||||
// {0x00, 0x00, 0x00, 0xFC, 0xFC, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x00, 0x00}, // '!'
|
|
||||||
// {0x00, 0x0F, 0x1F, 0x00, 0x00, 0x1F, 0x0F, /*0x00,*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // '"'
|
|
||||||
// {0x20, 0xF8, 0xF8, 0x20, 0xF8, 0xF8, 0x20, /*0x00,*/ 0x02, 0x0F, 0x0F, 0x02, 0x0F, 0x0F, 0x02}, // '#'
|
|
||||||
// {0x70, 0xF8, 0x88, 0x8E, 0x8E, 0x98, 0x10, /*0x00,*/ 0x04, 0x0C, 0x08, 0x38, 0x38, 0x0F, 0x07}, // '$'
|
|
||||||
// {0x30, 0x30, 0x00, 0x80, 0xC0, 0x60, 0x30, /*0x00,*/ 0x0C, 0x06, 0x03, 0x01, 0x00, 0x0C, 0x0C}, // '%'
|
|
||||||
// {0x80, 0xD8, 0x7C, 0xE4, 0xBC, 0xD8, 0x40, /*0x00,*/ 0x07, 0x0F, 0x08, 0x08, 0x07, 0x0F, 0x08}, // '&'
|
|
||||||
// {0x00, 0x10, 0x1F, 0x0F, 0x00, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // '''
|
|
||||||
// {0x00, 0x00, 0xF0, 0xF8, 0x0C, 0x04, 0x00, /*0x00,*/ 0x00, 0x00, 0x03, 0x07, 0x0C, 0x08, 0x00}, // '('
|
|
||||||
// {0x00, 0x00, 0x04, 0x0C, 0xF8, 0xF0, 0x00, /*0x00,*/ 0x00, 0x00, 0x08, 0x0C, 0x07, 0x03, 0x00}, // ')'
|
|
||||||
// {0x00, 0x80, 0xA0, 0xE0, 0xC0, 0xE0, 0xA0, /*0x80,*/ 0x00, 0x00, 0x02, 0x03, 0x01, 0x03, 0x02}, // '*'
|
|
||||||
// {0x00, 0x80, 0x80, 0xE0, 0xE0, 0x80, 0x80, /*0x00,*/ 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00}, // '+'
|
|
||||||
// {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x10, 0x1E, 0x0E, 0x00, 0x00}, // ','
|
|
||||||
// {0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, /*0x00,*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // '-'
|
|
||||||
// {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x00, 0x0C, 0x0C, 0x00, 0x00}, // '.'
|
|
||||||
// {0x00, 0x00, 0x00, 0x80, 0xC0, 0x60, 0x30, /*0x00,*/ 0x0C, 0x06, 0x03, 0x01, 0x00, 0x00, 0x00}, // '/'
|
|
||||||
// {0xF8, 0xFC, 0x04, 0x04, 0x04, 0xFC, 0xF8, /*0x00,*/ 0x07, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x07}, // '0'
|
|
||||||
// {0x00, 0x10, 0x18, 0xFC, 0xFC, 0x00, 0x00, /*0x00,*/ 0x00, 0x08, 0x08, 0x0F, 0x0F, 0x08, 0x08}, // '1'
|
|
||||||
// {0x18, 0x1C, 0x04, 0x84, 0xC4, 0x7C, 0x38, /*0x00,*/ 0x0C, 0x0E, 0x0B, 0x09, 0x08, 0x08, 0x08}, // '2'
|
|
||||||
// {0x18, 0x1C, 0x44, 0x44, 0x44, 0xFC, 0xB8, /*0x00,*/ 0x06, 0x0E, 0x08, 0x08, 0x08, 0x0F, 0x07}, // '3'
|
|
||||||
// {0x80, 0xC0, 0x60, 0x30, 0x18, 0xFC, 0xFC, /*0x00,*/ 0x01, 0x01, 0x01, 0x01, 0x01, 0x0F, 0x0F}, // '4'
|
|
||||||
// {0x7C, 0x7C, 0x44, 0x44, 0x44, 0xC4, 0x84, /*0x00,*/ 0x04, 0x0C, 0x08, 0x08, 0x08, 0x0F, 0x07}, // '5'
|
|
||||||
// {0xF0, 0xF8, 0x4C, 0x44, 0x44, 0xC4, 0x80, /*0x00,*/ 0x07, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x07}, // '6'
|
|
||||||
// {0x04, 0x04, 0x04, 0x84, 0xE4, 0x7C, 0x1C, /*0x00,*/ 0x00, 0x00, 0x0E, 0x0F, 0x01, 0x00, 0x00}, // '7'
|
|
||||||
// {0xB8, 0xFC, 0x44, 0x44, 0x44, 0xFC, 0xB8, /*0x00,*/ 0x07, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x07}, // '8'
|
|
||||||
// {0x78, 0xFC, 0x84, 0x84, 0x84, 0xFC, 0xF8, /*0x00,*/ 0x00, 0x08, 0x08, 0x08, 0x0C, 0x07, 0x03}, // '9'
|
|
||||||
// {0x00, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x00, 0x06, 0x06, 0x00, 0x00}, // ':'
|
|
||||||
// {0x00, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x08, 0x0E, 0x06, 0x00, 0x00}, // ';'
|
|
||||||
// {0x00, 0x80, 0xC0, 0x60, 0x30, 0x18, 0x08, /*0x00,*/ 0x00, 0x00, 0x01, 0x03, 0x06, 0x0C, 0x08}, // '<'
|
|
||||||
// {0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, /*0x00,*/ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}, // '='
|
|
||||||
// {0x00, 0x08, 0x18, 0x30, 0x60, 0xC0, 0x80, /*0x00,*/ 0x00, 0x08, 0x0C, 0x06, 0x03, 0x01, 0x00}, // '>'
|
|
||||||
// {0x38, 0x3C, 0x04, 0x84, 0xC4, 0x7C, 0x38, /*0x00,*/ 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x00, 0x00}, // '?'
|
|
||||||
// {0xF0, 0xF8, 0x08, 0xC8, 0xC8, 0xF8, 0xF0, /*0x00,*/ 0x07, 0x0F, 0x08, 0x0B, 0x0B, 0x0B, 0x01}, // '@'
|
|
||||||
// {0xF8, 0xFC, 0x84, 0x84, 0x84, 0xFC, 0xF8, /*0x00,*/ 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x0F}, // 'A'
|
|
||||||
// {0xFC, 0xFC, 0x44, 0x44, 0x44, 0xFC, 0xB8, /*0x00,*/ 0x0F, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x07}, // 'B'
|
|
||||||
// {0xF8, 0xFC, 0x04, 0x04, 0x04, 0x1C, 0x18, /*0x00,*/ 0x07, 0x0F, 0x08, 0x08, 0x08, 0x0E, 0x06}, // 'C'
|
|
||||||
// {0xFC, 0xFC, 0x04, 0x04, 0x0C, 0xF8, 0xF0, /*0x00,*/ 0x0F, 0x0F, 0x08, 0x08, 0x0C, 0x07, 0x03}, // 'D'
|
|
||||||
// {0xFC, 0xFC, 0x44, 0x44, 0x44, 0x04, 0x04, /*0x00,*/ 0x0F, 0x0F, 0x08, 0x08, 0x08, 0x08, 0x08}, // 'E'
|
|
||||||
// {0xFC, 0xFC, 0x44, 0x44, 0x44, 0x04, 0x04, /*0x00,*/ 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00}, // 'F'
|
|
||||||
// {0xF8, 0xFC, 0x04, 0x84, 0x84, 0x9C, 0x98, /*0x00,*/ 0x07, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x07}, // 'G'
|
|
||||||
// {0xFC, 0xFC, 0x40, 0x40, 0x40, 0xFC, 0xFC, /*0x00,*/ 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x0F}, // 'H'
|
|
||||||
// {0x00, 0x00, 0x04, 0xFC, 0xFC, 0x04, 0x00, /*0x00,*/ 0x00, 0x00, 0x08, 0x0F, 0x0F, 0x08, 0x00}, // 'I'
|
|
||||||
// {0x00, 0x00, 0x00, 0x04, 0xFC, 0xFC, 0x04, /*0x00,*/ 0x06, 0x0E, 0x08, 0x08, 0x0F, 0x07, 0x00}, // 'J'
|
|
||||||
// {0xFC, 0xFC, 0xE0, 0x30, 0x18, 0x0C, 0x04, /*0x00,*/ 0x0F, 0x0F, 0x01, 0x03, 0x06, 0x0C, 0x08}, // 'K'
|
|
||||||
// {0xFC, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x00,*/ 0x0F, 0x0F, 0x08, 0x08, 0x08, 0x08, 0x08}, // 'L'
|
|
||||||
// {0xFC, 0xFC, 0x18, 0x70, 0x18, 0xFC, 0xFC, /*0x00,*/ 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x0F}, // 'M'
|
|
||||||
// {0xFC, 0xFC, 0x60, 0xC0, 0x80, 0xFC, 0xFC, /*0x00,*/ 0x0F, 0x0F, 0x00, 0x00, 0x01, 0x0F, 0x0F}, // 'N'
|
|
||||||
// {0xF8, 0xFC, 0x04, 0x04, 0x04, 0xFC, 0xF8, /*0x00,*/ 0x07, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x07}, // 'O'
|
|
||||||
// {0xFC, 0xFC, 0x84, 0x84, 0x84, 0xFC, 0x78, /*0x00,*/ 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00}, // 'P'
|
|
||||||
// {0xF8, 0xFC, 0x04, 0x04, 0x04, 0xFC, 0xF8, /*0x00,*/ 0x07, 0x0F, 0x08, 0x0C, 0x0C, 0x1F, 0x17}, // 'Q'
|
|
||||||
// {0xFC, 0xFC, 0x84, 0x84, 0x84, 0xFC, 0x78, /*0x00,*/ 0x0F, 0x0F, 0x01, 0x03, 0x06, 0x0C, 0x08}, // 'R'
|
|
||||||
// {0x38, 0x7C, 0x44, 0x44, 0x44, 0xCC, 0x88, /*0x00,*/ 0x06, 0x0E, 0x08, 0x08, 0x08, 0x0F, 0x07}, // 'S'
|
|
||||||
// {0x00, 0x04, 0x04, 0xFC, 0xFC, 0x04, 0x04, /*0x00,*/ 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x00, 0x00}, // 'T'
|
|
||||||
// {0xFC, 0xFC, 0x00, 0x00, 0x00, 0xFC, 0xFC, /*0x00,*/ 0x07, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x07}, // 'U'
|
|
||||||
// {0x7C, 0xFC, 0x80, 0x00, 0x80, 0xFC, 0x7C, /*0x00,*/ 0x00, 0x03, 0x0F, 0x0C, 0x0F, 0x03, 0x00}, // 'V'
|
|
||||||
// {0xFC, 0xFC, 0x00, 0x80, 0x00, 0xFC, 0xFC, /*0x00,*/ 0x0F, 0x0F, 0x06, 0x03, 0x06, 0x0F, 0x0F}, // 'W'
|
|
||||||
// {0x0C, 0x3C, 0xF0, 0xC0, 0xF0, 0x3C, 0x0C, /*0x00,*/ 0x0C, 0x0F, 0x03, 0x00, 0x03, 0x0F, 0x0C}, // 'X'
|
|
||||||
// {0x00, 0x3C, 0x7C, 0xC0, 0xC0, 0x7C, 0x3C, /*0x00,*/ 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x00, 0x00}, // 'Y'
|
|
||||||
// {0x04, 0x04, 0x84, 0xC4, 0x64, 0x3C, 0x1C, /*0x00,*/ 0x0E, 0x0F, 0x09, 0x08, 0x08, 0x08, 0x08}, // 'Z'
|
|
||||||
// {0x00, 0x00, 0xFC, 0xFC, 0x04, 0x04, 0x00, /*0x00,*/ 0x00, 0x00, 0x0F, 0x0F, 0x08, 0x08, 0x00}, // '['
|
|
||||||
// {0x38, 0x70, 0xE0, 0xC0, 0x80, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x00, 0x01, 0x03, 0x07, 0x0E}, // '"\'
|
|
||||||
// {0x00, 0x00, 0x04, 0x04, 0xFC, 0xFC, 0x00, /*0x00,*/ 0x00, 0x00, 0x08, 0x08, 0x0F, 0x0F, 0x00}, // ']'
|
|
||||||
// {0x08, 0x0C, 0x06, 0x03, 0x06, 0x0C, 0x08, /*0x00,*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // '^'
|
|
||||||
// {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x00,*/ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20}, // '_'
|
|
||||||
// {0x00, 0x00, 0x03, 0x07, 0x04, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // '`'
|
|
||||||
// {0x00, 0xA0, 0xA0, 0xA0, 0xA0, 0xE0, 0xC0, /*0x00,*/ 0x07, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x0F}, // 'a'
|
|
||||||
// {0xFC, 0xFC, 0x20, 0x20, 0x20, 0xE0, 0xC0, /*0x00,*/ 0x0F, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x07}, // 'b'
|
|
||||||
// {0xC0, 0xE0, 0x20, 0x20, 0x20, 0x60, 0x40, /*0x00,*/ 0x07, 0x0F, 0x08, 0x08, 0x08, 0x0C, 0x04}, // 'c'
|
|
||||||
// {0xC0, 0xE0, 0x20, 0x20, 0x20, 0xFC, 0xFC, /*0x00,*/ 0x07, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x0F}, // 'd'
|
|
||||||
// {0xC0, 0xE0, 0x20, 0x20, 0x20, 0xE0, 0xC0, /*0x00,*/ 0x07, 0x0F, 0x09, 0x09, 0x09, 0x09, 0x01}, // 'e'
|
|
||||||
// {0x20, 0x20, 0xF8, 0xFC, 0x24, 0x24, 0x04, /*0x00,*/ 0x00, 0x00, 0x0F, 0x0F, 0x00, 0x00, 0x00}, // 'f'
|
|
||||||
// {0xC0, 0xE0, 0x20, 0x20, 0x20, 0xE0, 0xE0, /*0x00,*/ 0x07, 0x4F, 0x48, 0x48, 0x48, 0x7F, 0x3F}, // 'g'
|
|
||||||
// {0xFC, 0xFC, 0x20, 0x20, 0x20, 0xE0, 0xC0, /*0x00,*/ 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x0F}, // 'h'
|
|
||||||
// {0x00, 0x00, 0x20, 0xEC, 0xEC, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x08, 0x0F, 0x0F, 0x08, 0x00}, // 'i'
|
|
||||||
// {0x00, 0x00, 0x00, 0x00, 0x20, 0xEC, 0xEC, /*0x00,*/ 0x00, 0x30, 0x70, 0x40, 0x40, 0x7F, 0x3F}, // 'j'
|
|
||||||
// {0xFC, 0xFC, 0x00, 0x80, 0xC0, 0x60, 0x20, /*0x00,*/ 0x0F, 0x0F, 0x01, 0x03, 0x06, 0x0C, 0x08}, // 'k'
|
|
||||||
// {0x00, 0x00, 0x04, 0xFC, 0xFC, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x08, 0x0F, 0x0F, 0x08, 0x00}, // 'l'
|
|
||||||
// {0xE0, 0xE0, 0x20, 0xE0, 0x20, 0xE0, 0xC0, /*0x00,*/ 0x0F, 0x0F, 0x00, 0x0F, 0x00, 0x0F, 0x0F}, // 'm'
|
|
||||||
// {0xE0, 0xE0, 0x20, 0x20, 0x20, 0xE0, 0xC0, /*0x00,*/ 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x0F}, // 'n'
|
|
||||||
// {0xC0, 0xE0, 0x20, 0x20, 0x20, 0xE0, 0xC0, /*0x00,*/ 0x07, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x07}, // 'o'
|
|
||||||
// {0xE0, 0xE0, 0x20, 0x20, 0x20, 0xE0, 0xC0, /*0x00,*/ 0x7F, 0x7F, 0x08, 0x08, 0x08, 0x0F, 0x07}, // 'p'
|
|
||||||
// {0xC0, 0xE0, 0x20, 0x20, 0x20, 0xE0, 0xE0, /*0x00,*/ 0x07, 0x0F, 0x08, 0x08, 0x08, 0x7F, 0x7F}, // 'q'
|
|
||||||
// {0xE0, 0xE0, 0x60, 0x20, 0x20, 0x20, 0x20, /*0x00,*/ 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00}, // 'r'
|
|
||||||
// {0xC0, 0xE0, 0x20, 0x20, 0x20, 0x20, 0x20, /*0x00,*/ 0x08, 0x09, 0x09, 0x09, 0x09, 0x0F, 0x06}, // 's'
|
|
||||||
// {0x20, 0x20, 0xFC, 0xFC, 0x20, 0x20, 0x00, /*0x00,*/ 0x00, 0x00, 0x07, 0x0F, 0x08, 0x08, 0x08}, // 't'
|
|
||||||
// {0xE0, 0xE0, 0x00, 0x00, 0x00, 0xE0, 0xE0, /*0x00,*/ 0x07, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x0F}, // 'u'
|
|
||||||
// {0xE0, 0xE0, 0x00, 0x00, 0x00, 0xE0, 0xE0, /*0x00,*/ 0x00, 0x03, 0x0F, 0x0C, 0x0F, 0x03, 0x00}, // 'v'
|
|
||||||
// {0xE0, 0xE0, 0x00, 0x80, 0x00, 0xE0, 0xE0, /*0x00,*/ 0x07, 0x0F, 0x08, 0x0F, 0x08, 0x0F, 0x07}, // 'w'
|
|
||||||
// {0x60, 0xE0, 0x80, 0x00, 0x80, 0xE0, 0x60, /*0x00,*/ 0x0C, 0x0E, 0x03, 0x01, 0x03, 0x0E, 0x0C}, // 'x'
|
|
||||||
// {0xE0, 0xE0, 0x00, 0x00, 0x00, 0xE0, 0xE0, /*0x00,*/ 0x07, 0x4F, 0x48, 0x48, 0x48, 0x7F, 0x3F}, // 'y'
|
|
||||||
// {0x20, 0x20, 0x20, 0xA0, 0xE0, 0x60, 0x20, /*0x00,*/ 0x0C, 0x0E, 0x0B, 0x09, 0x08, 0x08, 0x08}, // 'z'
|
|
||||||
// {0x00, 0x00, 0x40, 0xF8, 0xBC, 0x04, 0x04, /*0x00,*/ 0x00, 0x00, 0x00, 0x07, 0x0F, 0x08, 0x08}, // '{'
|
|
||||||
// {0x00, 0x00, 0x00, 0xBC, 0xBC, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x00, 0x00}, // '|'
|
|
||||||
// {0x00, 0x04, 0x04, 0xBC, 0xF8, 0x40, 0x00, /*0x00,*/ 0x00, 0x08, 0x08, 0x0F, 0x07, 0x00, 0x00}, // '}'
|
|
||||||
// {0x08, 0x0C, 0x04, 0x0C, 0x08, 0x0C, 0x04, /*0x00,*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} // '->'
|
|
||||||
//#endif
|
|
||||||
//};
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
// original font
|
|
||||||
const uint8_t gFontBigDigits[11][26] =
|
|
||||||
{
|
|
||||||
{0x00, 0xC0, 0xF0, 0xF8, 0x3C, 0x0C, 0x0C, 0x0C, 0x0C, 0x1C, 0xF8, 0xF0, 0xE0, 0x00, 0x07, 0x1F, 0x3F, 0x78, 0x60, 0x60, 0x60, 0x60, 0x70, 0x3F, 0x1F, 0x0F},
|
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0xFC, 0xFC, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x7F, 0x7F, 0x00, 0x00, 0x00, 0x00},
|
|
||||||
{0x00, 0x10, 0x38, 0x38, 0x1C, 0x0C, 0x0C, 0x0C, 0x0C, 0xFC, 0xF8, 0xF0, 0x00, 0x00, 0x70, 0x78, 0x7C, 0x7C, 0x6E, 0x66, 0x67, 0x67, 0x63, 0x61, 0x60, 0x00},
|
|
||||||
{0x00, 0x10, 0x18, 0x18, 0x9C, 0x8C, 0x8C, 0x8C, 0x8C, 0xCC, 0xF8, 0xF8, 0x70, 0x00, 0x30, 0x30, 0x30, 0x71, 0x61, 0x61, 0x61, 0x61, 0x71, 0x3F, 0x3F, 0x1E},
|
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x80, 0xC0, 0xE0, 0x70, 0x38, 0xFC, 0xFC, 0xFC, 0x00, 0x00, 0x1C, 0x1E, 0x1F, 0x1F, 0x19, 0x18, 0x18, 0x18, 0x7F, 0x7F, 0x7F, 0x18},
|
|
||||||
{0x00, 0x00, 0xFC, 0xFC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0x8C, 0x0C, 0x00, 0x00, 0x18, 0x30, 0x70, 0x60, 0x60, 0x60, 0x60, 0x71, 0x7B, 0x3F, 0x1F},
|
|
||||||
{0x00, 0xC0, 0xF0, 0xF8, 0x38, 0x9C, 0x8C, 0x8C, 0x8C, 0x8C, 0x9C, 0x38, 0x30, 0x00, 0x0F, 0x1F, 0x3F, 0x73, 0x61, 0x61, 0x61, 0x61, 0x73, 0x33, 0x3F, 0x1E},
|
|
||||||
{0x00, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x8C, 0xEC, 0xFC, 0x3C, 0x1C, 0x00, 0x00, 0x00, 0x40, 0x60, 0x78, 0x7C, 0x1F, 0x07, 0x03, 0x00, 0x00, 0x00},
|
|
||||||
{0x00, 0x00, 0x78, 0xF8, 0xDC, 0x8C, 0x8C, 0x8C, 0x8C, 0xDC, 0xF8, 0x78, 0x00, 0x00, 0x1E, 0x3F, 0x3F, 0x73, 0x61, 0x61, 0x61, 0x61, 0x73, 0x3F, 0x3F, 0x1E},
|
|
||||||
{0x00, 0xF0, 0xF8, 0xB8, 0x1C, 0x0C, 0x0C, 0x0C, 0x0C, 0x1C, 0xB8, 0xF0, 0xE0, 0x00, 0x11, 0x33, 0x77, 0x67, 0x66, 0x66, 0x66, 0x76, 0x33, 0x3F, 0x1F, 0x07},
|
|
||||||
{0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x00, 0x00}
|
|
||||||
};
|
|
||||||
|
|
||||||
// 6 Empty columns removed
|
|
||||||
#elif 0
|
|
||||||
// VCR font
|
|
||||||
const uint8_t gFontBigDigits[11][26 - 6] =
|
|
||||||
{
|
|
||||||
{/*0x00, 0x00,*/ 0xF8, 0xFC, 0x06, 0x86, 0xC6, 0xE6, 0xF6, 0x76, 0xFC, 0xF8, /*0x00,*/ /*0x00, 0x00,*/ 0x1F, 0x3F, 0x77, 0x67, 0x63, 0x61, 0x60, 0x70, 0x3F, 0x1F, /*0x00*/},
|
|
||||||
{/*0x00, 0x00,*/ 0x00, 0x00, 0x18, 0x1C, 0xFE, 0xFE, 0x00, 0x00, 0x00, 0x00, /*0x00,*/ /*0x00, 0x00,*/ 0x00, 0x00, 0x60, 0x60, 0x7F, 0x7F, 0x60, 0x60, 0x00, 0x00, /*0x00*/},
|
|
||||||
{/*0x00, 0x00,*/ 0x18, 0x1C, 0x86, 0x86, 0x86, 0x86, 0x86, 0xC6, 0xFC, 0x78, /*0x00,*/ /*0x00, 0x00,*/ 0x7E, 0x7F, 0x63, 0x61, 0x61, 0x61, 0x61, 0x61, 0x60, 0x60, /*0x00*/},
|
|
||||||
{/*0x00, 0x00,*/ 0x18, 0x1C, 0x06, 0x06, 0x86, 0x86, 0x86, 0xC6, 0xFC, 0x78, /*0x00,*/ /*0x00, 0x00,*/ 0x18, 0x38, 0x70, 0x60, 0x61, 0x61, 0x61, 0x73, 0x3F, 0x1E, /*0x00*/},
|
|
||||||
{/*0x00, 0x00,*/ 0x80, 0xC0, 0xE0, 0x70, 0x38, 0x1C, 0xFE, 0xFE, 0x00, 0x00, /*0x00,*/ /*0x00, 0x00,*/ 0x07, 0x07, 0x06, 0x06, 0x06, 0x06, 0x7F, 0x7F, 0x06, 0x06, /*0x00*/},
|
|
||||||
{/*0x00, 0x00,*/ 0x7E, 0x7E, 0x66, 0x66, 0x66, 0x66, 0x66, 0xE6, 0xC6, 0x86, /*0x00,*/ /*0x00, 0x00,*/ 0x18, 0x38, 0x70, 0x60, 0x60, 0x60, 0x60, 0x70, 0x3F, 0x1F, /*0x00*/},
|
|
||||||
{/*0x00, 0x00,*/ 0xF8, 0xFC, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x1C, 0x18, /*0x00,*/ /*0x00, 0x00,*/ 0x1F, 0x3F, 0x71, 0x61, 0x61, 0x61, 0x61, 0x73, 0x3F, 0x1E, /*0x00*/},
|
|
||||||
{/*0x00, 0x00,*/ 0x06, 0x06, 0x06, 0x06, 0x06, 0x86, 0xC6, 0xE6, 0x7E, 0x3E, /*0x00,*/ /*0x00, 0x00,*/ 0x00, 0x00, 0x00, 0x00, 0x7F, 0x7F, 0x01, 0x00, 0x00, 0x00, /*0x00*/},
|
|
||||||
{/*0x00, 0x00,*/ 0x78, 0xFC, 0xC6, 0x86, 0x86, 0x86, 0x86, 0xC6, 0xFC, 0x78, /*0x00,*/ /*0x00, 0x00,*/ 0x1E, 0x3F, 0x73, 0x61, 0x61, 0x61, 0x61, 0x73, 0x3F, 0x1E, /*0x00*/},
|
|
||||||
{/*0x00, 0x00,*/ 0x78, 0xFC, 0xC6, 0x86, 0x86, 0x86, 0x86, 0x86, 0xFC, 0xF8, /*0x00,*/ /*0x00, 0x00,*/ 0x18, 0x38, 0x71, 0x61, 0x61, 0x61, 0x61, 0x71, 0x3F, 0x1F, /*0x00*/},
|
|
||||||
{/*0x00, 0x00,*/ 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, /*0x00,*/ /*0x00, 0x00,*/ 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, /*0x00*/}
|
|
||||||
};
|
|
||||||
#else
|
|
||||||
// Terminus font
|
|
||||||
|
|
||||||
// const uint8_t gFontBigDigits[11][26 - 6] =
|
|
||||||
// {
|
|
||||||
// {/*0x00, 0x00,*/ 0xFC, 0xFE, 0xFE, 0x06, 0x06, 0x06, 0x06, 0xFE, 0xFE, 0xFC, /*0x00,*/ /*0x00, 0x00,*/ 0x3F, 0x7F, 0x7F, 0x60, 0x60, 0x60, 0x60, 0x7F, 0x7F, 0x3F, /*0x00*/},
|
|
||||||
// {/*0x00, 0x00,*/ 0x00, 0x00, 0x18, 0x1C, 0xFE, 0xFE, 0xFE, 0x00, 0x00, 0x00, /*0x00,*/ /*0x00, 0x00,*/ 0x00, 0x00, 0x60, 0x60, 0x7F, 0x7F, 0x7F, 0x60, 0x60, 0x00, /*0x00*/},
|
|
||||||
// {/*0x00, 0x00,*/ 0x1C, 0x1E, 0x1E, 0x06, 0x06, 0x06, 0x86, 0xFE, 0xFE, 0x7C, /*0x00,*/ /*0x00, 0x00,*/ 0x60, 0x70, 0x78, 0x7C, 0x6E, 0x67, 0x63, 0x61, 0x60, 0x60, /*0x00*/},
|
|
||||||
// {/*0x00, 0x00,*/ 0x0C, 0x0E, 0x0E, 0x86, 0x86, 0x86, 0x86, 0xFE, 0xFE, 0x7C, /*0x00,*/ /*0x00, 0x00,*/ 0x30, 0x70, 0x70, 0x61, 0x61, 0x61, 0x61, 0x7F, 0x7F, 0x3E, /*0x00*/},
|
|
||||||
// {/*0x00, 0x00,*/ 0x80, 0xC0, 0xE0, 0x70, 0x38, 0x1C, 0x0E, 0xFE, 0xFE, 0xFE, /*0x00,*/ /*0x00, 0x00,*/ 0x0F, 0x0F, 0x0F, 0x0C, 0x0C, 0x0C, 0x0C, 0x7F, 0x7F, 0x7F, /*0x00*/},
|
|
||||||
// {/*0x00, 0x00,*/ 0xFE, 0xFE, 0xFE, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x86, /*0x00,*/ /*0x00, 0x00,*/ 0x30, 0x70, 0x70, 0x60, 0x60, 0x60, 0x60, 0x7F, 0x7F, 0x3F, /*0x00*/},
|
|
||||||
// {/*0x00, 0x00,*/ 0xF8, 0xFC, 0xFE, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x80, /*0x00,*/ /*0x00, 0x00,*/ 0x3F, 0x7F, 0x7F, 0x60, 0x60, 0x60, 0x60, 0x7F, 0x7F, 0x3F, /*0x00*/},
|
|
||||||
// {/*0x00, 0x00,*/ 0x0E, 0x0E, 0x0E, 0x06, 0x06, 0x86, 0xE6, 0xFE, 0x7E, 0x1E, /*0x00,*/ /*0x00, 0x00,*/ 0x00, 0x00, 0x00, 0x00, 0x7C, 0x7F, 0x7F, 0x03, 0x00, 0x00, /*0x00*/},
|
|
||||||
// {/*0x00, 0x00,*/ 0x7C, 0xFE, 0xFE, 0x86, 0x86, 0x86, 0x86, 0xFE, 0xFE, 0x7C, /*0x00,*/ /*0x00, 0x00,*/ 0x3F, 0x7F, 0x7F, 0x61, 0x61, 0x61, 0x61, 0x7F, 0x7F, 0x3F, /*0x00*/},
|
|
||||||
// {/*0x00, 0x00,*/ 0xFC, 0xFE, 0xFE, 0x06, 0x06, 0x06, 0x06, 0xFE, 0xFE, 0xFC, /*0x00,*/ /*0x00, 0x00,*/ 0x01, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x7F, 0x3F, 0x1F, /*0x00*/},
|
|
||||||
// {/*0x00, 0x00,*/ 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, /*0x00,*/ /*0x00, 0x00,*/ 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, /*0x00*/}
|
|
||||||
// };
|
|
||||||
#endif
|
|
||||||
/*
|
|
||||||
const uint8_t gFontSmallDigits[11][7] =
|
|
||||||
{
|
|
||||||
{0x00, 0x3E, 0x41, 0x41, 0x41, 0x41, 0x3E}, // '0'
|
|
||||||
{0x00, 0x00, 0x42, 0x7F, 0x40, 0x00, 0x00}, // '1'
|
|
||||||
{0x00, 0x62, 0x51, 0x51, 0x49, 0x49, 0x46}, // '2'
|
|
||||||
{0x00, 0x22, 0x41, 0x49, 0x49, 0x4D, 0x32}, // '3'
|
|
||||||
{0x00, 0x18, 0x14, 0x12, 0x11, 0x7F, 0x10}, // '4'
|
|
||||||
{0x00, 0x27, 0x45, 0x45, 0x45, 0x45, 0x39}, // '5'
|
|
||||||
{0x00, 0x3E, 0x49, 0x49, 0x49, 0x49, 0x30}, // '6'
|
|
||||||
{0x00, 0x01, 0x71, 0x09, 0x05, 0x03, 0x00}, // '7'
|
|
||||||
{0x00, 0x36, 0x49, 0x49, 0x49, 0x49, 0x36}, // '8'
|
|
||||||
{0x00, 0x46, 0x49, 0x49, 0x49, 0x29, 0x1E}, // '9'
|
|
||||||
{0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00} // '-'
|
|
||||||
};
|
|
||||||
*/
|
|
||||||
const uint8_t gFontSmall[95-1][6] =
|
const uint8_t gFontSmall[95-1][6] =
|
||||||
{
|
{
|
||||||
// {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // ' '
|
// {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // ' '
|
||||||
@@ -483,7 +216,7 @@ const uint8_t gFontSmall[95-1][6] =
|
|||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//#ifdef ENABLE_SPECTRUM
|
#ifdef ENABLE_SPECTRUM // 3x5 font, only used by the spectrum
|
||||||
const uint8_t gFont3x5[][3] =
|
const uint8_t gFont3x5[][3] =
|
||||||
{
|
{
|
||||||
{0x00, 0x00, 0x00}, // 32 - space
|
{0x00, 0x00, 0x00}, // 32 - space
|
||||||
@@ -651,4 +384,4 @@ const uint8_t gFontSmall[95-1][6] =
|
|||||||
// {0x03, 0x0b, 0x18}, // 190 - threequarters
|
// {0x03, 0x0b, 0x18}, // 190 - threequarters
|
||||||
// {0x18, 0x15, 0x10}, // 191 - questiondown
|
// {0x18, 0x15, 0x10}, // 191 - questiondown
|
||||||
};
|
};
|
||||||
//#endif
|
#endif
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
|
||||||
extern const uint8_t gFontBig[95 - 1][16 - 2];
|
#ifdef ENABLE_SPECTRUM
|
||||||
extern const uint8_t gFontBigDigits[11][26 - 6];
|
|
||||||
extern const uint8_t gFont3x5[96][3];
|
extern const uint8_t gFont3x5[96][3];
|
||||||
|
#endif
|
||||||
extern const uint8_t gFontSmall[95 - 1][6];
|
extern const uint8_t gFontSmall[95 - 1][6];
|
||||||
#ifdef ENABLE_SMALL_BOLD
|
#ifdef ENABLE_SMALL_BOLD
|
||||||
extern const uint8_t gFontSmallBold[95 - 1][6];
|
extern const uint8_t gFontSmallBold[95 - 1][6];
|
||||||
|
|||||||
+107
-118
@@ -24,90 +24,90 @@
|
|||||||
#define BX4819_band1_lower 1800000
|
#define BX4819_band1_lower 1800000
|
||||||
#define BX4819_band2_upper 130000000
|
#define BX4819_band2_upper 130000000
|
||||||
|
|
||||||
const freq_band_table_t BX4819_band1 = {BX4819_band1_lower, 63000000};
|
const freq_band_table_t BX4819_band1 = {BX4819_band1_lower, 63000000};
|
||||||
const freq_band_table_t BX4819_band2 = {84000000, BX4819_band2_upper};
|
const freq_band_table_t BX4819_band2 = {84000000, BX4819_band2_upper};
|
||||||
|
|
||||||
const freq_band_table_t frequencyBandTable[] =
|
const freq_band_table_t frequencyBandTable[] =
|
||||||
{
|
{
|
||||||
#ifndef ENABLE_WIDE_RX
|
#ifndef ENABLE_WIDE_RX
|
||||||
// QS original
|
// QS original
|
||||||
[BAND1_50MHz ]={.lower = 5000000, .upper = 7600000},
|
[BAND1_50MHz ]={.lower = 5000000, .upper = 7600000},
|
||||||
[BAND7_470MHz]={.lower = 47000000, .upper = 60000000},
|
[BAND7_470MHz]={.lower = 47000000, .upper = 60000000},
|
||||||
#else
|
#else
|
||||||
// extended range
|
// extended range
|
||||||
[BAND1_50MHz ]={.lower = BX4819_band1_lower, .upper = 10800000},
|
[BAND1_50MHz]={.lower = BX4819_band1_lower, .upper = 10800000},
|
||||||
[BAND7_470MHz]={.lower = 47000000, .upper = BX4819_band2_upper},
|
[BAND7_470MHz]={.lower = 47000000, .upper = BX4819_band2_upper},
|
||||||
#endif
|
#endif
|
||||||
[BAND2_108MHz]={.lower = 10800000, .upper = 13700000},
|
[BAND2_108MHz]={.lower = 10800000, .upper = 13700000},
|
||||||
[BAND3_137MHz]={.lower = 13700000, .upper = 17400000},
|
[BAND3_137MHz]={.lower = 13700000, .upper = 17400000},
|
||||||
[BAND4_174MHz]={.lower = 17400000, .upper = 35000000},
|
[BAND4_174MHz]={.lower = 17400000, .upper = 35000000},
|
||||||
[BAND5_350MHz]={.lower = 35000000, .upper = 40000000},
|
[BAND5_350MHz]={.lower = 35000000, .upper = 40000000},
|
||||||
[BAND6_400MHz]={.lower = 40000000, .upper = 47000000}
|
[BAND6_400MHz]={.lower = 40000000, .upper = 47000000}
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_NOAA
|
||||||
const uint32_t NoaaFrequencyTable[10] =
|
const uint32_t NoaaFrequencyTable[10] =
|
||||||
{
|
{
|
||||||
16255000,
|
16255000,
|
||||||
16240000,
|
16240000,
|
||||||
16247500,
|
16247500,
|
||||||
16242500,
|
16242500,
|
||||||
16245000,
|
16245000,
|
||||||
16250000,
|
16250000,
|
||||||
16252500,
|
16252500,
|
||||||
16152500,
|
16152500,
|
||||||
16177500,
|
16177500,
|
||||||
16327500
|
16327500
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// this order of steps has to be preserved for backwards compatibility with other/stock firmwares
|
// this order of steps has to be preserved for backwards compatibility with other/stock firmwares
|
||||||
const uint16_t gStepFrequencyTable[] = {
|
const uint16_t gStepFrequencyTable[] = {
|
||||||
// standard steps
|
// standard steps
|
||||||
[STEP_2_5kHz] = 250,
|
[STEP_2_5kHz] = 250,
|
||||||
[STEP_5kHz] = 500,
|
[STEP_5kHz] = 500,
|
||||||
[STEP_6_25kHz] = 625,
|
[STEP_6_25kHz] = 625,
|
||||||
[STEP_10kHz] = 1000,
|
[STEP_10kHz] = 1000,
|
||||||
[STEP_12_5kHz] = 1250,
|
[STEP_12_5kHz] = 1250,
|
||||||
[STEP_25kHz] = 2500,
|
[STEP_25kHz] = 2500,
|
||||||
[STEP_8_33kHz] = 833,
|
[STEP_8_33kHz] = 833,
|
||||||
// custom steps
|
// custom steps
|
||||||
[STEP_0_01kHz] = 1,
|
[STEP_0_01kHz] = 1,
|
||||||
[STEP_0_05kHz] = 5,
|
[STEP_0_05kHz] = 5,
|
||||||
[STEP_0_1kHz] = 10,
|
[STEP_0_1kHz] = 10,
|
||||||
[STEP_0_25kHz] = 25,
|
[STEP_0_25kHz] = 25,
|
||||||
[STEP_0_5kHz] = 50,
|
[STEP_0_5kHz] = 50,
|
||||||
[STEP_1kHz] = 100,
|
[STEP_1kHz] = 100,
|
||||||
[STEP_1_25kHz] = 125,
|
[STEP_1_25kHz] = 125,
|
||||||
[STEP_9kHz] = 900,
|
[STEP_9kHz] = 900,
|
||||||
[STEP_15kHz] = 1500,
|
[STEP_15kHz] = 1500,
|
||||||
[STEP_20kHz] = 2000,
|
[STEP_20kHz] = 2000,
|
||||||
[STEP_30kHz] = 3000,
|
[STEP_30kHz] = 3000,
|
||||||
[STEP_50kHz] = 5000,
|
[STEP_50kHz] = 5000,
|
||||||
[STEP_100kHz] = 10000,
|
[STEP_100kHz] = 10000,
|
||||||
[STEP_125kHz] = 12500,
|
[STEP_125kHz] = 12500,
|
||||||
[STEP_200kHz] = 20000,
|
[STEP_200kHz] = 20000,
|
||||||
[STEP_250kHz] = 25000,
|
[STEP_250kHz] = 25000,
|
||||||
[STEP_500kHz] = 50000
|
[STEP_500kHz] = 50000
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
const STEP_Setting_t StepSortedIndexes[] = {
|
const STEP_Setting_t StepSortedIndexes[] = {
|
||||||
STEP_0_01kHz, STEP_0_05kHz, STEP_0_1kHz, STEP_0_25kHz, STEP_0_5kHz, STEP_1kHz, STEP_1_25kHz, STEP_2_5kHz, STEP_5kHz, STEP_6_25kHz,
|
STEP_0_01kHz, STEP_0_05kHz, STEP_0_1kHz, STEP_0_25kHz, STEP_0_5kHz, STEP_1kHz, STEP_1_25kHz, STEP_2_5kHz,
|
||||||
STEP_8_33kHz, STEP_9kHz, STEP_10kHz, STEP_12_5kHz, STEP_15kHz, STEP_20kHz, STEP_25kHz, STEP_30kHz, STEP_50kHz, STEP_100kHz,
|
STEP_5kHz, STEP_6_25kHz,
|
||||||
STEP_125kHz, STEP_200kHz, STEP_250kHz, STEP_500kHz
|
STEP_8_33kHz, STEP_9kHz, STEP_10kHz, STEP_12_5kHz, STEP_15kHz, STEP_20kHz, STEP_25kHz, STEP_30kHz, STEP_50kHz,
|
||||||
|
STEP_100kHz,
|
||||||
|
STEP_125kHz, STEP_200kHz, STEP_250kHz, STEP_500kHz
|
||||||
};
|
};
|
||||||
|
|
||||||
STEP_Setting_t FREQUENCY_GetStepIdxFromSortedIdx(uint8_t sortedIdx)
|
STEP_Setting_t FREQUENCY_GetStepIdxFromSortedIdx(uint8_t sortedIdx) {
|
||||||
{
|
|
||||||
return StepSortedIndexes[sortedIdx];
|
return StepSortedIndexes[sortedIdx];
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t FREQUENCY_GetSortedIdxFromStepIdx(uint8_t stepIdx)
|
uint32_t FREQUENCY_GetSortedIdxFromStepIdx(uint8_t stepIdx) {
|
||||||
{
|
for (uint8_t i = 0; i < ARRAY_SIZE(gStepFrequencyTable); i++)
|
||||||
for(uint8_t i = 0; i < ARRAY_SIZE(gStepFrequencyTable); i++)
|
if (StepSortedIndexes[i] == stepIdx)
|
||||||
if(StepSortedIndexes[i] == stepIdx)
|
|
||||||
return i;
|
return i;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -115,25 +115,24 @@ uint32_t FREQUENCY_GetSortedIdxFromStepIdx(uint8_t stepIdx)
|
|||||||
static_assert(ARRAY_SIZE(gStepFrequencyTable) == STEP_N_ELEM);
|
static_assert(ARRAY_SIZE(gStepFrequencyTable) == STEP_N_ELEM);
|
||||||
|
|
||||||
|
|
||||||
FREQUENCY_Band_t FREQUENCY_GetBand(uint32_t Frequency)
|
FREQUENCY_Band_t FREQUENCY_GetBand(uint32_t Frequency) {
|
||||||
{
|
|
||||||
for (int32_t band = BAND_N_ELEM - 1; band >= 0; band--)
|
for (int32_t band = BAND_N_ELEM - 1; band >= 0; band--)
|
||||||
if (Frequency >= frequencyBandTable[band].lower)
|
if (Frequency >= frequencyBandTable[band].lower)
|
||||||
return (FREQUENCY_Band_t)band;
|
return (FREQUENCY_Band_t) band;
|
||||||
|
|
||||||
return BAND1_50MHz;
|
return BAND1_50MHz;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t FREQUENCY_CalculateOutputPower(uint8_t TxpLow, uint8_t TxpMid, uint8_t TxpHigh, int32_t LowerLimit, int32_t Middle, int32_t UpperLimit, int32_t Frequency)
|
uint8_t
|
||||||
{
|
FREQUENCY_CalculateOutputPower(uint8_t TxpLow, uint8_t TxpMid, uint8_t TxpHigh, int32_t LowerLimit, int32_t Middle,
|
||||||
|
int32_t UpperLimit, int32_t Frequency) {
|
||||||
if (Frequency <= LowerLimit)
|
if (Frequency <= LowerLimit)
|
||||||
return TxpLow;
|
return TxpLow;
|
||||||
|
|
||||||
if (UpperLimit <= Frequency)
|
if (UpperLimit <= Frequency)
|
||||||
return TxpHigh;
|
return TxpHigh;
|
||||||
|
|
||||||
if (Frequency <= Middle)
|
if (Frequency <= Middle) {
|
||||||
{
|
|
||||||
TxpMid += ((TxpMid - TxpLow) * (Frequency - LowerLimit)) / (Middle - LowerLimit);
|
TxpMid += ((TxpMid - TxpLow) * (Frequency - LowerLimit)) / (Middle - LowerLimit);
|
||||||
return TxpMid;
|
return TxpMid;
|
||||||
}
|
}
|
||||||
@@ -144,23 +143,22 @@ uint8_t FREQUENCY_CalculateOutputPower(uint8_t TxpLow, uint8_t TxpMid, uint8_t T
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
uint32_t FREQUENCY_RoundToStep(uint32_t freq, uint16_t step)
|
uint32_t FREQUENCY_RoundToStep(uint32_t freq, uint16_t step) {
|
||||||
{
|
if (step == 833) {
|
||||||
if(step == 833) {
|
uint32_t base = freq / 2500 * 2500;
|
||||||
uint32_t base = freq/2500*2500;
|
int chno =
|
||||||
int chno = (freq - base) / 700; // convert entered aviation 8.33Khz channel number scheme to actual frequency.
|
(freq - base) / 700; // convert entered aviation 8.33Khz channel number scheme to actual frequency.
|
||||||
return base + (chno * 833) + (chno == 3);
|
return base + (chno * 833) + (chno == 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(step == 1)
|
if (step == 1)
|
||||||
return freq;
|
return freq;
|
||||||
if(step >= 1000)
|
if (step >= 1000)
|
||||||
step = step/2;
|
step = step / 2;
|
||||||
return (freq + (step + 1) / 2) / step * step;
|
return (freq + (step + 1) / 2) / step * step;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t TX_freq_check(const uint32_t Frequency)
|
int32_t TX_freq_check(const uint32_t Frequency) { // return '0' if TX frequency is allowed
|
||||||
{ // return '0' if TX frequency is allowed
|
|
||||||
// otherwise return '-1'
|
// otherwise return '-1'
|
||||||
|
|
||||||
if (Frequency < frequencyBandTable[0].lower || Frequency > frequencyBandTable[BAND_N_ELEM - 1].upper)
|
if (Frequency < frequencyBandTable[0].lower || Frequency > frequencyBandTable[BAND_N_ELEM - 1].upper)
|
||||||
@@ -169,30 +167,22 @@ int32_t TX_freq_check(const uint32_t Frequency)
|
|||||||
if (Frequency >= BX4819_band1.upper && Frequency < BX4819_band2.lower)
|
if (Frequency >= BX4819_band1.upper && Frequency < BX4819_band2.lower)
|
||||||
return -1; // BX chip does not work in this range
|
return -1; // BX chip does not work in this range
|
||||||
|
|
||||||
switch (gSetting_F_LOCK)
|
switch (gSetting_F_LOCK) {
|
||||||
{
|
|
||||||
case F_LOCK_DEF:
|
case F_LOCK_DEF:
|
||||||
if (Frequency >= frequencyBandTable[BAND3_137MHz].lower && Frequency < frequencyBandTable[BAND3_137MHz].upper)
|
if (Frequency >= frequencyBandTable[BAND3_137MHz].lower &&
|
||||||
|
Frequency < frequencyBandTable[BAND3_137MHz].upper)
|
||||||
return 0;
|
return 0;
|
||||||
if (Frequency >= frequencyBandTable[BAND4_174MHz].lower && Frequency < frequencyBandTable[BAND4_174MHz].upper)
|
if (Frequency >= frequencyBandTable[BAND4_174MHz].lower &&
|
||||||
#ifndef ENABLE_FEAT_F4HWN
|
Frequency < frequencyBandTable[BAND4_174MHz].upper)
|
||||||
if (gSetting_200TX)
|
return 0;
|
||||||
#endif
|
if (Frequency >= frequencyBandTable[BAND5_350MHz].lower &&
|
||||||
return 0;
|
Frequency < frequencyBandTable[BAND5_350MHz].upper)
|
||||||
if (Frequency >= frequencyBandTable[BAND5_350MHz].lower && Frequency < frequencyBandTable[BAND5_350MHz].upper)
|
return 0;
|
||||||
#ifndef ENABLE_FEAT_F4HWN
|
if (Frequency >= frequencyBandTable[BAND6_400MHz].lower &&
|
||||||
if (gSetting_350TX && gSetting_350EN)
|
Frequency < frequencyBandTable[BAND6_400MHz].upper)
|
||||||
#else
|
|
||||||
if (gSetting_350EN)
|
|
||||||
#endif
|
|
||||||
return 0;
|
|
||||||
if (Frequency >= frequencyBandTable[BAND6_400MHz].lower && Frequency < frequencyBandTable[BAND6_400MHz].upper)
|
|
||||||
return 0;
|
return 0;
|
||||||
if (Frequency >= frequencyBandTable[BAND7_470MHz].lower && Frequency <= 60000000)
|
if (Frequency >= frequencyBandTable[BAND7_470MHz].lower && Frequency <= 60000000)
|
||||||
#ifndef ENABLE_FEAT_F4HWN
|
return 0;
|
||||||
if (gSetting_500TX)
|
|
||||||
#endif
|
|
||||||
return 0;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// case F_LOCK_FCC:
|
// case F_LOCK_FCC:
|
||||||
@@ -231,25 +221,25 @@ int32_t TX_freq_check(const uint32_t Frequency)
|
|||||||
// break;
|
// break;
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_PMR
|
#ifdef ENABLE_FEAT_F4HWN_PMR
|
||||||
case F_LOCK_PMR:
|
case F_LOCK_PMR:
|
||||||
if (Frequency >= 44600625 && Frequency <= 44619375)
|
if (Frequency >= 44600625 && Frequency <= 44619375)
|
||||||
return 0;
|
return 0;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_GMRS_FRS_MURS
|
#ifdef ENABLE_FEAT_F4HWN_GMRS_FRS_MURS
|
||||||
case F_LOCK_GMRS_FRS_MURS:
|
case F_LOCK_GMRS_FRS_MURS:
|
||||||
// https://forums.radioreference.com/threads/the-great-unofficial-radioreference-frs-gmrs-murs-fact-sheet.275370/
|
// https://forums.radioreference.com/threads/the-great-unofficial-radioreference-frs-gmrs-murs-fact-sheet.275370/
|
||||||
if ((Frequency >= 46255000 && Frequency <= 46272500) ||
|
if ((Frequency >= 46255000 && Frequency <= 46272500) ||
|
||||||
(Frequency >= 46755000 && Frequency <= 46772500)) // FRS/GMRS
|
(Frequency >= 46755000 && Frequency <= 46772500)) // FRS/GMRS
|
||||||
return 0;
|
return 0;
|
||||||
if (Frequency == 15182000 ||
|
if (Frequency == 15182000 ||
|
||||||
Frequency == 15188000 ||
|
Frequency == 15188000 ||
|
||||||
Frequency == 15194000 ||
|
Frequency == 15194000 ||
|
||||||
Frequency == 15457000 ||
|
Frequency == 15457000 ||
|
||||||
Frequency == 15460000) // MURS
|
Frequency == 15460000) // MURS
|
||||||
return 0;
|
return 0;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_CA
|
#ifdef ENABLE_FEAT_F4HWN_CA
|
||||||
@@ -275,8 +265,7 @@ int32_t TX_freq_check(const uint32_t Frequency)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t RX_freq_check(const uint32_t Frequency)
|
int32_t RX_freq_check(const uint32_t Frequency) { // return '0' if RX frequency is allowed
|
||||||
{ // return '0' if RX frequency is allowed
|
|
||||||
// otherwise return '-1'
|
// otherwise return '-1'
|
||||||
|
|
||||||
if (Frequency < frequencyBandTable[0].lower || Frequency > frequencyBandTable[BAND_N_ELEM - 1].upper)
|
if (Frequency < frequencyBandTable[0].lower || Frequency > frequencyBandTable[BAND_N_ELEM - 1].upper)
|
||||||
|
|||||||
+3
-23
@@ -48,6 +48,7 @@
|
|||||||
#include "ui/status.h"
|
#include "ui/status.h"
|
||||||
#include "ui/ui.h"
|
#include "ui/ui.h"
|
||||||
#include "app/app.h"
|
#include "app/app.h"
|
||||||
|
#include "driver/systick.h"
|
||||||
|
|
||||||
|
|
||||||
FUNCTION_Type_t gCurrentFunction;
|
FUNCTION_Type_t gCurrentFunction;
|
||||||
@@ -79,9 +80,6 @@ void FUNCTION_Init(void) {
|
|||||||
g_VOX_Lost = false;
|
g_VOX_Lost = false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
DTMF_clear_RX();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_NOAA
|
||||||
gNOAACountdown_10ms = 0;
|
gNOAACountdown_10ms = 0;
|
||||||
@@ -95,10 +93,6 @@ void FUNCTION_Init(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void FUNCTION_Foreground(const FUNCTION_Type_t PreviousFunction) {
|
void FUNCTION_Foreground(const FUNCTION_Type_t PreviousFunction) {
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
if (gDTMF_ReplyState != DTMF_REPLY_NONE)
|
|
||||||
RADIO_PrepareCssTX();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (PreviousFunction == FUNCTION_TRANSMIT) {
|
if (PreviousFunction == FUNCTION_TRANSMIT) {
|
||||||
ST7565_FixInterfGlitch();
|
ST7565_FixInterfGlitch();
|
||||||
@@ -113,13 +107,6 @@ void FUNCTION_Foreground(const FUNCTION_Type_t PreviousFunction) {
|
|||||||
gFM_RestoreCountdown_10ms = fm_restore_countdown_10ms;
|
gFM_RestoreCountdown_10ms = fm_restore_countdown_10ms;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
if (gDTMF_CallState == DTMF_CALL_STATE_CALL_OUT ||
|
|
||||||
gDTMF_CallState == DTMF_CALL_STATE_RECEIVED ||
|
|
||||||
gDTMF_CallState == DTMF_CALL_STATE_RECEIVED_STAY) {
|
|
||||||
gDTMF_auto_reset_time_500ms = gEeprom.DTMF_auto_reset_time * 2;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
gUpdateStatus = true;
|
gUpdateStatus = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -157,10 +144,6 @@ void FUNCTION_Transmit() {
|
|||||||
|
|
||||||
BK4819_DisableDTMF();
|
BK4819_DisableDTMF();
|
||||||
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
// clear the DTMF RX buffer
|
|
||||||
DTMF_clear_RX();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// clear the DTMF RX live decoder buffer
|
// clear the DTMF RX live decoder buffer
|
||||||
gDTMF_RX_live_timeout = 0;
|
gDTMF_RX_live_timeout = 0;
|
||||||
@@ -204,6 +187,7 @@ void FUNCTION_Transmit() {
|
|||||||
|
|
||||||
DTMF_Reply();
|
DTMF_Reply();
|
||||||
|
|
||||||
|
BK4819_SetScramble(gCurrentVfo->SCRAMBLING_TYPE);
|
||||||
if (gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_APOLLO)
|
if (gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_APOLLO)
|
||||||
BK4819_PlaySingleTone(2525, 250, 0, gEeprom.DTMF_SIDE_TONE);
|
BK4819_PlaySingleTone(2525, 250, 0, gEeprom.DTMF_SIDE_TONE);
|
||||||
|
|
||||||
@@ -211,7 +195,7 @@ void FUNCTION_Transmit() {
|
|||||||
if (gAlarmState != ALARM_STATE_OFF) {
|
if (gAlarmState != ALARM_STATE_OFF) {
|
||||||
#ifdef ENABLE_TX1750
|
#ifdef ENABLE_TX1750
|
||||||
if (gAlarmState == ALARM_STATE_TX1750) {
|
if (gAlarmState == ALARM_STATE_TX1750) {
|
||||||
BK4819_TransmitTone(false, 1750);
|
BK4819_TransmitTone(gEeprom.DTMF_SIDE_TONE, 1750);
|
||||||
gAlarmState = ALARM_STATE_OFF;
|
gAlarmState = ALARM_STATE_OFF;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -234,10 +218,6 @@ void FUNCTION_Transmit() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
if (gCurrentVfo->SCRAMBLING_TYPE > 0)
|
|
||||||
BK4819_EnableScramble(gCurrentVfo->SCRAMBLING_TYPE - 1);
|
|
||||||
else
|
|
||||||
BK4819_DisableScramble();
|
|
||||||
|
|
||||||
if (gSetting_backlight_on_tx_rx & BACKLIGHT_ON_TR_TX) {
|
if (gSetting_backlight_on_tx_rx & BACKLIGHT_ON_TR_TX) {
|
||||||
BACKLIGHT_TurnOn();
|
BACKLIGHT_TurnOn();
|
||||||
|
|||||||
+53
-73
@@ -17,8 +17,9 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#ifdef ENABLE_AIRCOPY
|
#ifdef ENABLE_AIRCOPY
|
||||||
#include "app/aircopy.h"
|
#include "app/aircopy.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "bsp/dp32g030/gpio.h"
|
#include "bsp/dp32g030/gpio.h"
|
||||||
#include "driver/bk4819.h"
|
#include "driver/bk4819.h"
|
||||||
#include "driver/keyboard.h"
|
#include "driver/keyboard.h"
|
||||||
@@ -31,98 +32,77 @@
|
|||||||
#include "ui/menu.h"
|
#include "ui/menu.h"
|
||||||
#include "ui/ui.h"
|
#include "ui/ui.h"
|
||||||
|
|
||||||
BOOT_Mode_t BOOT_GetMode(void)
|
#if defined(ENABLE_FEAT_F4HWN_RESCUE_OPS) || defined(ENABLE_AIRCOPY)
|
||||||
{
|
BOOT_Mode_t BOOT_GetMode(void) {
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
KEY_Code_t Keys[2];
|
KEY_Code_t Keys[2];
|
||||||
|
|
||||||
for (i = 0; i < 2; i++)
|
for (i = 0; i < 2; i++) {
|
||||||
{
|
|
||||||
if (GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT))
|
if (GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT))
|
||||||
return BOOT_MODE_NORMAL; // PTT not pressed
|
return BOOT_MODE_NORMAL; // PTT not pressed
|
||||||
Keys[i] = KEYBOARD_Poll();
|
Keys[i] = KEYBOARD_Poll();
|
||||||
SYSTEM_DelayMs(20);
|
SYSTEM_DelayMs(20);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
if (Keys[0] == Keys[1]) {
|
||||||
if (Keys[0] == (10 + gEeprom.SET_KEY))
|
|
||||||
{
|
|
||||||
return BOOT_MODE_RESCUE_OPS; // Secret KEY pressed
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (Keys[0] == Keys[1])
|
|
||||||
{
|
|
||||||
gKeyReading0 = Keys[0];
|
gKeyReading0 = Keys[0];
|
||||||
gKeyReading1 = Keys[0];
|
gKeyReading1 = Keys[0];
|
||||||
|
|
||||||
gDebounceCounter = 2;
|
gDebounceCounter = 2;
|
||||||
|
|
||||||
if (Keys[0] == KEY_SIDE1)
|
#ifdef ENABLE_AIRCOPY
|
||||||
return BOOT_MODE_F_LOCK;
|
if (Keys[0] == KEY_SIDE2)
|
||||||
|
return BOOT_MODE_AIRCOPY;
|
||||||
#ifdef ENABLE_AIRCOPY
|
#endif
|
||||||
if (Keys[0] == KEY_SIDE2)
|
|
||||||
return BOOT_MODE_AIRCOPY;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return BOOT_MODE_NORMAL;
|
return BOOT_MODE_NORMAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BOOT_ProcessMode(BOOT_Mode_t Mode)
|
void BOOT_ProcessMode(BOOT_Mode_t Mode) {
|
||||||
{
|
Mode = Mode;
|
||||||
if (Mode == BOOT_MODE_F_LOCK)
|
#ifdef ENABLE_AIRCOPY
|
||||||
|
if (Mode == BOOT_MODE_AIRCOPY)
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_FEAT_F4HWN_RESUME_STATE
|
gEeprom.DUAL_WATCH = DUAL_WATCH_OFF;
|
||||||
|
gEeprom.BATTERY_SAVE = 0;
|
||||||
|
#ifdef ENABLE_VOX
|
||||||
|
gEeprom.VOX_SWITCH = false;
|
||||||
|
#endif
|
||||||
|
gEeprom.CROSS_BAND_RX_TX = CROSS_BAND_OFF;
|
||||||
|
gEeprom.AUTO_KEYPAD_LOCK = false;
|
||||||
|
gEeprom.KEY_1_SHORT_PRESS_ACTION = ACTION_OPT_NONE;
|
||||||
|
gEeprom.KEY_1_LONG_PRESS_ACTION = ACTION_OPT_NONE;
|
||||||
|
gEeprom.KEY_2_SHORT_PRESS_ACTION = ACTION_OPT_NONE;
|
||||||
|
gEeprom.KEY_2_LONG_PRESS_ACTION = ACTION_OPT_NONE;
|
||||||
|
gEeprom.KEY_M_LONG_PRESS_ACTION = ACTION_OPT_NONE;
|
||||||
|
|
||||||
|
RADIO_InitInfo(gRxVfo, FREQ_CHANNEL_LAST - 1, 43400000); // LPD
|
||||||
|
|
||||||
|
gRxVfo->CHANNEL_BANDWIDTH = BANDWIDTH_NARROW;
|
||||||
|
gRxVfo->OUTPUT_POWER = OUTPUT_POWER_LOW1;
|
||||||
|
|
||||||
|
RADIO_ConfigureSquelchAndOutputPower(gRxVfo);
|
||||||
|
|
||||||
|
gCurrentVfo = gRxVfo;
|
||||||
|
|
||||||
|
RADIO_SetupRegisters(true);
|
||||||
|
BK4819_SetupAircopy();
|
||||||
|
BK4819_ResetFSK();
|
||||||
|
|
||||||
|
gAircopyState = AIRCOPY_READY;
|
||||||
|
|
||||||
|
gEeprom.BACKLIGHT_TIME = 61;
|
||||||
|
gEeprom.KEY_LOCK = 0;
|
||||||
|
|
||||||
|
#ifdef ENABLE_FEAT_F4HWN_RESUME_STATE
|
||||||
gEeprom.CURRENT_STATE = 0; // Don't resume is active...
|
gEeprom.CURRENT_STATE = 0; // Don't resume is active...
|
||||||
#endif
|
#endif
|
||||||
GUI_SelectNextDisplay(DISPLAY_MENU);
|
|
||||||
}
|
|
||||||
#ifdef ENABLE_AIRCOPY
|
|
||||||
else
|
|
||||||
if (Mode == BOOT_MODE_AIRCOPY)
|
|
||||||
{
|
|
||||||
gEeprom.DUAL_WATCH = DUAL_WATCH_OFF;
|
|
||||||
gEeprom.BATTERY_SAVE = 0;
|
|
||||||
#ifdef ENABLE_VOX
|
|
||||||
gEeprom.VOX_SWITCH = false;
|
|
||||||
#endif
|
|
||||||
gEeprom.CROSS_BAND_RX_TX = CROSS_BAND_OFF;
|
|
||||||
gEeprom.AUTO_KEYPAD_LOCK = false;
|
|
||||||
gEeprom.KEY_1_SHORT_PRESS_ACTION = ACTION_OPT_NONE;
|
|
||||||
gEeprom.KEY_1_LONG_PRESS_ACTION = ACTION_OPT_NONE;
|
|
||||||
gEeprom.KEY_2_SHORT_PRESS_ACTION = ACTION_OPT_NONE;
|
|
||||||
gEeprom.KEY_2_LONG_PRESS_ACTION = ACTION_OPT_NONE;
|
|
||||||
gEeprom.KEY_M_LONG_PRESS_ACTION = ACTION_OPT_NONE;
|
|
||||||
|
|
||||||
RADIO_InitInfo(gRxVfo, FREQ_CHANNEL_LAST - 1, 43400000); // LPD
|
GUI_SelectNextDisplay(DISPLAY_AIRCOPY);
|
||||||
|
|
||||||
gRxVfo->CHANNEL_BANDWIDTH = BANDWIDTH_NARROW;
|
|
||||||
gRxVfo->OUTPUT_POWER = OUTPUT_POWER_LOW1;
|
|
||||||
|
|
||||||
RADIO_ConfigureSquelchAndOutputPower(gRxVfo);
|
|
||||||
|
|
||||||
gCurrentVfo = gRxVfo;
|
|
||||||
|
|
||||||
RADIO_SetupRegisters(true);
|
|
||||||
BK4819_SetupAircopy();
|
|
||||||
BK4819_ResetFSK();
|
|
||||||
|
|
||||||
gAircopyState = AIRCOPY_READY;
|
|
||||||
|
|
||||||
gEeprom.BACKLIGHT_TIME = 61;
|
|
||||||
gEeprom.KEY_LOCK = 0;
|
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_RESUME_STATE
|
|
||||||
gEeprom.CURRENT_STATE = 0; // Don't resume is active...
|
|
||||||
#endif
|
|
||||||
|
|
||||||
GUI_SelectNextDisplay(DISPLAY_AIRCOPY);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
else
|
|
||||||
{
|
|
||||||
GUI_SelectNextDisplay(DISPLAY_MAIN);
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
GUI_SelectNextDisplay(DISPLAY_MAIN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
+2
-2
@@ -20,10 +20,10 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include "driver/keyboard.h"
|
#include "driver/keyboard.h"
|
||||||
|
|
||||||
|
#if defined(ENABLE_FEAT_F4HWN_RESCUE_OPS) || defined(ENABLE_AIRCOPY)
|
||||||
enum BOOT_Mode_t
|
enum BOOT_Mode_t
|
||||||
{
|
{
|
||||||
BOOT_MODE_NORMAL = 0,
|
BOOT_MODE_NORMAL = 0,
|
||||||
BOOT_MODE_F_LOCK,
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
||||||
BOOT_MODE_RESCUE_OPS,
|
BOOT_MODE_RESCUE_OPS,
|
||||||
#endif
|
#endif
|
||||||
@@ -38,4 +38,4 @@ BOOT_Mode_t BOOT_GetMode(void);
|
|||||||
void BOOT_ProcessMode(BOOT_Mode_t Mode);
|
void BOOT_ProcessMode(BOOT_Mode_t Mode);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
@@ -140,6 +140,7 @@ void Main(void) {
|
|||||||
AM_fix_init();
|
AM_fix_init();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(ENABLE_FEAT_F4HWN_RESCUE_OPS) || defined(ENABLE_AIRCOPY)
|
||||||
BOOT_Mode_t BootMode = BOOT_GetMode();
|
BOOT_Mode_t BootMode = BOOT_GetMode();
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
||||||
@@ -160,48 +161,21 @@ void Main(void) {
|
|||||||
*/
|
*/
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
|
||||||
if (BootMode == BOOT_MODE_F_LOCK && gEeprom.MENU_LOCK == true)
|
|
||||||
{
|
|
||||||
BootMode = BOOT_MODE_NORMAL;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (BootMode == BOOT_MODE_F_LOCK) {
|
|
||||||
|
|
||||||
gF_LOCK = true; // flag to say include the hidden menu items
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN
|
|
||||||
gEeprom.KEY_LOCK = 0;
|
|
||||||
SETTINGS_SaveSettings();
|
|
||||||
#ifndef ENABLE_VOX
|
|
||||||
gMenuCursor = 67; // move to hidden section, fix me if change... !!! Remove VOX and Mic Bar
|
|
||||||
#else
|
|
||||||
gMenuCursor = 68; // move to hidden section, fix me if change... !!!
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef ENABLE_NOAA
|
|
||||||
gMenuCursor += 1; // move to hidden section, fix me if change... !!!
|
|
||||||
#endif
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
|
||||||
gMenuCursor += 1; // move to hidden section, fix me if change... !!!
|
|
||||||
#endif
|
|
||||||
gSubMenuSelection = gSetting_F_LOCK;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
// count the number of menu items
|
// count the number of menu items
|
||||||
gMenuListCount = 0;
|
gMenuListCount = 0;
|
||||||
while (MenuList[gMenuListCount].name[0] != '\0') {
|
while (MenuList[gMenuListCount].name[0] != '\0') {
|
||||||
if (!gF_LOCK && MenuList[gMenuListCount].menu_id == FIRST_HIDDEN_MENU_ITEM)
|
|
||||||
break;
|
|
||||||
|
|
||||||
gMenuListCount++;
|
gMenuListCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// wait for user to release all butts before moving on
|
// wait for user to release all butts before moving on
|
||||||
if (!GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT) ||
|
if (!GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT) ||
|
||||||
KEYBOARD_Poll() != KEY_INVALID ||
|
KEYBOARD_Poll() != KEY_INVALID
|
||||||
BootMode != BOOT_MODE_NORMAL) { // keys are pressed
|
#if defined(ENABLE_FEAT_F4HWN_RESCUE_OPS) || defined(ENABLE_AIRCOPY)
|
||||||
|
|| BootMode != BOOT_MODE_NORMAL
|
||||||
|
#endif
|
||||||
|
) { // keys are pressed
|
||||||
UI_DisplayReleaseKeys();
|
UI_DisplayReleaseKeys();
|
||||||
BACKLIGHT_TurnOn();
|
BACKLIGHT_TurnOn();
|
||||||
|
|
||||||
@@ -249,7 +223,9 @@ void Main(void) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(ENABLE_FEAT_F4HWN_RESCUE_OPS) || defined(ENABLE_AIRCOPY)
|
||||||
BOOT_ProcessMode(BootMode);
|
BOOT_ProcessMode(BootMode);
|
||||||
|
#endif
|
||||||
|
|
||||||
GPIO_ClearBit(&GPIOA->DATA, GPIOA_PIN_VOICE_0);
|
GPIO_ClearBit(&GPIOA->DATA, GPIOA_PIN_VOICE_0);
|
||||||
|
|
||||||
|
|||||||
@@ -30,11 +30,6 @@ const uint8_t menu_timeout_500ms = 20000 / 500; // 20 second
|
|||||||
const uint16_t menu_timeout_long_500ms = 120000 / 500; // 2 minutes
|
const uint16_t menu_timeout_long_500ms = 120000 / 500; // 2 minutes
|
||||||
|
|
||||||
const uint8_t DTMF_RX_live_timeout_500ms = 6000 / 500; // 6 seconds live decoder on screen
|
const uint8_t DTMF_RX_live_timeout_500ms = 6000 / 500; // 6 seconds live decoder on screen
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
const uint8_t DTMF_RX_timeout_500ms = 10000 / 500; // 10 seconds till we wipe the DTMF receiver
|
|
||||||
const uint8_t DTMF_decode_ring_countdown_500ms = 15000 / 500; // 15 seconds .. time we sound the ringing for
|
|
||||||
const uint8_t DTMF_txstop_countdown_500ms = 3000 / 500; // 6 seconds
|
|
||||||
#endif
|
|
||||||
|
|
||||||
const uint8_t key_input_timeout_500ms = 8000 / 500; // 8 seconds
|
const uint8_t key_input_timeout_500ms = 8000 / 500; // 8 seconds
|
||||||
|
|
||||||
@@ -95,7 +90,6 @@ const uint8_t gMicGain_dB2[5] = {3, 8, 16, 24, 31};
|
|||||||
bool gSetting_200TX;
|
bool gSetting_200TX;
|
||||||
bool gSetting_500TX;
|
bool gSetting_500TX;
|
||||||
#endif
|
#endif
|
||||||
bool gSetting_350EN = true;
|
|
||||||
uint8_t gSetting_F_LOCK;
|
uint8_t gSetting_F_LOCK;
|
||||||
bool gSetting_ScrambleEnable;
|
bool gSetting_ScrambleEnable;
|
||||||
|
|
||||||
@@ -111,18 +105,8 @@ enum BacklightOnRxTx_t gSetting_backlight_on_tx_rx;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN
|
#ifdef ENABLE_FEAT_F4HWN
|
||||||
uint8_t gSetting_set_pwr = 1;
|
|
||||||
bool gSetting_set_ptt = 0;
|
bool gSetting_set_ptt = 0;
|
||||||
uint8_t gSetting_set_tot = 0;
|
|
||||||
uint8_t gSetting_set_ctr = 10;
|
|
||||||
bool gSetting_set_inv = false;
|
bool gSetting_set_inv = false;
|
||||||
uint8_t gSetting_set_eot = 0;
|
|
||||||
bool gSetting_set_lck = false;
|
|
||||||
bool gSetting_set_met = 0;
|
|
||||||
bool gSetting_set_gui = 0;
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_NARROWER
|
|
||||||
bool gSetting_set_nfm = 0;
|
|
||||||
#endif
|
|
||||||
bool gSetting_set_tmr = 0;
|
bool gSetting_set_tmr = 0;
|
||||||
bool gSetting_set_ptt_session;
|
bool gSetting_set_ptt_session;
|
||||||
#ifdef ENABLE_FEAT_F4HWN_DEBUG
|
#ifdef ENABLE_FEAT_F4HWN_DEBUG
|
||||||
@@ -134,10 +118,8 @@ enum BacklightOnRxTx_t gSetting_backlight_on_tx_rx;
|
|||||||
uint8_t crc[15] = { 0 };
|
uint8_t crc[15] = { 0 };
|
||||||
uint8_t lErrorsDuringAirCopy = 0;
|
uint8_t lErrorsDuringAirCopy = 0;
|
||||||
uint8_t gAircopyStep = 0;
|
uint8_t gAircopyStep = 0;
|
||||||
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
|
||||||
bool gPowerHigh = false;
|
bool gPowerHigh = false;
|
||||||
bool gRemoveOffset = false;
|
bool gRemoveOffset = false;
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_AUDIO_BAR
|
#ifdef ENABLE_AUDIO_BAR
|
||||||
|
|||||||
@@ -43,7 +43,7 @@
|
|||||||
|
|
||||||
enum {
|
enum {
|
||||||
MR_CHANNEL_FIRST = 0,
|
MR_CHANNEL_FIRST = 0,
|
||||||
MR_CHANNEL_LAST = 199u,
|
MR_CHANNEL_LAST = 170u, // 171 memory channels, 32 byte records (settings.h EEPROM layout)
|
||||||
FREQ_CHANNEL_FIRST = 200u,
|
FREQ_CHANNEL_FIRST = 200u,
|
||||||
FREQ_CHANNEL_LAST = 206u,
|
FREQ_CHANNEL_LAST = 206u,
|
||||||
NOAA_CHANNEL_FIRST = 207u,
|
NOAA_CHANNEL_FIRST = 207u,
|
||||||
@@ -90,11 +90,6 @@ extern const uint8_t menu_timeout_500ms;
|
|||||||
extern const uint16_t menu_timeout_long_500ms;
|
extern const uint16_t menu_timeout_long_500ms;
|
||||||
|
|
||||||
extern const uint8_t DTMF_RX_live_timeout_500ms;
|
extern const uint8_t DTMF_RX_live_timeout_500ms;
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
extern const uint8_t DTMF_RX_timeout_500ms;
|
|
||||||
extern const uint8_t DTMF_decode_ring_countdown_500ms;
|
|
||||||
extern const uint8_t DTMF_txstop_countdown_500ms;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extern const uint8_t key_input_timeout_500ms;
|
extern const uint8_t key_input_timeout_500ms;
|
||||||
|
|
||||||
@@ -148,7 +143,6 @@ extern bool gSetting_200TX;
|
|||||||
extern bool gSetting_500TX;
|
extern bool gSetting_500TX;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern bool gSetting_350EN;
|
|
||||||
extern uint8_t gSetting_F_LOCK;
|
extern uint8_t gSetting_F_LOCK;
|
||||||
extern bool gSetting_ScrambleEnable;
|
extern bool gSetting_ScrambleEnable;
|
||||||
|
|
||||||
@@ -164,18 +158,8 @@ extern enum BacklightOnRxTx_t gSetting_backlight_on_tx_rx;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN
|
#ifdef ENABLE_FEAT_F4HWN
|
||||||
extern uint8_t gSetting_set_pwr;
|
|
||||||
extern bool gSetting_set_ptt;
|
extern bool gSetting_set_ptt;
|
||||||
extern uint8_t gSetting_set_tot;
|
|
||||||
extern uint8_t gSetting_set_ctr;
|
|
||||||
extern bool gSetting_set_inv;
|
extern bool gSetting_set_inv;
|
||||||
extern uint8_t gSetting_set_eot;
|
|
||||||
extern bool gSetting_set_lck;
|
|
||||||
extern bool gSetting_set_met;
|
|
||||||
extern bool gSetting_set_gui;
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_NARROWER
|
|
||||||
extern bool gSetting_set_nfm;
|
|
||||||
#endif
|
|
||||||
extern bool gSetting_set_tmr;
|
extern bool gSetting_set_tmr;
|
||||||
extern bool gSetting_set_ptt_session;
|
extern bool gSetting_set_ptt_session;
|
||||||
#ifdef ENABLE_FEAT_F4HWN_DEBUG
|
#ifdef ENABLE_FEAT_F4HWN_DEBUG
|
||||||
@@ -187,10 +171,8 @@ extern enum BacklightOnRxTx_t gSetting_backlight_on_tx_rx;
|
|||||||
extern uint8_t crc[15];
|
extern uint8_t crc[15];
|
||||||
extern uint8_t lErrorsDuringAirCopy;
|
extern uint8_t lErrorsDuringAirCopy;
|
||||||
extern uint8_t gAircopyStep;
|
extern uint8_t gAircopyStep;
|
||||||
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
|
||||||
extern bool gPowerHigh;
|
extern bool gPowerHigh;
|
||||||
extern bool gRemoveOffset;
|
extern bool gRemoveOffset;
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_AUDIO_BAR
|
#ifdef ENABLE_AUDIO_BAR
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
#define PRINTF_DISABLE_SUPPORT_LONG_LONG
|
|
||||||
#define PRINTF_DISABLE_SUPPORT_EXPONENTIAL
|
|
||||||
#define PRINTF_DISABLE_SUPPORT_PTRDIFF_T
|
|
||||||
#define PRINTF_DISABLE_SUPPORT_FLOAT
|
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
#include "frequencies.h"
|
#include "frequencies.h"
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
RADIO_CHANNEL_UP = 0x01u,
|
RADIO_CHANNEL_UP = 0x01u,
|
||||||
RADIO_CHANNEL_DOWN = 0xFFu,
|
RADIO_CHANNEL_DOWN = 0xFFu,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -42,8 +42,7 @@ enum PTT_ID_t {
|
|||||||
};
|
};
|
||||||
typedef enum PTT_ID_t PTT_ID_t;
|
typedef enum PTT_ID_t PTT_ID_t;
|
||||||
|
|
||||||
enum VfoState_t
|
enum VfoState_t {
|
||||||
{
|
|
||||||
VFO_STATE_NORMAL = 0,
|
VFO_STATE_NORMAL = 0,
|
||||||
VFO_STATE_BUSY,
|
VFO_STATE_BUSY,
|
||||||
VFO_STATE_BAT_LOW,
|
VFO_STATE_BAT_LOW,
|
||||||
@@ -60,28 +59,35 @@ typedef enum {
|
|||||||
MODULATION_AM,
|
MODULATION_AM,
|
||||||
MODULATION_USB,
|
MODULATION_USB,
|
||||||
|
|
||||||
#ifdef ENABLE_BYP_RAW_DEMODULATORS
|
|
||||||
MODULATION_BYP,
|
MODULATION_BYP,
|
||||||
MODULATION_RAW,
|
MODULATION_RAW,
|
||||||
#endif
|
|
||||||
|
MODULATION_ALAM,
|
||||||
|
MODULATION_BEEP,
|
||||||
|
MODULATION_CTCO,
|
||||||
|
MODULATION_FSK,
|
||||||
|
MODULATION_UNK4,
|
||||||
|
MODULATION_UNK5,
|
||||||
|
MODULATION_UNK6,
|
||||||
|
MODULATION_UNK7,
|
||||||
|
MODULATION_UNK8,
|
||||||
|
MODULATION_UNK9,
|
||||||
|
|
||||||
MODULATION_UKNOWN
|
MODULATION_UKNOWN
|
||||||
} ModulationMode_t;
|
} ModulationMode_t;
|
||||||
|
|
||||||
extern const char gModulationStr[MODULATION_UKNOWN][4];
|
extern const char gModulationStr[MODULATION_UKNOWN][4];
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
uint32_t Frequency;
|
||||||
uint32_t Frequency;
|
|
||||||
DCS_CodeType_t CodeType;
|
DCS_CodeType_t CodeType;
|
||||||
uint8_t Code;
|
uint8_t Code;
|
||||||
uint8_t Padding[2];
|
uint8_t Padding[2];
|
||||||
} FREQ_Config_t;
|
} FREQ_Config_t;
|
||||||
|
|
||||||
typedef struct VFO_Info_t
|
typedef struct VFO_Info_t {
|
||||||
{
|
FREQ_Config_t freq_config_RX;
|
||||||
FREQ_Config_t freq_config_RX;
|
FREQ_Config_t freq_config_TX;
|
||||||
FREQ_Config_t freq_config_TX;
|
|
||||||
|
|
||||||
// this is for a purpose of the FrequencyReverse function
|
// this is for a purpose of the FrequencyReverse function
|
||||||
// it points to freq_config_RX normally and to freq_config_TX if reverse function is active
|
// it points to freq_config_RX normally and to freq_config_TX if reverse function is active
|
||||||
@@ -92,82 +98,94 @@ typedef struct VFO_Info_t
|
|||||||
// it points to freq_config_TX normally and to freq_config_RX if reverse function is active
|
// it points to freq_config_TX normally and to freq_config_RX if reverse function is active
|
||||||
FREQ_Config_t *pTX;
|
FREQ_Config_t *pTX;
|
||||||
|
|
||||||
uint32_t TX_OFFSET_FREQUENCY;
|
uint32_t TX_OFFSET_FREQUENCY;
|
||||||
uint16_t StepFrequency;
|
uint16_t StepFrequency;
|
||||||
|
|
||||||
uint8_t CHANNEL_SAVE;
|
uint8_t CHANNEL_SAVE;
|
||||||
|
|
||||||
uint8_t TX_OFFSET_FREQUENCY_DIRECTION;
|
uint8_t TX_OFFSET_FREQUENCY_DIRECTION;
|
||||||
|
|
||||||
uint8_t SquelchOpenRSSIThresh;
|
uint8_t SquelchOpenRSSIThresh;
|
||||||
uint8_t SquelchOpenNoiseThresh;
|
uint8_t SquelchOpenNoiseThresh;
|
||||||
uint8_t SquelchCloseGlitchThresh;
|
uint8_t SquelchCloseGlitchThresh;
|
||||||
uint8_t SquelchCloseRSSIThresh;
|
uint8_t SquelchCloseRSSIThresh;
|
||||||
uint8_t SquelchCloseNoiseThresh;
|
uint8_t SquelchCloseNoiseThresh;
|
||||||
uint8_t SquelchOpenGlitchThresh;
|
uint8_t SquelchOpenGlitchThresh;
|
||||||
|
|
||||||
STEP_Setting_t STEP_SETTING;
|
STEP_Setting_t STEP_SETTING;
|
||||||
uint8_t TX_LOCK;
|
uint8_t OUTPUT_POWER;
|
||||||
uint8_t OUTPUT_POWER;
|
uint8_t TXP_CalculatedSetting;
|
||||||
uint8_t TXP_CalculatedSetting;
|
bool FrequencyReverse;
|
||||||
bool FrequencyReverse;
|
|
||||||
|
|
||||||
uint8_t SCRAMBLING_TYPE;
|
uint16_t SCRAMBLING_TYPE;
|
||||||
uint8_t CHANNEL_BANDWIDTH;
|
uint8_t CHANNEL_BANDWIDTH;
|
||||||
|
|
||||||
uint8_t SCANLIST1_PARTICIPATION;
|
uint8_t SCANLIST1_PARTICIPATION;
|
||||||
uint8_t SCANLIST2_PARTICIPATION;
|
uint8_t SCANLIST2_PARTICIPATION;
|
||||||
uint8_t SCANLIST3_PARTICIPATION;
|
uint8_t SCANLIST3_PARTICIPATION;
|
||||||
|
|
||||||
uint8_t Band;
|
uint8_t Band;
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
PTT_ID_t DTMF_PTT_ID_TX_MODE;
|
||||||
uint8_t DTMF_DECODING_ENABLE;
|
|
||||||
#endif
|
|
||||||
PTT_ID_t DTMF_PTT_ID_TX_MODE;
|
|
||||||
|
|
||||||
uint8_t BUSY_CHANNEL_LOCK;
|
uint8_t BUSY_CHANNEL_LOCK;
|
||||||
|
|
||||||
ModulationMode_t Modulation;
|
ModulationMode_t Modulation;
|
||||||
|
|
||||||
uint8_t Compander;
|
uint8_t Compander;
|
||||||
|
|
||||||
char Name[16];
|
char Name[16];
|
||||||
} VFO_Info_t;
|
} VFO_Info_t;
|
||||||
|
|
||||||
// Settings of the main VFO that is selected by the user
|
// Settings of the main VFO that is selected by the user
|
||||||
// The pointer follows gEeprom.TX_VFO index
|
// The pointer follows gEeprom.TX_VFO index
|
||||||
extern VFO_Info_t *gTxVfo;
|
extern VFO_Info_t *gTxVfo;
|
||||||
|
|
||||||
// Settings of the actual VFO that is now used for RX,
|
// Settings of the actual VFO that is now used for RX,
|
||||||
// It is being alternated by dual watch, and flipped by crossband
|
// It is being alternated by dual watch, and flipped by crossband
|
||||||
// The pointer follows gEeprom.RX_VFO
|
// The pointer follows gEeprom.RX_VFO
|
||||||
extern VFO_Info_t *gRxVfo;
|
extern VFO_Info_t *gRxVfo;
|
||||||
|
|
||||||
// Equal to gTxVfo unless dual watch changes it on incomming transmition (this can only happen when XB off and DW on)
|
// Equal to gTxVfo unless dual watch changes it on incomming transmition (this can only happen when XB off and DW on)
|
||||||
extern VFO_Info_t *gCurrentVfo;
|
extern VFO_Info_t *gCurrentVfo;
|
||||||
|
|
||||||
extern DCS_CodeType_t gCurrentCodeType;
|
extern DCS_CodeType_t gCurrentCodeType;
|
||||||
|
|
||||||
extern VfoState_t VfoState[2];
|
extern VfoState_t VfoState[2];
|
||||||
|
|
||||||
|
bool RADIO_CheckValidChannel(uint16_t channel, bool checkScanList, uint8_t scanList);
|
||||||
|
|
||||||
|
uint8_t RADIO_FindNextChannel(uint8_t ChNum, int8_t Direction, bool bCheckScanList, uint8_t RadioNum);
|
||||||
|
|
||||||
|
void RADIO_InitInfo(VFO_Info_t *pInfo, const uint8_t ChannelSave, const uint32_t Frequency);
|
||||||
|
|
||||||
|
void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure);
|
||||||
|
|
||||||
|
void RADIO_ConfigureSquelchAndOutputPower(VFO_Info_t *pInfo);
|
||||||
|
|
||||||
|
void RADIO_ApplyOffset(VFO_Info_t *pInfo);
|
||||||
|
|
||||||
|
void RADIO_SelectVfos(void);
|
||||||
|
|
||||||
|
void RADIO_SetupRegisters(bool switchToForeground);
|
||||||
|
|
||||||
bool RADIO_CheckValidChannel(uint16_t channel, bool checkScanList, uint8_t scanList);
|
|
||||||
uint8_t RADIO_FindNextChannel(uint8_t ChNum, int8_t Direction, bool bCheckScanList, uint8_t RadioNum);
|
|
||||||
void RADIO_InitInfo(VFO_Info_t *pInfo, const uint8_t ChannelSave, const uint32_t Frequency);
|
|
||||||
void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure);
|
|
||||||
void RADIO_ConfigureSquelchAndOutputPower(VFO_Info_t *pInfo);
|
|
||||||
void RADIO_ApplyOffset(VFO_Info_t *pInfo);
|
|
||||||
void RADIO_SelectVfos(void);
|
|
||||||
void RADIO_SetupRegisters(bool switchToForeground);
|
|
||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_NOAA
|
||||||
void RADIO_ConfigureNOAA(void);
|
void RADIO_ConfigureNOAA(void);
|
||||||
#endif
|
#endif
|
||||||
void RADIO_SetTxParameters(void);
|
|
||||||
void RADIO_SetupAGC(bool listeningAM, bool disable);
|
void RADIO_SetTxParameters(void);
|
||||||
void RADIO_SetModulation(ModulationMode_t modulation);
|
|
||||||
void RADIO_SetVfoState(VfoState_t State);
|
void RADIO_SetupAGC(bool listeningAM, bool disable);
|
||||||
void RADIO_PrepareTX(void);
|
|
||||||
void RADIO_SendCssTail(void);
|
void RADIO_SetModulation(ModulationMode_t modulation);
|
||||||
void RADIO_PrepareCssTX(void);
|
|
||||||
void RADIO_SendEndOfTransmission(void);
|
void RADIO_SetVfoState(VfoState_t State);
|
||||||
|
|
||||||
|
void RADIO_PrepareTX(void);
|
||||||
|
|
||||||
|
void RADIO_SendCssTail(void);
|
||||||
|
|
||||||
|
void RADIO_PrepareCssTX(void);
|
||||||
|
|
||||||
|
void RADIO_SendEndOfTransmission(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
+3
-2
@@ -57,13 +57,14 @@ void SystickHandler(void)
|
|||||||
gNextTimeslice_500ms = true;
|
gNextTimeslice_500ms = true;
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN
|
#ifdef ENABLE_FEAT_F4HWN
|
||||||
DECREMENT_AND_TRIGGER(gTxTimerCountdownAlert_500ms - ALERT_TOT * 2, gTxTimeoutReachedAlert);
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_RX_TX_TIMER
|
#ifdef ENABLE_FEAT_F4HWN_RX_TX_TIMER
|
||||||
DECREMENT(gRxTimerCountdown_500ms);
|
DECREMENT(gRxTimerCountdown_500ms);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
DECREMENT_AND_TRIGGER(gTxTimerCountdown_500ms, gTxTimeoutReached);
|
if (gEeprom.TX_TIMEOUT_TIMER != 0) {
|
||||||
|
DECREMENT_AND_TRIGGER(gTxTimerCountdown_500ms, gTxTimeoutReached);
|
||||||
|
}
|
||||||
DECREMENT(gSerialConfigCountDown_500ms);
|
DECREMENT(gSerialConfigCountDown_500ms);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+64
-149
@@ -28,6 +28,7 @@
|
|||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "ui/menu.h"
|
#include "ui/menu.h"
|
||||||
|
#include "app/messages.h"
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_RESET_CHANNEL
|
#ifdef ENABLE_FEAT_F4HWN_RESET_CHANNEL
|
||||||
static const uint32_t gDefaultFrequencyTable[] =
|
static const uint32_t gDefaultFrequencyTable[] =
|
||||||
@@ -40,9 +41,16 @@ static const uint32_t gDefaultFrequencyTable[] =
|
|||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// EEPROM layout checks (see settings.h)
|
||||||
|
_Static_assert(EEPROM_CH_A_COUNT * EEPROM_CH_SIZE <= 0x0E40U, "channels overlap the settings");
|
||||||
|
_Static_assert(EEPROM_CH_ATTR_BASE + 207U <= EEPROM_VFO_BASE, "channel attributes overlap the VFOs");
|
||||||
|
_Static_assert(MR_CHANNEL_LAST + 1U > EEPROM_CH_A_COUNT, "channel layout expects a second channel area");
|
||||||
|
_Static_assert(EEPROM_CH_END <= SEQParameterEEPROM, "channels overlap the message store");
|
||||||
|
|
||||||
EEPROM_Config_t gEeprom = {0};
|
EEPROM_Config_t gEeprom = {0};
|
||||||
|
|
||||||
void SETTINGS_InitEEPROM(void) {
|
void SETTINGS_InitEEPROM(void) {
|
||||||
|
MESSAGES_GET();
|
||||||
uint8_t Data[16] = {0};
|
uint8_t Data[16] = {0};
|
||||||
// 0E70..0E77
|
// 0E70..0E77
|
||||||
EEPROM_ReadBuffer(0x0E70, Data, 8);
|
EEPROM_ReadBuffer(0x0E70, Data, 8);
|
||||||
@@ -53,12 +61,9 @@ void SETTINGS_InitEEPROM(void) {
|
|||||||
gEeprom.NOAA_AUTO_SCAN = (Data[3] < 2) ? Data[3] : false;
|
gEeprom.NOAA_AUTO_SCAN = (Data[3] < 2) ? Data[3] : false;
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
||||||
gEeprom.KEY_LOCK = (Data[4] & 0x01) != 0;
|
|
||||||
gEeprom.MENU_LOCK = (Data[4] & 0x02) != 0;
|
gEeprom.MENU_LOCK = (Data[4] & 0x02) != 0;
|
||||||
gEeprom.SET_KEY = ((Data[4] >> 2) & 0x0F) > 4 ? 0 : (Data[4] >> 2) & 0x0F;
|
|
||||||
#else
|
|
||||||
gEeprom.KEY_LOCK = (Data[4] < 2) ? Data[4] : false;
|
|
||||||
#endif
|
#endif
|
||||||
|
gEeprom.KEY_LOCK = (Data[4] < 2) != 0 && Data[4];
|
||||||
#ifdef ENABLE_VOX
|
#ifdef ENABLE_VOX
|
||||||
gEeprom.VOX_SWITCH = (Data[5] < 2) ? Data[5] : false;
|
gEeprom.VOX_SWITCH = (Data[5] < 2) ? Data[5] : false;
|
||||||
gEeprom.VOX_LEVEL = (Data[6] < 10) ? Data[6] : 1;
|
gEeprom.VOX_LEVEL = (Data[6] < 10) ? Data[6] : 1;
|
||||||
@@ -77,12 +82,8 @@ void SETTINGS_InitEEPROM(void) {
|
|||||||
gEeprom.BATTERY_SAVE = (Data[3] < 6) ? Data[3] : 4;
|
gEeprom.BATTERY_SAVE = (Data[3] < 6) ? Data[3] : 4;
|
||||||
gEeprom.DUAL_WATCH = (Data[4] < 3) ? Data[4] : DUAL_WATCH_CHAN_A;
|
gEeprom.DUAL_WATCH = (Data[4] < 3) ? Data[4] : DUAL_WATCH_CHAN_A;
|
||||||
gEeprom.BACKLIGHT_TIME = (Data[5] < 62) ? Data[5] : 12;
|
gEeprom.BACKLIGHT_TIME = (Data[5] < 62) ? Data[5] : 12;
|
||||||
#ifdef ENABLE_FEAT_F4HWN_NARROWER
|
|
||||||
gEeprom.TAIL_TONE_ELIMINATION = Data[6] & 0x01;
|
gEeprom.TAIL_TONE_ELIMINATION = (Data[6] < 2) != 0 && Data[6];
|
||||||
gSetting_set_nfm = (Data[6] >> 1) & 0x01;
|
|
||||||
#else
|
|
||||||
gEeprom.TAIL_TONE_ELIMINATION = (Data[6] < 2) ? Data[6] : false;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_RESUME_STATE
|
#ifdef ENABLE_FEAT_F4HWN_RESUME_STATE
|
||||||
gEeprom.VFO_OPEN = Data[7] & 0x01;
|
gEeprom.VFO_OPEN = Data[7] & 0x01;
|
||||||
@@ -142,7 +143,7 @@ void SETTINGS_InitEEPROM(void) {
|
|||||||
gEeprom.KEY_2_LONG_PRESS_ACTION = (Data[4] < ACTION_OPT_LEN) ? Data[4] : ACTION_OPT_NONE;
|
gEeprom.KEY_2_LONG_PRESS_ACTION = (Data[4] < ACTION_OPT_LEN) ? Data[4] : ACTION_OPT_NONE;
|
||||||
gEeprom.SCAN_RESUME_MODE = (Data[5] < 105) ? Data[5] : 14;
|
gEeprom.SCAN_RESUME_MODE = (Data[5] < 105) ? Data[5] : 14;
|
||||||
gEeprom.AUTO_KEYPAD_LOCK = (Data[6] < 41) ? Data[6] : 0;
|
gEeprom.AUTO_KEYPAD_LOCK = (Data[6] < 41) ? Data[6] : 0;
|
||||||
gEeprom.FSKMode = Data[7];
|
gEeprom.FSKMode = (Data[7] <= MODEM_LAST) ? Data[7] : MOD_FSK_1200;
|
||||||
// 0E98..0E9F
|
// 0E98..0E9F
|
||||||
#ifdef ENABLE_PWRON_PASSWORD
|
#ifdef ENABLE_PWRON_PASSWORD
|
||||||
EEPROM_ReadBuffer(0x0E98, Data, 8);
|
EEPROM_ReadBuffer(0x0E98, Data, 8);
|
||||||
@@ -178,12 +179,6 @@ void SETTINGS_InitEEPROM(void) {
|
|||||||
EEPROM_ReadBuffer(0x0ED0, Data, 8);
|
EEPROM_ReadBuffer(0x0ED0, Data, 8);
|
||||||
gEeprom.DTMF_SIDE_TONE = (Data[0] < 2) ? Data[0] : true;
|
gEeprom.DTMF_SIDE_TONE = (Data[0] < 2) ? Data[0] : true;
|
||||||
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
gEeprom.DTMF_SEPARATE_CODE = DTMF_ValidateCodes((char *)(Data + 1), 1) ? Data[1] : '*';
|
|
||||||
gEeprom.DTMF_GROUP_CALL_CODE = DTMF_ValidateCodes((char *)(Data + 2), 1) ? Data[2] : '#';
|
|
||||||
gEeprom.DTMF_DECODE_RESPONSE = (Data[3] < 4) ? Data[3] : 0;
|
|
||||||
gEeprom.DTMF_auto_reset_time = (Data[4] < 61) ? Data[4] : (Data[4] >= 5) ? Data[4] : 10;
|
|
||||||
#endif
|
|
||||||
gEeprom.DTMF_PRELOAD_TIME = (Data[5] < 101) ? Data[5] * 10 : 300;
|
gEeprom.DTMF_PRELOAD_TIME = (Data[5] < 101) ? Data[5] * 10 : 300;
|
||||||
gEeprom.DTMF_FIRST_CODE_PERSIST_TIME = (Data[6] < 101) ? Data[6] * 10 : 100;
|
gEeprom.DTMF_FIRST_CODE_PERSIST_TIME = (Data[6] < 101) ? Data[6] * 10 : 100;
|
||||||
gEeprom.DTMF_HASH_CODE_PERSIST_TIME = (Data[7] < 101) ? Data[7] * 10 : 100;
|
gEeprom.DTMF_HASH_CODE_PERSIST_TIME = (Data[7] < 101) ? Data[7] * 10 : 100;
|
||||||
@@ -192,35 +187,6 @@ void SETTINGS_InitEEPROM(void) {
|
|||||||
EEPROM_ReadBuffer(0x0ED8, Data, 8);
|
EEPROM_ReadBuffer(0x0ED8, Data, 8);
|
||||||
gEeprom.DTMF_CODE_PERSIST_TIME = (Data[0] < 101) ? Data[0] * 10 : 100;
|
gEeprom.DTMF_CODE_PERSIST_TIME = (Data[0] < 101) ? Data[0] * 10 : 100;
|
||||||
gEeprom.DTMF_CODE_INTERVAL_TIME = (Data[1] < 101) ? Data[1] * 10 : 100;
|
gEeprom.DTMF_CODE_INTERVAL_TIME = (Data[1] < 101) ? Data[1] * 10 : 100;
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
gEeprom.PERMIT_REMOTE_KILL = (Data[2] < 2) ? Data[2] : true;
|
|
||||||
|
|
||||||
// 0EE0..0EE7
|
|
||||||
|
|
||||||
EEPROM_ReadBuffer(0x0EE0, Data, sizeof(gEeprom.ANI_DTMF_ID));
|
|
||||||
if (DTMF_ValidateCodes((char *)Data, sizeof(gEeprom.ANI_DTMF_ID))) {
|
|
||||||
memcpy(gEeprom.ANI_DTMF_ID, Data, sizeof(gEeprom.ANI_DTMF_ID));
|
|
||||||
} else {
|
|
||||||
strcpy(gEeprom.ANI_DTMF_ID, "123");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// 0EE8..0EEF
|
|
||||||
EEPROM_ReadBuffer(0x0EE8, Data, sizeof(gEeprom.KILL_CODE));
|
|
||||||
if (DTMF_ValidateCodes((char *)Data, sizeof(gEeprom.KILL_CODE))) {
|
|
||||||
memcpy(gEeprom.KILL_CODE, Data, sizeof(gEeprom.KILL_CODE));
|
|
||||||
} else {
|
|
||||||
strcpy(gEeprom.KILL_CODE, "ABCD9");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 0EF0..0EF7
|
|
||||||
EEPROM_ReadBuffer(0x0EF0, Data, sizeof(gEeprom.REVIVE_CODE));
|
|
||||||
if (DTMF_ValidateCodes((char *)Data, sizeof(gEeprom.REVIVE_CODE))) {
|
|
||||||
memcpy(gEeprom.REVIVE_CODE, Data, sizeof(gEeprom.REVIVE_CODE));
|
|
||||||
} else {
|
|
||||||
strcpy(gEeprom.REVIVE_CODE, "9DCBA");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// 0EF8..0F07
|
// 0EF8..0F07
|
||||||
EEPROM_ReadBuffer(0x0EF8, Data, sizeof(gEeprom.DTMF_UP_CODE));
|
EEPROM_ReadBuffer(0x0EF8, Data, sizeof(gEeprom.DTMF_UP_CODE));
|
||||||
@@ -274,21 +240,16 @@ void SETTINGS_InitEEPROM(void) {
|
|||||||
gEeprom.FSKSRCAddress |= Data[1] << 8;
|
gEeprom.FSKSRCAddress |= Data[1] << 8;
|
||||||
gEeprom.FSKSRCAddress |= Data[2] << 16;
|
gEeprom.FSKSRCAddress |= Data[2] << 16;
|
||||||
gEeprom.FSKSRCAddress |= Data[3] << 24;
|
gEeprom.FSKSRCAddress |= Data[3] << 24;
|
||||||
|
// 0x0F25 held leftover scan list bytes before, so ON is a magic value
|
||||||
|
gEeprom.POCSAG_MONITOR = Data[5] == 0x5A;
|
||||||
|
#ifdef ENABLE_FMRADIO
|
||||||
|
gEeprom.BK1080_AGC_ENABLED = Data[4] & 0x01;
|
||||||
|
gEeprom.BK1080_BLEND_CONFIG = (Data[4] >> 1) & 0x03;
|
||||||
|
gEeprom.BK1080_DEEMPHASIS_CONFIG = (Data[4] >> 3) & 0x03;
|
||||||
|
#endif
|
||||||
// 0F40..0F47
|
// 0F40..0F47
|
||||||
EEPROM_ReadBuffer(0x0F40, Data, 8);
|
EEPROM_ReadBuffer(0x0F40, Data, 8);
|
||||||
gSetting_F_LOCK = (Data[0] < F_LOCK_LEN) ? Data[0] : F_LOCK_DEF;
|
gSetting_F_LOCK = (Data[0] < F_LOCK_LEN) ? Data[0] : F_LOCK_DEF;
|
||||||
#ifndef ENABLE_FEAT_F4HWN
|
|
||||||
gSetting_350TX = (Data[1] < 2) ? Data[1] : false; // was true
|
|
||||||
#endif
|
|
||||||
#ifndef ENABLE_FEAT_F4HWN
|
|
||||||
gSetting_200TX = (Data[3] < 2) ? Data[3] : false;
|
|
||||||
gSetting_500TX = (Data[4] < 2) ? Data[4] : false;
|
|
||||||
gSetting_350EN = (Data[5] < 2) ? Data[5] : true;
|
|
||||||
#else
|
|
||||||
gSetting_350EN = true;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
gSetting_ScrambleEnable = true;
|
gSetting_ScrambleEnable = true;
|
||||||
|
|
||||||
//gSetting_TX_EN = (Data[7] & (1u << 0)) ? true : false;
|
//gSetting_TX_EN = (Data[7] & (1u << 0)) ? true : false;
|
||||||
@@ -310,7 +271,7 @@ void SETTINGS_InitEEPROM(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 0D60..0E27
|
// 0D60..0E27
|
||||||
EEPROM_ReadBuffer(0x0D60, gMR_ChannelAttributes, sizeof(gMR_ChannelAttributes));
|
EEPROM_ReadBuffer(EEPROM_CH_ATTR_BASE, gMR_ChannelAttributes, sizeof(gMR_ChannelAttributes));
|
||||||
for (uint16_t i = 0; i < sizeof(gMR_ChannelAttributes); i++) {
|
for (uint16_t i = 0; i < sizeof(gMR_ChannelAttributes); i++) {
|
||||||
ChannelAttributes_t *att = &gMR_ChannelAttributes[i];
|
ChannelAttributes_t *att = &gMR_ChannelAttributes[i];
|
||||||
if (att->__val == 0xff) {
|
if (att->__val == 0xff) {
|
||||||
@@ -337,20 +298,12 @@ void SETTINGS_InitEEPROM(void) {
|
|||||||
#ifdef ENABLE_FEAT_F4HWN
|
#ifdef ENABLE_FEAT_F4HWN
|
||||||
// 1FF0..0x1FF7
|
// 1FF0..0x1FF7
|
||||||
EEPROM_ReadBuffer(0x1FF0, Data, 8);
|
EEPROM_ReadBuffer(0x1FF0, Data, 8);
|
||||||
gSetting_set_pwr = (((Data[7] & 0xF0) >> 4) < 7) ? ((Data[7] & 0xF0) >> 4) : 0;
|
|
||||||
gSetting_set_ptt = (((Data[7] & 0x0F)) < 2) ? ((Data[7] & 0x0F)) : 0;
|
gSetting_set_ptt = (((Data[7] & 0x0F)) < 2) ? ((Data[7] & 0x0F)) : 0;
|
||||||
|
|
||||||
gSetting_set_tot = (((Data[6] & 0xF0) >> 4) < 4) ? ((Data[6] & 0xF0) >> 4) : 0;
|
|
||||||
gSetting_set_eot = (((Data[6] & 0x0F)) < 4) ? ((Data[6] & 0x0F)) : 0;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
int tmp = ((Data[5] & 0xF0) >> 4);
|
int tmp = ((Data[5] & 0xF0) >> 4);
|
||||||
|
|
||||||
gSetting_set_inv = (((tmp >> 0) & 0x01) < 2) ? ((tmp >> 0) & 0x01): 0;
|
gSetting_set_inv = (((tmp >> 0) & 0x01) < 2) ? ((tmp >> 0) & 0x01): 0;
|
||||||
gSetting_set_lck = (((tmp >> 1) & 0x01) < 2) ? ((tmp >> 1) & 0x01): 0;
|
|
||||||
gSetting_set_met = (((tmp >> 2) & 0x01) < 2) ? ((tmp >> 2) & 0x01): 0;
|
|
||||||
gSetting_set_gui = (((tmp >> 3) & 0x01) < 2) ? ((tmp >> 3) & 0x01): 0;
|
|
||||||
gSetting_set_ctr = (((Data[5] & 0x0F)) > 00 && ((Data[5] & 0x0F)) < 16) ? ((Data[5] & 0x0F)) : 10;
|
|
||||||
|
|
||||||
gSetting_set_tmr = ((Data[4] & 1) < 2) ? (Data[4] & 1): 0;
|
gSetting_set_tmr = ((Data[4] & 1) < 2) ? (Data[4] & 1): 0;
|
||||||
*/
|
*/
|
||||||
@@ -362,16 +315,6 @@ void SETTINGS_InitEEPROM(void) {
|
|||||||
#else
|
#else
|
||||||
gSetting_set_inv = 0;
|
gSetting_set_inv = 0;
|
||||||
#endif
|
#endif
|
||||||
gSetting_set_lck = (tmp >> 1) & 0x01;
|
|
||||||
gSetting_set_met = (tmp >> 2) & 0x01;
|
|
||||||
gSetting_set_gui = (tmp >> 3) & 0x01;
|
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_CTR
|
|
||||||
int ctr_value = Data[5] & 0x0F;
|
|
||||||
gSetting_set_ctr = (ctr_value > 0 && ctr_value < 16) ? ctr_value : 10;
|
|
||||||
#else
|
|
||||||
gSetting_set_ctr = 10;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
gSetting_set_tmr = Data[4] & 0x01;
|
gSetting_set_tmr = Data[4] & 0x01;
|
||||||
#ifdef ENABLE_FEAT_F4HWN_SLEEP
|
#ifdef ENABLE_FEAT_F4HWN_SLEEP
|
||||||
@@ -384,7 +327,6 @@ void SETTINGS_InitEEPROM(void) {
|
|||||||
|
|
||||||
// And set special session settings for actions
|
// And set special session settings for actions
|
||||||
gSetting_set_ptt_session = gSetting_set_ptt;
|
gSetting_set_ptt_session = gSetting_set_ptt;
|
||||||
gEeprom.KEY_LOCK_PTT = gSetting_set_lck;
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -451,7 +393,7 @@ uint32_t SETTINGS_FetchChannelFrequency(const int channel) {
|
|||||||
uint32_t offset;
|
uint32_t offset;
|
||||||
} __attribute__((packed)) info;
|
} __attribute__((packed)) info;
|
||||||
|
|
||||||
EEPROM_ReadBuffer(channel * 16, &info, sizeof(info));
|
EEPROM_ReadBuffer(EEPROM_CH_ADDR(channel), &info, sizeof(info));
|
||||||
|
|
||||||
return info.frequency;
|
return info.frequency;
|
||||||
}
|
}
|
||||||
@@ -468,7 +410,7 @@ void SETTINGS_FetchChannelName(char *s, const int channel) {
|
|||||||
if (!RADIO_CheckValidChannel(channel, false, 0))
|
if (!RADIO_CheckValidChannel(channel, false, 0))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
EEPROM_ReadBuffer(0x0F50 + (channel * 16), s, 10);
|
EEPROM_ReadBuffer(EEPROM_CH_ADDR(channel) + EEPROM_CH_NAME_OFFSET, s, 10);
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < 10; i++)
|
for (i = 0; i < 10; i++)
|
||||||
@@ -492,14 +434,13 @@ void SETTINGS_FactoryReset(bool bIsAll) {
|
|||||||
if (
|
if (
|
||||||
!(i >= 0x0EE0 && i < 0x0F18) && // ANI ID + DTMF codes
|
!(i >= 0x0EE0 && i < 0x0F18) && // ANI ID + DTMF codes
|
||||||
!(i >= 0x0F30 && i < 0x0F50) && // AES KEY + F LOCK + Scramble Enable
|
!(i >= 0x0F30 && i < 0x0F50) && // AES KEY + F LOCK + Scramble Enable
|
||||||
!(i >= 0x1C00 && i < 0x1E00) && // DTMF contacts
|
|
||||||
!(i >= 0x0EB0 && i < 0x0ED0) && // Welcome strings
|
|
||||||
!(i >= 0x0EA0 && i < 0x0EA8) && // Voice Prompt
|
!(i >= 0x0EA0 && i < 0x0EA8) && // Voice Prompt
|
||||||
(bIsAll ||
|
(bIsAll ||
|
||||||
(
|
(
|
||||||
!(i >= 0x0D60 && i < 0x0E28) && // MR Channel Attributes
|
!(i < 0x0E40) && // MR Channels (area A)
|
||||||
|
!(i >= EEPROM_CH_ATTR_BASE && i < EEPROM_VFO_BASE) && // MR Channel Attributes
|
||||||
!(i >= 0x0F18 && i < 0x0F30) && // Scan List
|
!(i >= 0x0F18 && i < 0x0F30) && // Scan List
|
||||||
!(i >= 0x0F50 && i < 0x1C00) && // MR Channel Names
|
!(i >= EEPROM_CH_B_BASE) && // MR Channels (area B) + messages
|
||||||
!(i >= 0x0E40 && i < 0x0E70) && // FM Channels
|
!(i >= 0x0E40 && i < 0x0E70) && // FM Channels
|
||||||
!(i >= 0x0E88 && i < 0x0E90) // FM settings
|
!(i >= 0x0E88 && i < 0x0E90) // FM settings
|
||||||
))
|
))
|
||||||
@@ -594,12 +535,7 @@ void SETTINGS_SaveSettings(void) {
|
|||||||
State[3] = false;
|
State[3] = false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
State[4] = (gEeprom.KEY_LOCK ? 0x01 : 0);
|
||||||
State[4] = (gEeprom.KEY_LOCK ? 0x01 : 0) | (gEeprom.MENU_LOCK ? 0x02 :0) | ((gEeprom.SET_KEY & 0x0F) << 2);
|
|
||||||
#else
|
|
||||||
State[4] = gEeprom.KEY_LOCK;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef ENABLE_VOX
|
#ifdef ENABLE_VOX
|
||||||
State[5] = gEeprom.VOX_SWITCH;
|
State[5] = gEeprom.VOX_SWITCH;
|
||||||
State[6] = gEeprom.VOX_LEVEL;
|
State[6] = gEeprom.VOX_LEVEL;
|
||||||
@@ -630,11 +566,7 @@ void SETTINGS_SaveSettings(void) {
|
|||||||
State[5] = gEeprom.BACKLIGHT_TIME;
|
State[5] = gEeprom.BACKLIGHT_TIME;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_NARROWER
|
State[6] = gEeprom.TAIL_TONE_ELIMINATION & 0x01;
|
||||||
State[6] = (gEeprom.TAIL_TONE_ELIMINATION & 0x01) | ((gSetting_set_nfm & 0x03) << 1);
|
|
||||||
#else
|
|
||||||
State[6] = gEeprom.TAIL_TONE_ELIMINATION;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_RESUME_STATE
|
#ifdef ENABLE_FEAT_F4HWN_RESUME_STATE
|
||||||
State[7] = (gEeprom.VFO_OPEN & 0x01) | ((gEeprom.CURRENT_STATE & 0x07) << 1) |
|
State[7] = (gEeprom.VFO_OPEN & 0x01) | ((gEeprom.CURRENT_STATE & 0x07) << 1) |
|
||||||
@@ -684,12 +616,6 @@ void SETTINGS_SaveSettings(void) {
|
|||||||
EEPROM_WriteBuffer(0x0EA8, State);
|
EEPROM_WriteBuffer(0x0EA8, State);
|
||||||
|
|
||||||
State[0] = gEeprom.DTMF_SIDE_TONE;
|
State[0] = gEeprom.DTMF_SIDE_TONE;
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
State[1] = gEeprom.DTMF_SEPARATE_CODE;
|
|
||||||
State[2] = gEeprom.DTMF_GROUP_CALL_CODE;
|
|
||||||
State[3] = gEeprom.DTMF_DECODE_RESPONSE;
|
|
||||||
State[4] = gEeprom.DTMF_auto_reset_time;
|
|
||||||
#endif
|
|
||||||
State[5] = gEeprom.DTMF_PRELOAD_TIME / 10U;
|
State[5] = gEeprom.DTMF_PRELOAD_TIME / 10U;
|
||||||
State[6] = gEeprom.DTMF_FIRST_CODE_PERSIST_TIME / 10U;
|
State[6] = gEeprom.DTMF_FIRST_CODE_PERSIST_TIME / 10U;
|
||||||
State[7] = gEeprom.DTMF_HASH_CODE_PERSIST_TIME / 10U;
|
State[7] = gEeprom.DTMF_HASH_CODE_PERSIST_TIME / 10U;
|
||||||
@@ -698,9 +624,6 @@ void SETTINGS_SaveSettings(void) {
|
|||||||
memset(State, 0xFF, sizeof(State));
|
memset(State, 0xFF, sizeof(State));
|
||||||
State[0] = gEeprom.DTMF_CODE_PERSIST_TIME / 10U;
|
State[0] = gEeprom.DTMF_CODE_PERSIST_TIME / 10U;
|
||||||
State[1] = gEeprom.DTMF_CODE_INTERVAL_TIME / 10U;
|
State[1] = gEeprom.DTMF_CODE_INTERVAL_TIME / 10U;
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
State[2] = gEeprom.PERMIT_REMOTE_KILL;
|
|
||||||
#endif
|
|
||||||
EEPROM_WriteBuffer(0x0ED8, State);
|
EEPROM_WriteBuffer(0x0ED8, State);
|
||||||
|
|
||||||
State[0] = gEeprom.SCAN_LIST_DEFAULT;
|
State[0] = gEeprom.SCAN_LIST_DEFAULT;
|
||||||
@@ -727,6 +650,13 @@ void SETTINGS_SaveSettings(void) {
|
|||||||
State[1] = (gEeprom.FSKSRCAddress >> 8) & 0xFF;
|
State[1] = (gEeprom.FSKSRCAddress >> 8) & 0xFF;
|
||||||
State[2] = (gEeprom.FSKSRCAddress >> 16) & 0xFF;
|
State[2] = (gEeprom.FSKSRCAddress >> 16) & 0xFF;
|
||||||
State[3] = (gEeprom.FSKSRCAddress >> 24) & 0xFF;
|
State[3] = (gEeprom.FSKSRCAddress >> 24) & 0xFF;
|
||||||
|
#ifdef ENABLE_FMRADIO
|
||||||
|
State[4] = ((gEeprom.BK1080_AGC_ENABLED & 0x01) |
|
||||||
|
((gEeprom.BK1080_BLEND_CONFIG & 0x03) << 1) |
|
||||||
|
((gEeprom.BK1080_DEEMPHASIS_CONFIG & 0x03) << 3));
|
||||||
|
#endif
|
||||||
|
State[5] = gEeprom.POCSAG_MONITOR ? 0x5A : 0x00;
|
||||||
|
|
||||||
EEPROM_WriteBuffer(0x0F20, State);
|
EEPROM_WriteBuffer(0x0F20, State);
|
||||||
|
|
||||||
memset(State, 0xFF, sizeof(State));
|
memset(State, 0xFF, sizeof(State));
|
||||||
@@ -738,8 +668,6 @@ void SETTINGS_SaveSettings(void) {
|
|||||||
State[3] = gSetting_200TX;
|
State[3] = gSetting_200TX;
|
||||||
State[4] = gSetting_500TX;
|
State[4] = gSetting_500TX;
|
||||||
#endif
|
#endif
|
||||||
State[5] = gSetting_350EN;
|
|
||||||
|
|
||||||
State[6] = gSetting_ScrambleEnable;
|
State[6] = gSetting_ScrambleEnable;
|
||||||
|
|
||||||
//if (!gSetting_TX_EN) State[7] &= ~(1u << 0);
|
//if (!gSetting_TX_EN) State[7] &= ~(1u << 0);
|
||||||
@@ -774,12 +702,6 @@ void SETTINGS_SaveSettings(void) {
|
|||||||
|
|
||||||
if(gSetting_set_inv == 1)
|
if(gSetting_set_inv == 1)
|
||||||
tmp = tmp | (1 << 0);
|
tmp = tmp | (1 << 0);
|
||||||
if (gSetting_set_lck == 1)
|
|
||||||
tmp = tmp | (1 << 1);
|
|
||||||
if (gSetting_set_met == 1)
|
|
||||||
tmp = tmp | (1 << 2);
|
|
||||||
if (gSetting_set_gui == 1)
|
|
||||||
tmp = tmp | (1 << 3);
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_SLEEP
|
#ifdef ENABLE_FEAT_F4HWN_SLEEP
|
||||||
@@ -788,20 +710,16 @@ void SETTINGS_SaveSettings(void) {
|
|||||||
State[4] = gSetting_set_tmr ? (1 << 0) : 0;
|
State[4] = gSetting_set_tmr ? (1 << 0) : 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
tmp = (gSetting_set_inv << 0) |
|
tmp = (gSetting_set_inv << 0);
|
||||||
(gSetting_set_lck << 1) |
|
|
||||||
(gSetting_set_met << 2) |
|
|
||||||
(gSetting_set_gui << 3);
|
|
||||||
|
|
||||||
State[5] = ((tmp << 4) | (gSetting_set_ctr & 0x0F));
|
State[5] = (tmp << 4);
|
||||||
State[6] = ((gSetting_set_tot << 4) | (gSetting_set_eot & 0x0F));
|
State[7] = gSetting_set_ptt & 0x0F;
|
||||||
State[7] = ((gSetting_set_pwr << 4) | (gSetting_set_ptt & 0x0F));
|
|
||||||
|
|
||||||
gEeprom.KEY_LOCK_PTT = gSetting_set_lck;
|
|
||||||
|
|
||||||
EEPROM_WriteBuffer(0x1FF0, State);
|
EEPROM_WriteBuffer(0x1FF0, State);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
MSG_EnableRX(true);
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_VOL
|
#ifdef ENABLE_FEAT_F4HWN_VOL
|
||||||
SETTINGS_WriteCurrentVol();
|
SETTINGS_WriteCurrentVol();
|
||||||
#endif
|
#endif
|
||||||
@@ -813,17 +731,17 @@ void SETTINGS_SaveChannel(uint8_t Channel, uint8_t VFO, const VFO_Info_t *pVFO,
|
|||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
uint16_t OffsetVFO = Channel * 16;
|
uint16_t OffsetVFO = EEPROM_CH_ADDR(Channel);
|
||||||
|
|
||||||
if (IS_FREQ_CHANNEL(Channel)) { // it's a VFO, not a channel
|
if (IS_FREQ_CHANNEL(Channel)) { // it's a VFO, not a channel
|
||||||
OffsetVFO = (VFO == 0) ? 0x0C80 : 0x0C90;
|
OffsetVFO = EEPROM_VFO_ADDR(Channel - FREQ_CHANNEL_FIRST, VFO);
|
||||||
OffsetVFO += (Channel - FREQ_CHANNEL_FIRST) * 32;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Mode >= 2 || IS_FREQ_CHANNEL(Channel)) { // copy VFO to a channel
|
if (Mode >= 2 || IS_FREQ_CHANNEL(Channel)) { // copy VFO to a channel
|
||||||
union {
|
union {
|
||||||
uint8_t _8[8];
|
uint8_t _8[8];
|
||||||
uint32_t _32[2];
|
uint32_t _32[2];
|
||||||
|
uint16_t _16[4];
|
||||||
} State;
|
} State;
|
||||||
|
|
||||||
State._32[0] = pVFO->freq_config_RX.Frequency;
|
State._32[0] = pVFO->freq_config_RX.Frequency;
|
||||||
@@ -835,20 +753,20 @@ void SETTINGS_SaveChannel(uint8_t Channel, uint8_t VFO, const VFO_Info_t *pVFO,
|
|||||||
State._8[2] = (pVFO->freq_config_TX.CodeType << 4) | pVFO->freq_config_RX.CodeType;
|
State._8[2] = (pVFO->freq_config_TX.CodeType << 4) | pVFO->freq_config_RX.CodeType;
|
||||||
State._8[3] = (pVFO->Modulation << 4) | pVFO->TX_OFFSET_FREQUENCY_DIRECTION;
|
State._8[3] = (pVFO->Modulation << 4) | pVFO->TX_OFFSET_FREQUENCY_DIRECTION;
|
||||||
State._8[4] = 0
|
State._8[4] = 0
|
||||||
| (pVFO->TX_LOCK << 6)
|
| (pVFO->BUSY_CHANNEL_LOCK << 6)
|
||||||
| (pVFO->BUSY_CHANNEL_LOCK << 5)
|
| (pVFO->OUTPUT_POWER << 3)
|
||||||
| (pVFO->OUTPUT_POWER << 2)
|
|
||||||
| (pVFO->CHANNEL_BANDWIDTH << 1)
|
| (pVFO->CHANNEL_BANDWIDTH << 1)
|
||||||
| (pVFO->FrequencyReverse << 0);
|
| (pVFO->FrequencyReverse << 0);
|
||||||
State._8[5] = ((pVFO->DTMF_PTT_ID_TX_MODE & 7u) << 1)
|
State._8[5] = ((pVFO->DTMF_PTT_ID_TX_MODE & 7u) << 1)
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
| ((pVFO->DTMF_DECODING_ENABLE & 1u) << 0)
|
|
||||||
#endif
|
|
||||||
;
|
;
|
||||||
State._8[6] = pVFO->STEP_SETTING;
|
State._8[6] = pVFO->STEP_SETTING;
|
||||||
|
EEPROM_WriteBuffer(OffsetVFO + sizeof (State._32), State._8);
|
||||||
|
|
||||||
|
// +24 block: name[8..9] (kept), scrambler, spare
|
||||||
|
EEPROM_ReadBuffer(OffsetVFO + 24, State._8, sizeof(State._8));
|
||||||
|
State._16[1] = pVFO->SCRAMBLING_TYPE;
|
||||||
|
EEPROM_WriteBuffer(OffsetVFO + 24, State._8);
|
||||||
|
|
||||||
State._8[7] = pVFO->SCRAMBLING_TYPE;
|
|
||||||
EEPROM_WriteBuffer(OffsetVFO + 8, State._8);
|
|
||||||
|
|
||||||
SETTINGS_UpdateChannel(Channel, pVFO, true, true, true);
|
SETTINGS_UpdateChannel(Channel, pVFO, true, true, true);
|
||||||
|
|
||||||
@@ -876,11 +794,16 @@ void SETTINGS_SaveBatteryCalibration(const uint16_t *batteryCalibration) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SETTINGS_SaveChannelName(uint8_t channel, const char *name) {
|
void SETTINGS_SaveChannelName(uint8_t channel, const char *name) {
|
||||||
uint16_t offset = channel * 16;
|
// name[0..7] at +16, name[8..9] at +24 (the rest of that block is the scrambler)
|
||||||
|
const uint16_t offset = EEPROM_CH_ADDR(channel) + EEPROM_CH_NAME_OFFSET;
|
||||||
uint8_t buf[16] = {0};
|
uint8_t buf[16] = {0};
|
||||||
memcpy(buf, name, MIN(strlen(name), 10u));
|
memcpy(buf, name, MIN(strlen(name), 10u));
|
||||||
EEPROM_WriteBuffer(0x0F50 + offset, buf);
|
EEPROM_WriteBuffer(offset, buf);
|
||||||
EEPROM_WriteBuffer(0x0F58 + offset, buf + 8);
|
uint8_t tail[8];
|
||||||
|
EEPROM_ReadBuffer(offset + 8, tail, sizeof(tail));
|
||||||
|
tail[0] = buf[8];
|
||||||
|
tail[1] = buf[9];
|
||||||
|
EEPROM_WriteBuffer(offset + 8, tail);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SETTINGS_UpdateChannel(uint8_t channel, const VFO_Info_t *pVFO, bool keep, bool check, bool save) {
|
void SETTINGS_UpdateChannel(uint8_t channel, const VFO_Info_t *pVFO, bool keep, bool check, bool save) {
|
||||||
@@ -897,7 +820,7 @@ void SETTINGS_UpdateChannel(uint8_t channel, const VFO_Info_t *pVFO, bool keep,
|
|||||||
.scanlist3 = 0,
|
.scanlist3 = 0,
|
||||||
}; // default attributes
|
}; // default attributes
|
||||||
|
|
||||||
uint16_t offset = 0x0D60 + (channel & ~7u);
|
uint16_t offset = EEPROM_CH_ATTR_BASE + (channel & ~7u);
|
||||||
EEPROM_ReadBuffer(offset, state, sizeof(state));
|
EEPROM_ReadBuffer(offset, state, sizeof(state));
|
||||||
|
|
||||||
if (keep) {
|
if (keep) {
|
||||||
@@ -959,9 +882,6 @@ void SETTINGS_WriteBuildOptions(void) {
|
|||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_PWRON_PASSWORD
|
#ifdef ENABLE_PWRON_PASSWORD
|
||||||
| (1 << 6)
|
| (1 << 6)
|
||||||
#endif
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
| (1 << 7)
|
|
||||||
#endif
|
#endif
|
||||||
;
|
;
|
||||||
|
|
||||||
@@ -972,22 +892,17 @@ void SETTINGS_WriteBuildOptions(void) {
|
|||||||
#ifdef ENABLE_WIDE_RX
|
#ifdef ENABLE_WIDE_RX
|
||||||
| (1 << 1)
|
| (1 << 1)
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_BYP_RAW_DEMODULATORS
|
|
||||||
| (1 << 2)
|
| (1 << 2)
|
||||||
#endif
|
|
||||||
#ifdef ENABLE_BLMIN_TMP_OFF
|
#ifdef ENABLE_BLMIN_TMP_OFF
|
||||||
| (1 << 3)
|
| (1 << 3)
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_AM_FIX
|
#ifdef ENABLE_AM_FIX
|
||||||
| (1 << 4)
|
| (1 << 4)
|
||||||
#endif
|
|
||||||
#ifdef ENABLE_SPECTRUM
|
|
||||||
| (1 << 5)
|
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
#ifdef ENABLE_SPECTRUM
|
||||||
| (1 << 6)
|
| (1 << 5)
|
||||||
#endif
|
#endif
|
||||||
;
|
| (1 << 6);
|
||||||
EEPROM_WriteBuffer(0x1FF0, State);
|
EEPROM_WriteBuffer(0x1FF0, State);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1019,8 +934,8 @@ void SETTINGS_WriteCurrentVol(void) {
|
|||||||
|
|
||||||
void SETTINGS_ResetTxLock(void) {
|
void SETTINGS_ResetTxLock(void) {
|
||||||
uint8_t State[8];
|
uint8_t State[8];
|
||||||
for (uint8_t channel = 0; channel < 200; channel++) {
|
for (uint8_t channel = MR_CHANNEL_FIRST; channel <= MR_CHANNEL_LAST; channel++) {
|
||||||
uint16_t OffsetVFO = channel * 16;
|
uint16_t OffsetVFO = EEPROM_CH_ADDR(channel);
|
||||||
EEPROM_ReadBuffer(OffsetVFO + 8, State, sizeof(State));
|
EEPROM_ReadBuffer(OffsetVFO + 8, State, sizeof(State));
|
||||||
State[4] |= (1 << 6);
|
State[4] |= (1 << 6);
|
||||||
EEPROM_WriteBuffer(OffsetVFO + 8, State);
|
EEPROM_WriteBuffer(OffsetVFO + 8, State);
|
||||||
|
|||||||
+57
-26
@@ -27,16 +27,53 @@
|
|||||||
#include "app/fskmodem.h"
|
#include "app/fskmodem.h"
|
||||||
#include <driver/backlight.h>
|
#include <driver/backlight.h>
|
||||||
|
|
||||||
|
// ---- EEPROM layout (keep chirp/uvk5_brnpocsag.py in sync) ----
|
||||||
|
// Channel / VFO record, 32 bytes:
|
||||||
|
// +0 frequency, offset +8 codes, modulation, flags, step, (spare)
|
||||||
|
// +16 name[0..7] +24 name[8..9], scrambler (u16), 4 spare
|
||||||
|
// 0x0000 channels 0 .. EEPROM_CH_A_COUNT-1
|
||||||
|
// 0x0E40 settings ... 0x0F4F (unused in this build: logo 0x0EB0, DTMF ANI/kill
|
||||||
|
// codes 0x0EE0, power-on password 0x0E98, AES key 0x0F30)
|
||||||
|
// 0x0F50 channel attributes, ChannelAttributes_t[207] (VFO bands at 200..206)
|
||||||
|
// 0x1020 VFOs: 7 bands x (VFO A, VFO B)
|
||||||
|
// 0x11E0 channels EEPROM_CH_A_COUNT .. MR_CHANNEL_LAST
|
||||||
|
// 0x1900 message counters, then the message store (app/messages.h) up to 0x1E00
|
||||||
|
// 0x1E00 calibration
|
||||||
|
#define EEPROM_CH_SIZE 32U
|
||||||
|
#define EEPROM_CH_NAME_OFFSET 16U // 10 characters
|
||||||
|
#define EEPROM_CH_SCR_OFFSET 26U // u16 scrambler, inside the +24 block
|
||||||
|
#define EEPROM_CH_A_COUNT (0x0E40U / EEPROM_CH_SIZE) // 114
|
||||||
|
#define EEPROM_CH_ATTR_BASE 0x0F50U
|
||||||
|
#define EEPROM_VFO_BASE 0x1020U
|
||||||
|
#define EEPROM_VFO_ADDR(band, vfo) ((uint16_t) (EEPROM_VFO_BASE + ((band) * 2U + (vfo)) * EEPROM_CH_SIZE))
|
||||||
|
#define EEPROM_VFO_END EEPROM_VFO_ADDR(7U, 0U) // 0x11E0
|
||||||
|
#define EEPROM_CH_B_BASE EEPROM_VFO_END
|
||||||
|
#define EEPROM_CH_ADDR(ch) ((uint16_t) (((unsigned) (ch) < EEPROM_CH_A_COUNT) ? (unsigned) (ch) * EEPROM_CH_SIZE \
|
||||||
|
: EEPROM_CH_B_BASE + ((unsigned) (ch) - EEPROM_CH_A_COUNT) * EEPROM_CH_SIZE))
|
||||||
|
#define EEPROM_CH_END (EEPROM_CH_B_BASE + (MR_CHANNEL_LAST + 1U - EEPROM_CH_A_COUNT) * EEPROM_CH_SIZE)
|
||||||
|
|
||||||
// Modem Modulation
|
// Modem Modulation
|
||||||
typedef enum ModemModulation {
|
typedef enum ModemModulation {
|
||||||
MOD_FSK_450, // for bad conditions
|
MOD_FSK_450, // for bad conditions
|
||||||
MOD_FSK_700, // for medium conditions
|
MOD_FSK_700, // for medium conditions
|
||||||
|
MOD_FSK_1200,
|
||||||
|
MOD_FSK_2400,
|
||||||
MOD_AFSK_1200, // for good conditions
|
MOD_AFSK_1200, // for good conditions
|
||||||
MOD_AFSK_2400,
|
MOD_AFSK_2400,
|
||||||
MOD_FSK_1200_2400,
|
MOD_NOAA_SAME,
|
||||||
MOD_NOAA_SAME
|
MOD_POCSAG_1200,
|
||||||
|
MOD_POCSAG_512, // appended so stored settings keep their meaning
|
||||||
|
MOD_POCSAG_2400
|
||||||
} ModemModulation;
|
} ModemModulation;
|
||||||
|
|
||||||
|
#ifdef ENABLE_POCSAG
|
||||||
|
#define MODEM_IS_POCSAG(mode) ((mode) >= MOD_POCSAG_1200 && (mode) <= MOD_POCSAG_2400)
|
||||||
|
#define MODEM_LAST MOD_POCSAG_2400
|
||||||
|
#else
|
||||||
|
#define MODEM_IS_POCSAG(mode) false // POCSAG code is compiled out (dead branches)
|
||||||
|
#define MODEM_LAST MOD_NOAA_SAME
|
||||||
|
#endif
|
||||||
|
|
||||||
enum POWER_OnDisplayMode_t {
|
enum POWER_OnDisplayMode_t {
|
||||||
#ifdef ENABLE_FEAT_F4HWN
|
#ifdef ENABLE_FEAT_F4HWN
|
||||||
POWER_ON_DISPLAY_MODE_ALL,
|
POWER_ON_DISPLAY_MODE_ALL,
|
||||||
@@ -98,8 +135,7 @@ enum {
|
|||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
OUTPUT_POWER_USER = 0,
|
OUTPUT_POWER_LOW1 = 0,
|
||||||
OUTPUT_POWER_LOW1,
|
|
||||||
OUTPUT_POWER_LOW2,
|
OUTPUT_POWER_LOW2,
|
||||||
OUTPUT_POWER_LOW3,
|
OUTPUT_POWER_LOW3,
|
||||||
OUTPUT_POWER_LOW4,
|
OUTPUT_POWER_LOW4,
|
||||||
@@ -125,15 +161,10 @@ enum ACTION_OPT_t {
|
|||||||
ACTION_OPT_BLMIN_TMP_OFF, //BackLight Minimum Temporay OFF
|
ACTION_OPT_BLMIN_TMP_OFF, //BackLight Minimum Temporay OFF
|
||||||
#ifdef ENABLE_FEAT_F4HWN
|
#ifdef ENABLE_FEAT_F4HWN
|
||||||
ACTION_OPT_RXMODE,
|
ACTION_OPT_RXMODE,
|
||||||
ACTION_OPT_MAINONLY,
|
|
||||||
ACTION_OPT_PTT,
|
ACTION_OPT_PTT,
|
||||||
ACTION_OPT_WN,
|
ACTION_OPT_WN,
|
||||||
ACTION_OPT_BACKLIGHT,
|
ACTION_OPT_BACKLIGHT,
|
||||||
ACTION_OPT_MUTE,
|
ACTION_OPT_MUTE,
|
||||||
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
|
||||||
ACTION_OPT_POWER_HIGH,
|
|
||||||
ACTION_OPT_REMOVE_OFFSET,
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_REGA
|
#ifdef ENABLE_REGA
|
||||||
ACTION_OPT_REGA_ALARM,
|
ACTION_OPT_REGA_ALARM,
|
||||||
@@ -173,6 +204,19 @@ enum CHANNEL_DisplayMode_t {
|
|||||||
};
|
};
|
||||||
typedef enum CHANNEL_DisplayMode_t CHANNEL_DisplayMode_t;
|
typedef enum CHANNEL_DisplayMode_t CHANNEL_DisplayMode_t;
|
||||||
|
|
||||||
|
enum BK1080_DEEMPHASIS {
|
||||||
|
DEEMPHASIS_OFF = 0,
|
||||||
|
DEEMPHASIS_USA = 1,
|
||||||
|
DEEMPHASIS_EUR = 2
|
||||||
|
};
|
||||||
|
|
||||||
|
enum BK1080_BLEND {
|
||||||
|
BLEND_DEF = 0,
|
||||||
|
BLEND_POS6 = 1,
|
||||||
|
BLEND_NEG12 = 2,
|
||||||
|
BLEND_NEG6 = 3
|
||||||
|
};
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint8_t ScreenChannel[2]; // current channels set in the radio (memory or frequency channels)
|
uint8_t ScreenChannel[2]; // current channels set in the radio (memory or frequency channels)
|
||||||
uint8_t FreqChannel[2]; // last frequency channels used
|
uint8_t FreqChannel[2]; // last frequency channels used
|
||||||
@@ -198,6 +242,9 @@ typedef struct {
|
|||||||
bool FM_IsMrMode;
|
bool FM_IsMrMode;
|
||||||
uint16_t FM_FrequencyPlaying;
|
uint16_t FM_FrequencyPlaying;
|
||||||
uint8_t FM_Band : 2;
|
uint8_t FM_Band : 2;
|
||||||
|
enum BK1080_DEEMPHASIS BK1080_DEEMPHASIS_CONFIG: 2;
|
||||||
|
enum BK1080_BLEND BK1080_BLEND_CONFIG : 2;
|
||||||
|
bool BK1080_AGC_ENABLED;
|
||||||
//uint8_t FM_Space : 2;
|
//uint8_t FM_Space : 2;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -207,10 +254,7 @@ typedef struct {
|
|||||||
#ifdef ENABLE_FEAT_F4HWN
|
#ifdef ENABLE_FEAT_F4HWN
|
||||||
bool KEY_LOCK_PTT;
|
bool KEY_LOCK_PTT;
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
|
||||||
bool MENU_LOCK;
|
bool MENU_LOCK;
|
||||||
uint8_t SET_KEY;
|
|
||||||
#endif
|
|
||||||
bool VOX_SWITCH;
|
bool VOX_SWITCH;
|
||||||
uint8_t VOX_LEVEL;
|
uint8_t VOX_LEVEL;
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
@@ -254,11 +298,6 @@ typedef struct {
|
|||||||
uint8_t MIC_SENSITIVITY;
|
uint8_t MIC_SENSITIVITY;
|
||||||
uint8_t MIC_SENSITIVITY_TUNING;
|
uint8_t MIC_SENSITIVITY_TUNING;
|
||||||
uint8_t CHAN_1_CALL;
|
uint8_t CHAN_1_CALL;
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
char ANI_DTMF_ID[8];
|
|
||||||
char KILL_CODE[8];
|
|
||||||
char REVIVE_CODE[8];
|
|
||||||
#endif
|
|
||||||
char DTMF_UP_CODE[16];
|
char DTMF_UP_CODE[16];
|
||||||
|
|
||||||
uint8_t field57_0x6c;
|
uint8_t field57_0x6c;
|
||||||
@@ -269,21 +308,12 @@ typedef struct {
|
|||||||
uint8_t field60_0x7e;
|
uint8_t field60_0x7e;
|
||||||
uint8_t field61_0x7f;
|
uint8_t field61_0x7f;
|
||||||
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
char DTMF_SEPARATE_CODE;
|
|
||||||
char DTMF_GROUP_CALL_CODE;
|
|
||||||
uint8_t DTMF_DECODE_RESPONSE;
|
|
||||||
uint8_t DTMF_auto_reset_time;
|
|
||||||
#endif
|
|
||||||
uint16_t DTMF_PRELOAD_TIME;
|
uint16_t DTMF_PRELOAD_TIME;
|
||||||
uint16_t DTMF_FIRST_CODE_PERSIST_TIME;
|
uint16_t DTMF_FIRST_CODE_PERSIST_TIME;
|
||||||
uint16_t DTMF_HASH_CODE_PERSIST_TIME;
|
uint16_t DTMF_HASH_CODE_PERSIST_TIME;
|
||||||
uint16_t DTMF_CODE_PERSIST_TIME;
|
uint16_t DTMF_CODE_PERSIST_TIME;
|
||||||
uint16_t DTMF_CODE_INTERVAL_TIME;
|
uint16_t DTMF_CODE_INTERVAL_TIME;
|
||||||
bool DTMF_SIDE_TONE;
|
bool DTMF_SIDE_TONE;
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
bool PERMIT_REMOTE_KILL;
|
|
||||||
#endif
|
|
||||||
int16_t BK4819_XTAL_FREQ_LOW;
|
int16_t BK4819_XTAL_FREQ_LOW;
|
||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_NOAA
|
||||||
bool NOAA_AUTO_SCAN;
|
bool NOAA_AUTO_SCAN;
|
||||||
@@ -317,6 +347,7 @@ typedef struct {
|
|||||||
|
|
||||||
ModemModulation FSKMode;
|
ModemModulation FSKMode;
|
||||||
uint32_t FSKSRCAddress;
|
uint32_t FSKSRCAddress;
|
||||||
|
bool POCSAG_MONITOR; // POCSAG: receive pages for every RIC
|
||||||
} EEPROM_Config_t;
|
} EEPROM_Config_t;
|
||||||
|
|
||||||
extern EEPROM_Config_t gEeprom;
|
extern EEPROM_Config_t gEeprom;
|
||||||
|
|||||||
@@ -0,0 +1,134 @@
|
|||||||
|
// Host-side test: cc -std=c11 -I. tests/test_pocsag.c app/pocsag.c -o test_pocsag && ./test_pocsag
|
||||||
|
#include "app/pocsag.h"
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
// Known-good page (from the uv-k5-pocsag reference): RIC 260321, "test 1234 miau! :3",
|
||||||
|
// followed by a second page in the next batch. Logical bit order, MSB first.
|
||||||
|
static const uint8_t reference_batch[] = {
|
||||||
|
0x7C, 0xD2, 0x15, 0xD8, 0x7A, 0x89, 0xC1, 0x97, 0x7A, 0x89, 0xC1, 0x97, 0x0F, 0xE3, 0x9E, 0x99,
|
||||||
|
0x97, 0xA7, 0x9B, 0x51, 0xCB, 0x82, 0x8F, 0x72, 0xC9, 0xB3, 0x13, 0x0C, 0xE0, 0x56, 0xE2, 0x79,
|
||||||
|
0xDC, 0x3A, 0xF1, 0xB4, 0x88, 0x12, 0xEB, 0xE1, 0xCC, 0x00, 0x01, 0x97, 0x7A, 0x89, 0xC1, 0x97,
|
||||||
|
0x7A, 0x89, 0xC1, 0x97, 0x7A, 0x89, 0xC1, 0x97, 0x7A, 0x89, 0xC1, 0x97, 0x7A, 0x89, 0xC1, 0x97,
|
||||||
|
0x7A, 0x89, 0xC1, 0x97,
|
||||||
|
};
|
||||||
|
|
||||||
|
static void invert(uint8_t *buffer, size_t size)
|
||||||
|
{
|
||||||
|
for (size_t i = 0; i < size; i++)
|
||||||
|
buffer[i] = (uint8_t)~buffer[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
static const uint32_t capcodes[] = {0, 1, 7, 8, 123456, 260321, 0x1FFFFF};
|
||||||
|
uint8_t frame[POCSAG_MAX_FRAME_SIZE];
|
||||||
|
char decoded[POCSAG_MAX_MESSAGE_LENGTH + 1U];
|
||||||
|
uint32_t sender;
|
||||||
|
size_t frame_size;
|
||||||
|
|
||||||
|
// Encoder must match the reference transmitter bit for bit.
|
||||||
|
assert(POCSAG_Encode(260321U, "test 1234 miau! :3", frame, sizeof(frame), &frame_size));
|
||||||
|
assert(frame_size == POCSAG_MAX_FRAME_SIZE);
|
||||||
|
for (size_t i = 0; i < POCSAG_PREAMBLE_BYTES; i++)
|
||||||
|
assert(frame[i] == 0xAA);
|
||||||
|
if (memcmp(frame + POCSAG_PREAMBLE_BYTES, reference_batch, sizeof(reference_batch)) != 0) {
|
||||||
|
fprintf(stderr, "encoder output differs from reference batch\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Decoder must read the reference.
|
||||||
|
assert(POCSAG_Decode(reference_batch, sizeof(reference_batch), 260321U, &sender,
|
||||||
|
decoded, sizeof(decoded)));
|
||||||
|
assert(sender == 260321U);
|
||||||
|
assert(strcmp(decoded, "test 1234 miau! :3") == 0);
|
||||||
|
assert(!POCSAG_Decode(reference_batch, sizeof(reference_batch), 260320U, NULL,
|
||||||
|
decoded, sizeof(decoded)));
|
||||||
|
|
||||||
|
for (size_t i = 0; i < sizeof(capcodes) / sizeof(capcodes[0]); i++) {
|
||||||
|
static const char *messages[] = {"Hello pager", "12345678901234567890", "A"};
|
||||||
|
for (size_t m = 0; m < sizeof(messages) / sizeof(messages[0]); m++) {
|
||||||
|
assert(POCSAG_Encode(capcodes[i], messages[m], frame, sizeof(frame), &frame_size));
|
||||||
|
assert(frame_size == POCSAG_MAX_FRAME_SIZE);
|
||||||
|
|
||||||
|
sender = 0xFFFFFFFFU;
|
||||||
|
if (!POCSAG_Decode(frame, frame_size, capcodes[i], &sender, decoded, sizeof(decoded)) ||
|
||||||
|
strcmp(decoded, messages[m]) != 0) {
|
||||||
|
fprintf(stderr, "decode failed for capcode %lu '%s'\n",
|
||||||
|
(unsigned long)capcodes[i], messages[m]);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
assert(sender == capcodes[i]);
|
||||||
|
|
||||||
|
// What the radio's RX buffer looks like: sync + 128 bytes after the chip sync.
|
||||||
|
const uint8_t *rx = frame + POCSAG_PREAMBLE_BYTES;
|
||||||
|
assert(POCSAG_Decode(rx, 4U + 128U, capcodes[i], NULL, decoded, sizeof(decoded)));
|
||||||
|
assert(strcmp(decoded, messages[m]) == 0);
|
||||||
|
|
||||||
|
// Single bit error in the address codeword gets corrected.
|
||||||
|
const size_t address_byte = POCSAG_PREAMBLE_BYTES + 4U + (capcodes[i] & 7U) * 8U + 1U;
|
||||||
|
frame[address_byte] ^= 0x10U;
|
||||||
|
assert(POCSAG_Decode(frame, frame_size, capcodes[i], NULL, decoded, sizeof(decoded)));
|
||||||
|
assert(strcmp(decoded, messages[m]) == 0);
|
||||||
|
frame[address_byte] ^= 0x10U;
|
||||||
|
|
||||||
|
// Inverted polarity is detected via the inverted sync word.
|
||||||
|
invert(frame, frame_size);
|
||||||
|
assert(POCSAG_Decode(frame, frame_size, capcodes[i], NULL, decoded, sizeof(decoded)));
|
||||||
|
assert(strcmp(decoded, messages[m]) == 0);
|
||||||
|
invert(frame, frame_size);
|
||||||
|
|
||||||
|
assert(!POCSAG_Decode(frame, frame_size, capcodes[i] ^ 0x100U, NULL,
|
||||||
|
decoded, sizeof(decoded)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Radio RX: the chip locks anywhere in the preamble and the capture is cut off
|
||||||
|
// when the transmission ends (decoded on squelch close), in both FIFO byte orders.
|
||||||
|
assert(POCSAG_Encode(1234567U, "12345678901234567890", frame, sizeof(frame), NULL));
|
||||||
|
for (size_t lock = 0; lock < POCSAG_PREAMBLE_BYTES; lock++) {
|
||||||
|
const size_t size = sizeof(frame) - lock;
|
||||||
|
assert(POCSAG_Decode(frame + lock, size, 1234567U, NULL, decoded, sizeof(decoded)));
|
||||||
|
assert(strcmp(decoded, "12345678901234567890") == 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sync codeword with 2 bit errors (both batches) still decodes, also inverted.
|
||||||
|
assert(POCSAG_Encode(1234567U, "sync errors", frame, sizeof(frame), NULL));
|
||||||
|
frame[POCSAG_PREAMBLE_BYTES] ^= 0x81U;
|
||||||
|
frame[POCSAG_PREAMBLE_BYTES + POCSAG_BATCH_BYTES + 2U] ^= 0x18U;
|
||||||
|
assert(POCSAG_Decode(frame, sizeof(frame), 1234567U, NULL, decoded, sizeof(decoded)));
|
||||||
|
assert(strcmp(decoded, "sync errors") == 0);
|
||||||
|
invert(frame, sizeof(frame));
|
||||||
|
assert(POCSAG_Decode(frame, sizeof(frame), 1234567U, NULL, decoded, sizeof(decoded)));
|
||||||
|
assert(strcmp(decoded, "sync errors") == 0);
|
||||||
|
|
||||||
|
// Monitor mode: any address decodes and reports the RIC.
|
||||||
|
assert(POCSAG_Encode(1234567U, "Ahoj", frame, sizeof(frame), NULL));
|
||||||
|
assert(POCSAG_Decode(frame, sizeof(frame), POCSAG_ANY_RIC, &sender, decoded, sizeof(decoded)));
|
||||||
|
assert(sender == 1234567U && strcmp(decoded, "Ahoj") == 0);
|
||||||
|
|
||||||
|
assert(!POCSAG_Encode(0x200000U, "bad", frame, sizeof(frame), NULL));
|
||||||
|
assert(!POCSAG_Encode(123U, "", frame, sizeof(frame), NULL));
|
||||||
|
// longest message, for every frame position, then one character too many
|
||||||
|
{
|
||||||
|
char longest[POCSAG_MAX_MESSAGE_LENGTH + 2U];
|
||||||
|
for (size_t i = 0; i < POCSAG_MAX_MESSAGE_LENGTH + 1U; i++)
|
||||||
|
longest[i] = (char) ('A' + i % 26U);
|
||||||
|
longest[POCSAG_MAX_MESSAGE_LENGTH] = '\0';
|
||||||
|
for (uint32_t ric = 0; ric < 8U; ric++) {
|
||||||
|
assert(POCSAG_Encode(1000000U + ric, longest, frame, sizeof(frame), NULL));
|
||||||
|
assert(POCSAG_Decode(frame, sizeof(frame), 1000000U + ric, NULL, decoded, sizeof(decoded)));
|
||||||
|
assert(strcmp(decoded, longest) == 0);
|
||||||
|
}
|
||||||
|
longest[POCSAG_MAX_MESSAGE_LENGTH] = 'X';
|
||||||
|
longest[POCSAG_MAX_MESSAGE_LENGTH + 1U] = '\0';
|
||||||
|
assert(!POCSAG_Encode(123U, longest, frame, sizeof(frame), NULL));
|
||||||
|
}
|
||||||
|
assert(!POCSAG_Encode(123U, "ok", frame, sizeof(frame) - 1U, NULL));
|
||||||
|
|
||||||
|
puts("pocsag tests passed");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
+2
-2
@@ -52,7 +52,7 @@ void UI_DisplayAircopy(void)
|
|||||||
gAircopyState = AIRCOPY_READY;
|
gAircopyState = AIRCOPY_READY;
|
||||||
}
|
}
|
||||||
|
|
||||||
UI_PrintString(pPrintStr, 2, 127, 0, 8);
|
UI_PrintString(pPrintStr, 2, 127, 0 /*, 8 */);
|
||||||
|
|
||||||
if (gInputBoxIndex == 0) {
|
if (gInputBoxIndex == 0) {
|
||||||
uint32_t frequency = gRxVfo->freq_config_RX.Frequency;
|
uint32_t frequency = gRxVfo->freq_config_RX.Frequency;
|
||||||
@@ -83,7 +83,7 @@ void UI_DisplayAircopy(void)
|
|||||||
// Draw gauge
|
// Draw gauge
|
||||||
if(gAircopyStep != 0)
|
if(gAircopyStep != 0)
|
||||||
{
|
{
|
||||||
UI_PrintString(String, 2, 127, 5, 8);
|
UI_PrintString(String, 2, 127, 5 /*, 8 */);
|
||||||
|
|
||||||
gFrameBuffer[4][1] = 0x3c;
|
gFrameBuffer[4][1] = 0x3c;
|
||||||
gFrameBuffer[4][2] = 0x42;
|
gFrameBuffer[4][2] = 0x42;
|
||||||
|
|||||||
+54
-6
@@ -29,13 +29,61 @@
|
|||||||
#include "ui/inputbox.h"
|
#include "ui/inputbox.h"
|
||||||
#include "ui/ui.h"
|
#include "ui/ui.h"
|
||||||
|
|
||||||
|
const char gBlendStrings[][4] = {
|
||||||
|
"DEF",
|
||||||
|
"+6 ",
|
||||||
|
"-12",
|
||||||
|
"-6 "
|
||||||
|
};
|
||||||
|
|
||||||
|
const char gDeemphasisStrings[][3] = {
|
||||||
|
"NO",
|
||||||
|
"US",
|
||||||
|
"EU"
|
||||||
|
};
|
||||||
|
|
||||||
|
bool wasStereo;
|
||||||
|
uint8_t oldRssi;
|
||||||
|
|
||||||
|
void UI_UpdateFMThings(bool force) {
|
||||||
|
force = force;
|
||||||
|
char String[16] = {0};
|
||||||
|
const uint16_t Status = BK1080_ReadRegister(BK1080_REG_10_RSSI_STATUS);
|
||||||
|
|
||||||
|
bool isStereo = Status & (1 << 9);
|
||||||
|
uint8_t rssi = Status & 0xFF;
|
||||||
|
|
||||||
|
if (!force && isStereo == wasStereo && rssi == oldRssi) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
oldRssi = rssi;
|
||||||
|
wasStereo = isStereo;
|
||||||
|
|
||||||
|
sprintf(String, "%s RSSI%d/255",
|
||||||
|
isStereo ? "STER" : "MONO", rssi);
|
||||||
|
|
||||||
|
UI_PrintStringSmallNormal(String, 1, 0, 4);
|
||||||
|
ST7565_BlitLine(4);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void UI_DisplayFM(void)
|
void UI_DisplayFM(void)
|
||||||
{
|
{
|
||||||
char String[16] = {0};
|
char String[16] = {0};
|
||||||
char *pPrintStr = String;
|
char *pPrintStr = String;
|
||||||
UI_DisplayClear();
|
UI_DisplayClear();
|
||||||
|
|
||||||
UI_PrintString("FM", 2, 0, 0, 8);
|
UI_UpdateFMThings(true);
|
||||||
|
|
||||||
|
UI_PrintString("FM", 2, 0, 0 /*, 8 */);
|
||||||
|
|
||||||
|
|
||||||
|
sprintf(String, "%s D%s B%s",
|
||||||
|
gEeprom.BK1080_AGC_ENABLED ? " AGC" : "NAGC",
|
||||||
|
gDeemphasisStrings[gEeprom.BK1080_DEEMPHASIS_CONFIG],
|
||||||
|
gBlendStrings[gEeprom.BK1080_BLEND_CONFIG]);
|
||||||
|
|
||||||
|
UI_PrintStringSmallNormal(String, 1, 0, 5);
|
||||||
|
|
||||||
sprintf(String, "%d%s-%dM",
|
sprintf(String, "%d%s-%dM",
|
||||||
BK1080_GetFreqLoLimit(gEeprom.FM_Band)/10,
|
BK1080_GetFreqLoLimit(gEeprom.FM_Band)/10,
|
||||||
@@ -55,13 +103,13 @@ void UI_DisplayFM(void)
|
|||||||
pPrintStr = "DEL?";
|
pPrintStr = "DEL?";
|
||||||
} else if (gFM_ScanState == FM_SCAN_OFF) {
|
} else if (gFM_ScanState == FM_SCAN_OFF) {
|
||||||
if (gEeprom.FM_IsMrMode) {
|
if (gEeprom.FM_IsMrMode) {
|
||||||
sprintf(String, "MR(CH%02u)", gEeprom.FM_SelectedChannel + 1);
|
sprintf(String, "CH%02u", gEeprom.FM_SelectedChannel + 1);
|
||||||
pPrintStr = String;
|
pPrintStr = String;
|
||||||
} else {
|
} else {
|
||||||
pPrintStr = "VFO";
|
pPrintStr = "VFO";
|
||||||
for (unsigned int i = 0; i < 20; i++) {
|
for (unsigned int i = 0; i < 20; i++) {
|
||||||
if (gEeprom.FM_FrequencyPlaying == gFM_Channels[i]) {
|
if (gEeprom.FM_FrequencyPlaying == gFM_Channels[i]) {
|
||||||
sprintf(String, "VF(C%02u)", i + 1);
|
sprintf(String, "C%02u MHz", i + 1);
|
||||||
pPrintStr = String;
|
pPrintStr = String;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -74,7 +122,7 @@ void UI_DisplayFM(void)
|
|||||||
pPrintStr = "M-SCN";
|
pPrintStr = "M-SCN";
|
||||||
}
|
}
|
||||||
|
|
||||||
UI_PrintString(pPrintStr, 0, 127, 3, 12); // memory, vfo, scan
|
UI_PrintString(pPrintStr, 0, 127, 3 /*, 12 */); // memory, vfo, scan
|
||||||
|
|
||||||
memset(String, 0, sizeof(String));
|
memset(String, 0, sizeof(String));
|
||||||
if (gAskToSave || (gEeprom.FM_IsMrMode && gInputBoxIndex > 0)) {
|
if (gAskToSave || (gEeprom.FM_IsMrMode && gInputBoxIndex > 0)) {
|
||||||
@@ -89,12 +137,12 @@ void UI_DisplayFM(void)
|
|||||||
sprintf(String, "%.3s.%.1s",ascii, ascii + 3);
|
sprintf(String, "%.3s.%.1s",ascii, ascii + 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
UI_PrintString(String, 0, 20, 1, 10); // frequency
|
UI_PrintString(String, 0, 20, 1 /*, 10 */); // frequency
|
||||||
ST7565_BlitFullScreen();
|
ST7565_BlitFullScreen();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
UI_PrintString(String, 0, 127, 1, 10);
|
UI_PrintString(String, 0, 127, 1 /*, 10 */);
|
||||||
|
|
||||||
ST7565_BlitFullScreen();
|
ST7565_BlitFullScreen();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
#ifdef ENABLE_FMRADIO
|
#ifdef ENABLE_FMRADIO
|
||||||
void UI_DisplayFM(void);
|
void UI_DisplayFM(void);
|
||||||
|
void UI_UpdateFMThings(bool force);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+97
-33
@@ -78,6 +78,13 @@ void *memcpy_inv(void *dst, const void *src, size_t n) {
|
|||||||
void UI_PrintStringBuffer(const char *pString, uint8_t *buffer, uint32_t char_width, const uint8_t *font, bool inv) {
|
void UI_PrintStringBuffer(const char *pString, uint8_t *buffer, uint32_t char_width, const uint8_t *font, bool inv) {
|
||||||
const size_t Length = strlen(pString);
|
const size_t Length = strlen(pString);
|
||||||
const unsigned int char_spacing = char_width + 1;
|
const unsigned int char_spacing = char_width + 1;
|
||||||
|
const uint32_t total_width = Length * char_spacing; // Total width of the text
|
||||||
|
|
||||||
|
if (inv) {
|
||||||
|
// Draw background rectangle from 1 px before the first char to 1 px after the last char
|
||||||
|
memset(buffer, 0xFF, total_width + 2);
|
||||||
|
}
|
||||||
|
|
||||||
for (size_t i = 0; i < Length; i++) {
|
for (size_t i = 0; i < Length; i++) {
|
||||||
const unsigned int index = pString[i] - ' ' - 1;
|
const unsigned int index = pString[i] - ' ' - 1;
|
||||||
if (pString[i] > ' ' && pString[i] < 127) {
|
if (pString[i] > ' ' && pString[i] < 127) {
|
||||||
@@ -91,7 +98,6 @@ void UI_PrintStringBuffer(const char *pString, uint8_t *buffer, uint32_t char_wi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void UI_PrintStringSmall(const char *pString, uint8_t Start, uint8_t End, uint8_t Line, uint8_t char_width,
|
void UI_PrintStringSmall(const char *pString, uint8_t Start, uint8_t End, uint8_t Line, uint8_t char_width,
|
||||||
const uint8_t *font, bool inv) {
|
const uint8_t *font, bool inv) {
|
||||||
const size_t Length = strlen(pString);
|
const size_t Length = strlen(pString);
|
||||||
@@ -104,31 +110,55 @@ void UI_PrintStringSmall(const char *pString, uint8_t Start, uint8_t End, uint8_
|
|||||||
UI_PrintStringBuffer(pString, gFrameBuffer[Line] + Start, char_width, font, inv);
|
UI_PrintStringBuffer(pString, gFrameBuffer[Line] + Start, char_width, font, inv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void itoa(unsigned long num, char *str) {
|
||||||
|
char buf[20]; // Enough to store any 32-bit or 64-bit unsigned number
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
|
// Handle 0 explicitly
|
||||||
|
if (num == 0) {
|
||||||
|
str[i++] = '0';
|
||||||
|
str[i] = '\0';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert number to string in reverse order
|
||||||
|
while (num > 0) {
|
||||||
|
buf[i++] = (num % 10) + '0'; // Get last digit and convert to ASCII
|
||||||
|
num /= 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reverse the string
|
||||||
|
int j = 0;
|
||||||
|
while (i > 0) {
|
||||||
|
str[j++] = buf[--i];
|
||||||
|
}
|
||||||
|
str[j] = '\0'; // Null-terminate the string
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void UI_PrintStringSmallNormal(const char *pString, uint8_t Start, uint8_t End, uint8_t Line) {
|
void UI_PrintStringSmallNormal(const char *pString, uint8_t Start, uint8_t End, uint8_t Line) {
|
||||||
UI_PrintStringSmall(pString, Start, End, Line, ARRAY_SIZE(gFontSmall[0]), (const uint8_t *) gFontSmall, false);
|
UI_PrintStringSmall(pString, Start, End, Line, ARRAY_SIZE(gFontSmall[0]), (const uint8_t *) gFontSmall, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UI_PrintString(const char *pString, uint8_t Start, uint8_t End, uint8_t Line, uint8_t Width) {
|
//void UI_PrintString(const char *pString, uint8_t Start, uint8_t End, uint8_t Line /*, uint8_t Width */) {
|
||||||
Width = Width;
|
// UI_PrintStringSmallNormal(pString, Start, End, Line);
|
||||||
UI_PrintStringSmallNormal(pString, Start, End, Line);
|
//// size_t i;
|
||||||
// size_t i;
|
//// size_t Length = strlen(pString);
|
||||||
// size_t Length = strlen(pString);
|
////
|
||||||
//
|
//// if (End > Start)
|
||||||
// if (End > Start)
|
//// Start += (((End - Start) - (Length * Width)) + 1) / 2;
|
||||||
// Start += (((End - Start) - (Length * Width)) + 1) / 2;
|
////
|
||||||
//
|
//// for (i = 0; i < Length; i++)
|
||||||
// for (i = 0; i < Length; i++)
|
//// {
|
||||||
// {
|
//// const unsigned int ofs = (unsigned int)Start + (i * Width);
|
||||||
// const unsigned int ofs = (unsigned int)Start + (i * Width);
|
//// if (pString[i] > ' ' && pString[i] < 127)
|
||||||
// if (pString[i] > ' ' && pString[i] < 127)
|
//// {
|
||||||
// {
|
//// const unsigned int index = pString[i] - ' ' - 1;
|
||||||
// const unsigned int index = pString[i] - ' ' - 1;
|
//// memcpy(gFrameBuffer[Line + 0] + ofs, &gFontSmall[index + '0'][0], 7);
|
||||||
// memcpy(gFrameBuffer[Line + 0] + ofs, &gFontSmall[index + '0'][0], 7);
|
//// memcpy(gFrameBuffer[Line + 1] + ofs, &gFontSmall[index + '0'][7], 7);
|
||||||
// memcpy(gFrameBuffer[Line + 1] + ofs, &gFontSmall[index + '0'][7], 7);
|
//// }
|
||||||
// }
|
//// }
|
||||||
// }
|
//}
|
||||||
}
|
|
||||||
|
|
||||||
void UI_PrintStringSmallBold(const char *pString, uint8_t Start, uint8_t End, uint8_t Line) {
|
void UI_PrintStringSmallBold(const char *pString, uint8_t Start, uint8_t End, uint8_t Line) {
|
||||||
//#ifdef ENABLE_SMALL_BOLD
|
//#ifdef ENABLE_SMALL_BOLD
|
||||||
@@ -149,7 +179,7 @@ void UI_PrintStringSmallBufferNormal(const char *pString, uint8_t *buffer) {
|
|||||||
|
|
||||||
void UI_PrintStringSmallBufferBold(const char *pString, uint8_t *buffer) {
|
void UI_PrintStringSmallBufferBold(const char *pString, uint8_t *buffer) {
|
||||||
#ifdef ENABLE_SMALL_BOLD
|
#ifdef ENABLE_SMALL_BOLD
|
||||||
const uint8_t *font = (uint8_t *)gFontSmallBold;
|
const uint8_t *font = (uint8_t *) gFontSmallBold;
|
||||||
const uint8_t char_width = ARRAY_SIZE(gFontSmallBold[0]);
|
const uint8_t char_width = ARRAY_SIZE(gFontSmallBold[0]);
|
||||||
#else
|
#else
|
||||||
const uint8_t *font = (uint8_t *) gFontSmall;
|
const uint8_t *font = (uint8_t *) gFontSmall;
|
||||||
@@ -283,6 +313,30 @@ void PutPixelStatus(uint8_t x, uint8_t y, bool fill) {
|
|||||||
UI_DrawPixelBuffer(&gStatusLine, x, y, fill);
|
UI_DrawPixelBuffer(&gStatusLine, x, y, fill);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//void GUI_DisplaySmallest(const char *pString, uint8_t x, uint8_t y,
|
||||||
|
// bool statusbar, bool fill) {
|
||||||
|
// uint8_t c;
|
||||||
|
// uint8_t pixels;
|
||||||
|
// const uint8_t *p = (const uint8_t *) pString;
|
||||||
|
//
|
||||||
|
// while ((c = *p++) && c != '\0') {
|
||||||
|
// c -= 0x20;
|
||||||
|
// for (int i = 0; i < 3; ++i) {
|
||||||
|
// pixels = gFont3x5[c][i];
|
||||||
|
// for (int j = 0; j < 6; ++j) {
|
||||||
|
// if (pixels & 1) {
|
||||||
|
// if (statusbar)
|
||||||
|
// PutPixelStatus(x + i, y + j, fill);
|
||||||
|
// else
|
||||||
|
// PutPixel(x + i, y + j, fill);
|
||||||
|
// }
|
||||||
|
// pixels >>= 1;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// x += 4;
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
void GUI_DisplaySmallest(const char *pString, uint8_t x, uint8_t y,
|
void GUI_DisplaySmallest(const char *pString, uint8_t x, uint8_t y,
|
||||||
bool statusbar, bool fill) {
|
bool statusbar, bool fill) {
|
||||||
uint8_t c;
|
uint8_t c;
|
||||||
@@ -291,22 +345,25 @@ void GUI_DisplaySmallest(const char *pString, uint8_t x, uint8_t y,
|
|||||||
|
|
||||||
while ((c = *p++) && c != '\0') {
|
while ((c = *p++) && c != '\0') {
|
||||||
c -= 0x20;
|
c -= 0x20;
|
||||||
for (int i = 0; i < 3; ++i) {
|
for (int i = 0; i < (int) ARRAY_SIZE(gFontSmall[0]); ++i) {
|
||||||
pixels = gFont3x5[c][i];
|
if (c) {
|
||||||
for (int j = 0; j < 6; ++j) {
|
pixels = gFontSmall[c - 1][i];
|
||||||
if (pixels & 1) {
|
for (int j = 0; j < 8; ++j) {
|
||||||
if (statusbar)
|
if (pixels & 1) {
|
||||||
PutPixelStatus(x + i, y + j, fill);
|
if (statusbar)
|
||||||
else
|
PutPixelStatus(x + i, y + j, fill);
|
||||||
PutPixel(x + i, y + j, fill);
|
else
|
||||||
|
PutPixel(x + i, y + j, fill);
|
||||||
|
}
|
||||||
|
pixels >>= 1;
|
||||||
}
|
}
|
||||||
pixels >>= 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
x += 4;
|
x += ARRAY_SIZE(gFontSmall[0]) + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void UI_DrawLineBuffer(uint8_t (*buffer)[128], int16_t x1, int16_t y1, int16_t x2, int16_t y2, bool black) {
|
void UI_DrawLineBuffer(uint8_t (*buffer)[128], int16_t x1, int16_t y1, int16_t x2, int16_t y2, bool black) {
|
||||||
@@ -352,10 +409,17 @@ void UI_DisplayPopup(const char *string) {
|
|||||||
// UI_DrawPixelBuffer(117, y, true);
|
// UI_DrawPixelBuffer(117, y, true);
|
||||||
// }
|
// }
|
||||||
// DrawRectangle(9,9, 118,38, true);
|
// DrawRectangle(9,9, 118,38, true);
|
||||||
UI_PrintString(string, 9, 118, 2, 8);
|
UI_PrintString(string, 9, 118, 2 /*, 8 */);
|
||||||
UI_PrintStringSmallNormal("Press EXIT", 9, 118, 6);
|
UI_PrintStringSmallNormal("Press EXIT", 9, 118, 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UI_ClearLine(uint8_t Line) {
|
||||||
|
if (Line < 8) { // ST7565 has 8 pages (rows of 8 pixels)
|
||||||
|
memset(gFrameBuffer[Line], 0x00, 128); // Clear all pixels on the line
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void UI_DisplayClear() {
|
void UI_DisplayClear() {
|
||||||
memset(gFrameBuffer, 0, sizeof(gFrameBuffer));
|
memset(gFrameBuffer, 0, sizeof(gFrameBuffer));
|
||||||
}
|
}
|
||||||
+4
-3
@@ -22,13 +22,14 @@
|
|||||||
|
|
||||||
void UI_GenerateChannelString(char *pString, const uint8_t Channel);
|
void UI_GenerateChannelString(char *pString, const uint8_t Channel);
|
||||||
void UI_GenerateChannelStringEx(char *pString, const bool bShowPrefix, const uint8_t ChannelNumber);
|
void UI_GenerateChannelStringEx(char *pString, const bool bShowPrefix, const uint8_t ChannelNumber);
|
||||||
void UI_PrintString(const char *pString, uint8_t Start, uint8_t End, uint8_t Line, uint8_t Width);
|
//void UI_PrintString(const char *pString, uint8_t Start, uint8_t End, uint8_t Line /*, uint8_t Width */);
|
||||||
|
#define UI_PrintString UI_PrintStringSmallNormal
|
||||||
void UI_PrintStringSmallNormal(const char *pString, uint8_t Start, uint8_t End, uint8_t Line);
|
void UI_PrintStringSmallNormal(const char *pString, uint8_t Start, uint8_t End, uint8_t Line);
|
||||||
void UI_PrintStringSmallBold(const char *pString, uint8_t Start, uint8_t End, uint8_t Line);
|
void UI_PrintStringSmallBold(const char *pString, uint8_t Start, uint8_t End, uint8_t Line);
|
||||||
void UI_PrintStringSmallBufferNormal(const char *pString, uint8_t *buffer);
|
void UI_PrintStringSmallBufferNormal(const char *pString, uint8_t *buffer);
|
||||||
void UI_PrintStringSmallBufferBold(const char *pString, uint8_t * buffer);
|
void UI_PrintStringSmallBufferBold(const char *pString, uint8_t * buffer);
|
||||||
//void UI_DisplayFrequency(const char *string, uint8_t X, uint8_t Y, bool center);
|
//void UI_DisplayFrequency(const char *string, uint8_t X, uint8_t Y, bool center);
|
||||||
|
void UI_ClearLine(uint8_t Line);
|
||||||
void UI_DisplayPopup(const char *string);
|
void UI_DisplayPopup(const char *string);
|
||||||
|
|
||||||
void UI_DrawPixelBuffer(uint8_t (*buffer)[128], uint8_t x, uint8_t y, bool black);
|
void UI_DrawPixelBuffer(uint8_t (*buffer)[128], uint8_t x, uint8_t y, bool black);
|
||||||
@@ -40,7 +41,7 @@ void UI_DrawPixelBuffer(uint8_t (*buffer)[128], uint8_t x, uint8_t y, bool black
|
|||||||
#endif
|
#endif
|
||||||
void UI_DrawLineBuffer(uint8_t (*buffer)[128], int16_t x1, int16_t y1, int16_t x2, int16_t y2, bool black);
|
void UI_DrawLineBuffer(uint8_t (*buffer)[128], int16_t x1, int16_t y1, int16_t x2, int16_t y2, bool black);
|
||||||
void UI_DrawRectangleBuffer(uint8_t (*buffer)[128], int16_t x1, int16_t y1, int16_t x2, int16_t y2, bool black);
|
void UI_DrawRectangleBuffer(uint8_t (*buffer)[128], int16_t x1, int16_t y1, int16_t x2, int16_t y2, bool black);
|
||||||
|
void itoa(unsigned long num, char *str);
|
||||||
void UI_DisplayClear();
|
void UI_DisplayClear();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -37,11 +37,11 @@ static void Render(void)
|
|||||||
memset(gStatusLine, 0, sizeof(gStatusLine));
|
memset(gStatusLine, 0, sizeof(gStatusLine));
|
||||||
UI_DisplayClear();
|
UI_DisplayClear();
|
||||||
|
|
||||||
UI_PrintString("PASSWORD", 0, 127, 1, 10);
|
UI_PrintString("PASSWORD", 0, 127, 1 /*, 10 */);
|
||||||
for (i = 0; i < 6; i++)
|
for (i = 0; i < 6; i++)
|
||||||
String[i] = (gInputBox[i] == 10) ? '-' : 'x';
|
String[i] = (gInputBox[i] == 10) ? '-' : 'x';
|
||||||
String[6] = 0;
|
String[6] = 0;
|
||||||
UI_PrintString(String, 0, 127, 3, 12);
|
UI_PrintString(String, 0, 127, 3 /*, 12 */);
|
||||||
|
|
||||||
ST7565_BlitStatusLine();
|
ST7565_BlitStatusLine();
|
||||||
ST7565_BlitFullScreen();
|
ST7565_BlitFullScreen();
|
||||||
|
|||||||
@@ -45,6 +45,7 @@
|
|||||||
#ifdef ENABLE_FEAT_F4HWN
|
#ifdef ENABLE_FEAT_F4HWN
|
||||||
|
|
||||||
#include "driver/system.h"
|
#include "driver/system.h"
|
||||||
|
#include "app/scanner.h"
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -59,7 +60,7 @@ static uint32_t RxOnVfofrequency;
|
|||||||
|
|
||||||
bool isMainOnlyInputDTMF = false;
|
bool isMainOnlyInputDTMF = false;
|
||||||
|
|
||||||
static bool isMainOnly() {
|
bool isMainOnly() {
|
||||||
return (gEeprom.DUAL_WATCH == DUAL_WATCH_OFF) && (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF);
|
return (gEeprom.DUAL_WATCH == DUAL_WATCH_OFF) && (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -88,6 +89,7 @@ const char *VfoStateStr[] = {
|
|||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
|
|
||||||
static void DrawSmallAntennaAndBars(uint8_t *p, unsigned int level) {
|
static void DrawSmallAntennaAndBars(uint8_t *p, unsigned int level) {
|
||||||
|
level++;
|
||||||
if (level > 6)
|
if (level > 6)
|
||||||
level = 6;
|
level = 6;
|
||||||
|
|
||||||
@@ -115,51 +117,19 @@ static void DrawLevelBar(uint8_t xpos, uint8_t line, uint8_t level, uint8_t bars
|
|||||||
level = MIN(level, bars);
|
level = MIN(level, bars);
|
||||||
|
|
||||||
for (uint8_t i = 0; i < level; i++) {
|
for (uint8_t i = 0; i < level; i++) {
|
||||||
#ifdef ENABLE_FEAT_F4HWN
|
const char hollowBar[] = {
|
||||||
if (gSetting_set_met) {
|
0b01111111,
|
||||||
const char hollowBar[] = {
|
0b01000001,
|
||||||
0b01111111,
|
0b01000001,
|
||||||
0b01000001,
|
0b01111111
|
||||||
0b01000001,
|
};
|
||||||
0b01111111
|
|
||||||
};
|
|
||||||
|
|
||||||
if (i < bars - 4) {
|
if (i < bars - 4) {
|
||||||
for (uint8_t j = 0; j < 4; j++)
|
for (uint8_t j = 0; j < 4; j++)
|
||||||
p_line[xpos + i * 5 + j] = (~(0x7F >> (i + 1))) & 0x7F;
|
p_line[xpos + i * 5 + j] = (~(0x7F >> (i + 1))) & 0x7F;
|
||||||
} else {
|
|
||||||
memcpy(p_line + (xpos + i * 5), &hollowBar, ARRAY_SIZE(hollowBar));
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
const char hollowBar[] = {
|
|
||||||
0b00111110,
|
|
||||||
0b00100010,
|
|
||||||
0b00100010,
|
|
||||||
0b00111110
|
|
||||||
};
|
|
||||||
|
|
||||||
const char simpleBar[] = {
|
|
||||||
0b00111110,
|
|
||||||
0b00111110,
|
|
||||||
0b00111110,
|
|
||||||
0b00111110
|
|
||||||
};
|
|
||||||
|
|
||||||
if (i < bars - 4) {
|
|
||||||
memcpy(p_line + (xpos + i * 5), &simpleBar, ARRAY_SIZE(simpleBar));
|
|
||||||
} else {
|
|
||||||
memcpy(p_line + (xpos + i * 5), &hollowBar, ARRAY_SIZE(hollowBar));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
if(i < bars - 4) {
|
|
||||||
for(uint8_t j = 0; j < 4; j++)
|
|
||||||
p_line[xpos + i * 5 + j] = (~(0x7F >> (i+1))) & 0x7F;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
memcpy(p_line + (xpos + i * 5), &hollowBar, ARRAY_SIZE(hollowBar));
|
memcpy(p_line + (xpos + i * 5), &hollowBar, ARRAY_SIZE(hollowBar));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -197,9 +167,7 @@ void UI_DisplayAudioBar(void) {
|
|||||||
|
|
||||||
if (gCurrentFunction != FUNCTION_TRANSMIT ||
|
if (gCurrentFunction != FUNCTION_TRANSMIT ||
|
||||||
gScreenToDisplay != DISPLAY_MAIN
|
gScreenToDisplay != DISPLAY_MAIN
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
|| gDTMF_CallState != DTMF_CALL_STATE_NONE
|
|
||||||
#endif
|
|
||||||
) {
|
) {
|
||||||
return; // screen is in use
|
return; // screen is in use
|
||||||
}
|
}
|
||||||
@@ -237,7 +205,7 @@ void UI_DisplayAudioBar(void) {
|
|||||||
void DisplayRSSIBar(const bool now) {
|
void DisplayRSSIBar(const bool now) {
|
||||||
#if defined(ENABLE_RSSI_BAR)
|
#if defined(ENABLE_RSSI_BAR)
|
||||||
|
|
||||||
const unsigned int txt_width = 7 * 8; // 8 text chars
|
const unsigned int txt_width = 7 * 10; // 8 text chars
|
||||||
const unsigned int bar_x = 2 + txt_width + 4; // X coord of bar graph
|
const unsigned int bar_x = 2 + txt_width + 4; // X coord of bar graph
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN
|
#ifdef ENABLE_FEAT_F4HWN
|
||||||
@@ -266,7 +234,7 @@ void DisplayRSSIBar(const bool now) {
|
|||||||
|
|
||||||
if (RxLine >= 0 && center_line != CENTER_LINE_IN_USE) {
|
if (RxLine >= 0 && center_line != CENTER_LINE_IN_USE) {
|
||||||
if (RxBlink == 0 || RxBlink == 1) {
|
if (RxBlink == 0 || RxBlink == 1) {
|
||||||
UI_PrintStringSmallBold("RX", 8, 0, RxLine);
|
UI_PrintStringSmallBold("RX", 24, 0, RxLine);
|
||||||
if (RxBlink == 1) RxBlink = 2;
|
if (RxBlink == 1) RxBlink = 2;
|
||||||
} else {
|
} else {
|
||||||
for (uint8_t i = 8; i < 24; i++) {
|
for (uint8_t i = 8; i < 24; i++) {
|
||||||
@@ -299,9 +267,6 @@ void DisplayRSSIBar(const bool now) {
|
|||||||
|
|
||||||
if (gCurrentFunction == FUNCTION_TRANSMIT ||
|
if (gCurrentFunction == FUNCTION_TRANSMIT ||
|
||||||
gScreenToDisplay != DISPLAY_MAIN
|
gScreenToDisplay != DISPLAY_MAIN
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
|| gDTMF_CallState != DTMF_CALL_STATE_NONE
|
|
||||||
#endif
|
|
||||||
)
|
)
|
||||||
return; // display is in use
|
return; // display is in use
|
||||||
|
|
||||||
@@ -348,36 +313,31 @@ void DisplayRSSIBar(const bool now) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN
|
#ifdef ENABLE_FEAT_F4HWN
|
||||||
if (gSetting_set_gui) {
|
char tempStr[4];
|
||||||
sprintf(str, "%3d", -rssi_dBm);
|
|
||||||
UI_PrintStringSmallNormal(str, LCD_WIDTH + 8, 0, line - 1);
|
|
||||||
} else {
|
|
||||||
sprintf(str, "% 4d %s", -rssi_dBm, "dBm");
|
|
||||||
if (isMainOnly())
|
|
||||||
GUI_DisplaySmallest(str, 2, 41, false, true);
|
|
||||||
else
|
|
||||||
GUI_DisplaySmallest(str, 2, 25, false, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (overS9Bars == 0) {
|
if (overS9Bars == 0) {
|
||||||
sprintf(str, "S%d", s_level);
|
sprintf(tempStr, "S%d", s_level);
|
||||||
} else {
|
} else {
|
||||||
sprintf(str, "+%02d", overS9dBm);
|
sprintf(tempStr, "+%02d", overS9dBm);
|
||||||
}
|
}
|
||||||
|
|
||||||
UI_PrintStringSmallNormal(str, LCD_WIDTH + 38, 0, line - 1);
|
sprintf(str, "%4ddBm%3s", -rssi_dBm, tempStr);
|
||||||
|
if (isMainOnly())
|
||||||
|
UI_PrintStringSmallNormal(str, 2, 0, 4);
|
||||||
|
else
|
||||||
|
UI_PrintStringSmallNormal(str, 2, 0, 3);
|
||||||
#else
|
#else
|
||||||
if(overS9Bars == 0) {
|
if(overS9Bars == 0) {
|
||||||
sprintf(str, "% 4d S%d", -rssi_dBm, s_level);
|
sprintf(str, "% 4d S%d", -rssi_dBm, s_level);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
sprintf(str, "% 4d %2d", -rssi_dBm, overS9dBm);
|
sprintf(str, "% 4d %2ld", -rssi_dBm, overS9dBm);
|
||||||
memcpy(p_line + 2 + 7*5, &plus, ARRAY_SIZE(plus));
|
memcpy(p_line + 2 + 7*5, &plus, ARRAY_SIZE(plus));
|
||||||
}
|
}
|
||||||
|
|
||||||
UI_PrintStringSmallNormal(str, 2, 0, line);
|
UI_PrintStringSmallNormal(str, 2, 0, line);
|
||||||
#endif
|
#endif
|
||||||
DrawLevelBar(bar_x, line, s_level + overS9Bars, 13);
|
DrawLevelBar(bar_x, line, s_level + overS9Bars, 10);
|
||||||
if (now)
|
if (now)
|
||||||
ST7565_BlitLine(line);
|
ST7565_BlitLine(line);
|
||||||
#else
|
#else
|
||||||
@@ -438,7 +398,7 @@ void UI_MAIN_PrintAGC(bool now)
|
|||||||
int8_t pgaTab[] = {-33, -27, -21, -15, -9, -6, -3, 0};
|
int8_t pgaTab[] = {-33, -27, -21, -15, -9, -6, -3, 0};
|
||||||
int16_t agcGain = lnaShortTab[agcGainReg.lnaS] + lnaTab[agcGainReg.lna] + mixerTab[agcGainReg.mixer] + pgaTab[agcGainReg.pga];
|
int16_t agcGain = lnaShortTab[agcGainReg.lnaS] + lnaTab[agcGainReg.lna] + mixerTab[agcGainReg.mixer] + pgaTab[agcGainReg.pga];
|
||||||
|
|
||||||
sprintf(buf, "%d%2d %2d %2d %3d", reg7e.agcEnab, reg7e.gainIdx, -agcGain, reg7e.agcSigStrength, BK4819_GetRSSI());
|
sprintf(buf, "%d%2ld %2ld %2ld %3ld", reg7e.agcEnab, reg7e.gainIdx, -agcGain, reg7e.agcSigStrength, BK4819_GetRSSI());
|
||||||
UI_PrintStringSmallNormal(buf, 2, 0, 3);
|
UI_PrintStringSmallNormal(buf, 2, 0, 3);
|
||||||
if(now)
|
if(now)
|
||||||
ST7565_BlitLine(3);
|
ST7565_BlitLine(3);
|
||||||
@@ -455,44 +415,6 @@ void UI_MAIN_TimeSlice500ms(void) {
|
|||||||
if (FUNCTION_IsRx()) {
|
if (FUNCTION_IsRx()) {
|
||||||
DisplayRSSIBar(true);
|
DisplayRSSIBar(true);
|
||||||
}
|
}
|
||||||
#ifdef ENABLE_FEAT_F4HWN // Blink Green Led for white...
|
|
||||||
else if (gSetting_set_eot > 0 && RxBlinkLed == 2) {
|
|
||||||
if (RxBlinkLedCounter <= 8) {
|
|
||||||
if (RxBlinkLedCounter % 2 == 0) {
|
|
||||||
if (gSetting_set_eot > 1) {
|
|
||||||
BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2_GREEN, false);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (gSetting_set_eot > 1) {
|
|
||||||
BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2_GREEN, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gSetting_set_eot == 1 || gSetting_set_eot == 3) {
|
|
||||||
switch (RxBlinkLedCounter) {
|
|
||||||
case 1:
|
|
||||||
AUDIO_PlayBeep(BEEP_400HZ_30MS);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 3:
|
|
||||||
AUDIO_PlayBeep(BEEP_400HZ_30MS);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 5:
|
|
||||||
AUDIO_PlayBeep(BEEP_500HZ_30MS);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 7:
|
|
||||||
AUDIO_PlayBeep(BEEP_600HZ_30MS);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
RxBlinkLedCounter += 1;
|
|
||||||
} else {
|
|
||||||
RxBlinkLed = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -506,8 +428,9 @@ void UI_DisplayMain(void) {
|
|||||||
// clear the screen
|
// clear the screen
|
||||||
UI_DisplayClear();
|
UI_DisplayClear();
|
||||||
|
|
||||||
|
|
||||||
if (gLowBattery && !gLowBatteryConfirmed) {
|
if (gLowBattery && !gLowBatteryConfirmed) {
|
||||||
UI_DisplayPopup("LOW BATTERY");
|
UI_DisplayPopup("LOW BAT");
|
||||||
ST7565_BlitFullScreen();
|
ST7565_BlitFullScreen();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -515,8 +438,8 @@ void UI_DisplayMain(void) {
|
|||||||
#ifndef ENABLE_FEAT_F4HWN
|
#ifndef ENABLE_FEAT_F4HWN
|
||||||
if (gEeprom.KEY_LOCK && gKeypadLocked > 0)
|
if (gEeprom.KEY_LOCK && gKeypadLocked > 0)
|
||||||
{ // tell user how to unlock the keyboard
|
{ // tell user how to unlock the keyboard
|
||||||
UI_PrintString("Long press #", 0, LCD_WIDTH, 1, 8);
|
UI_PrintString("Long press #", 0, LCD_WIDTH, 1 /*, 8 */);
|
||||||
UI_PrintString("to unlock", 0, LCD_WIDTH, 3, 8);
|
UI_PrintString("to unlock", 0, LCD_WIDTH, 3 /*, 8 */);
|
||||||
ST7565_BlitFullScreen();
|
ST7565_BlitFullScreen();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -535,7 +458,7 @@ void UI_DisplayMain(void) {
|
|||||||
shift = 5;
|
shift = 5;
|
||||||
}
|
}
|
||||||
//memcpy(gFrameBuffer[shift] + 2, gFontKeyLock, sizeof(gFontKeyLock));
|
//memcpy(gFrameBuffer[shift] + 2, gFontKeyLock, sizeof(gFontKeyLock));
|
||||||
UI_PrintStringSmallBold("UNLOCK KEYBOARD", 12, 0, shift);
|
UI_PrintStringSmallBold("KEYLOCK", 12, 0, shift);
|
||||||
//memcpy(gFrameBuffer[shift] + 120, gFontKeyLock, sizeof(gFontKeyLock));
|
//memcpy(gFrameBuffer[shift] + 120, gFontKeyLock, sizeof(gFontKeyLock));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -600,10 +523,10 @@ void UI_DisplayMain(void) {
|
|||||||
shift = 3;
|
shift = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
UI_PrintString("ScnRng", 5, 0, line + shift, 8);
|
UI_PrintString("ScnRng", 5, 0, line + shift /*, 8 */);
|
||||||
sprintf(String, "%3u.%05u", gScanRangeStart / 100000, gScanRangeStart % 100000);
|
sprintf(String, "%3lu.%05lu", gScanRangeStart / 100000, gScanRangeStart % 100000);
|
||||||
UI_PrintStringSmallNormal(String, 56, 0, line + shift);
|
UI_PrintStringSmallNormal(String, 56, 0, line + shift);
|
||||||
sprintf(String, "%3u.%05u", gScanRangeStop / 100000, gScanRangeStop % 100000);
|
sprintf(String, "%3lu.%05lu", gScanRangeStop / 100000, gScanRangeStop % 100000);
|
||||||
UI_PrintStringSmallNormal(String, 56, 0, line + shift + 1);
|
UI_PrintStringSmallNormal(String, 56, 0, line + shift + 1);
|
||||||
|
|
||||||
if (!isMainOnly())
|
if (!isMainOnly())
|
||||||
@@ -612,67 +535,20 @@ void UI_DisplayMain(void) {
|
|||||||
gScanRangeStart = 0;
|
gScanRangeStart = 0;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
UI_PrintString("ScnRng", 5, 0, line, 8);
|
UI_PrintString("ScnRng", 5, 0, line /*, 8 */);
|
||||||
sprintf(String, "%3u.%05u", gScanRangeStart / 100000, gScanRangeStart % 100000);
|
sprintf(String, "%3lu.%05lu", gScanRangeStart / 100000, gScanRangeStart % 100000);
|
||||||
UI_PrintStringSmallNormal(String, 56, 0, line);
|
UI_PrintStringSmallNormal(String, 56, 0, line);
|
||||||
sprintf(String, "%3u.%05u", gScanRangeStop / 100000, gScanRangeStop % 100000);
|
sprintf(String, "%3lu.%05lu", gScanRangeStop / 100000, gScanRangeStop % 100000);
|
||||||
UI_PrintStringSmallNormal(String, 56, 0, line + 1);
|
UI_PrintStringSmallNormal(String, 56, 0, line + 1);
|
||||||
continue;
|
continue;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
if (gEnteringSMS == SMS_ENTERING_DEST) {
|
|
||||||
UI_PrintString("SMS Dst", 0, 0, line - 1, 8);
|
|
||||||
sprintf(String, "%d", dataPacket.dest);
|
|
||||||
UI_PrintStringSmallNormal(String, 0, 0, line);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gEnteringSMS == SMS_ENTERING_MESSAGE) {
|
|
||||||
UI_PrintString("SMS Dat", 0, 0, line - 1, 8);
|
|
||||||
sprintf(String, "%s", dataPacket.data);
|
|
||||||
UI_PrintStringSmallNormal(String, 0, 0, line);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gDTMF_InputMode
|
if (gDTMF_InputMode
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
|| gDTMF_CallState != DTMF_CALL_STATE_NONE || gDTMF_IsTx
|
|
||||||
#endif
|
|
||||||
) {
|
) {
|
||||||
char *pPrintStr = "";
|
char *pPrintStr = "";
|
||||||
// show DTMF stuff
|
// show DTMF stuff
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
char Contact[16];
|
|
||||||
if (!gDTMF_InputMode) {
|
|
||||||
if (gDTMF_CallState == DTMF_CALL_STATE_CALL_OUT) {
|
|
||||||
pPrintStr = DTMF_FindContact(gDTMF_String, Contact) ? Contact : gDTMF_String;
|
|
||||||
} else if (gDTMF_CallState == DTMF_CALL_STATE_RECEIVED ||
|
|
||||||
gDTMF_CallState == DTMF_CALL_STATE_RECEIVED_STAY) {
|
|
||||||
pPrintStr = DTMF_FindContact(gDTMF_Callee, Contact) ? Contact : gDTMF_Callee;
|
|
||||||
} else if (gDTMF_IsTx) {
|
|
||||||
pPrintStr = gDTMF_String;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
UI_PrintString(pPrintStr, 2, 0, 2 + (vfo_num * 3), 8);
|
|
||||||
|
|
||||||
pPrintStr = "";
|
|
||||||
if (!gDTMF_InputMode) {
|
|
||||||
if (gDTMF_CallState == DTMF_CALL_STATE_CALL_OUT) {
|
|
||||||
pPrintStr = (gDTMF_State == DTMF_STATE_CALL_OUT_RSP) ? "CALL OUT(RSP)" : "CALL OUT";
|
|
||||||
} else if (gDTMF_CallState == DTMF_CALL_STATE_RECEIVED ||
|
|
||||||
gDTMF_CallState == DTMF_CALL_STATE_RECEIVED_STAY) {
|
|
||||||
sprintf(String, "CALL FRM:%s",
|
|
||||||
(DTMF_FindContact(gDTMF_Caller, Contact)) ? Contact : gDTMF_Caller);
|
|
||||||
pPrintStr = String;
|
|
||||||
} else if (gDTMF_IsTx) {
|
|
||||||
pPrintStr = (gDTMF_State == DTMF_STATE_TX_SUCC) ? "DTMF TX(SUCC)" : "DTMF TX";
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
sprintf(String, ">%s", gDTMF_InputBox);
|
sprintf(String, ">%s", gDTMF_InputBox);
|
||||||
pPrintStr = String;
|
pPrintStr = String;
|
||||||
@@ -680,17 +556,17 @@ void UI_DisplayMain(void) {
|
|||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN
|
#ifdef ENABLE_FEAT_F4HWN
|
||||||
if (isMainOnly()) {
|
if (isMainOnly()) {
|
||||||
UI_PrintString(pPrintStr, 2, 0, 5, 8);
|
UI_PrintString(pPrintStr, 2, 0, 5 /*, 8 */);
|
||||||
isMainOnlyInputDTMF = true;
|
isMainOnlyInputDTMF = true;
|
||||||
center_line = CENTER_LINE_IN_USE;
|
center_line = CENTER_LINE_IN_USE;
|
||||||
} else {
|
} else {
|
||||||
UI_PrintString(pPrintStr, 2, 0, 0 + (vfo_num * 3), 8);
|
UI_PrintString(pPrintStr, 2, 0, 0 + (vfo_num * 3) /*, 8 */);
|
||||||
isMainOnlyInputDTMF = false;
|
isMainOnlyInputDTMF = false;
|
||||||
center_line = CENTER_LINE_IN_USE;
|
center_line = CENTER_LINE_IN_USE;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
UI_PrintString(pPrintStr, 2, 0, 0 + (vfo_num * 3), 8);
|
UI_PrintString(pPrintStr, 2, 0, 0 + (vfo_num * 3) /*, 8 */);
|
||||||
center_line = CENTER_LINE_IN_USE;
|
center_line = CENTER_LINE_IN_USE;
|
||||||
continue;
|
continue;
|
||||||
#endif
|
#endif
|
||||||
@@ -709,11 +585,11 @@ void UI_DisplayMain(void) {
|
|||||||
|
|
||||||
uint32_t frequency = gEeprom.VfoInfo[vfo_num].pRX->Frequency;
|
uint32_t frequency = gEeprom.VfoInfo[vfo_num].pRX->Frequency;
|
||||||
|
|
||||||
if (TX_freq_check(frequency) != 0 && gEeprom.VfoInfo[vfo_num].TX_LOCK == true) {
|
if (TX_freq_check(frequency) != 0) {
|
||||||
if (isMainOnly())
|
if (isMainOnly())
|
||||||
memcpy(p_line0 + 14, BITMAP_VFO_Lock, sizeof(BITMAP_VFO_Lock));
|
memcpy(p_line0 + 5, gFontKeyLock, sizeof(gFontKeyLock));
|
||||||
else
|
else
|
||||||
memcpy(p_line0 + 24, BITMAP_VFO_Lock, sizeof(BITMAP_VFO_Lock));
|
memcpy(p_line0 + 10, gFontKeyLock, sizeof(gFontKeyLock));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gCurrentFunction == FUNCTION_TRANSMIT) { // transmitting
|
if (gCurrentFunction == FUNCTION_TRANSMIT) { // transmitting
|
||||||
@@ -750,7 +626,7 @@ void UI_DisplayMain(void) {
|
|||||||
#ifdef ENABLE_FEAT_F4HWN
|
#ifdef ENABLE_FEAT_F4HWN
|
||||||
else {
|
else {
|
||||||
if (RxOnVfofrequency == frequency && !isMainOnly()) {
|
if (RxOnVfofrequency == frequency && !isMainOnly()) {
|
||||||
UI_PrintStringSmallNormal(">>", 8, 0, line);
|
UI_PrintStringSmallNormal(">>", 24, 0, line);
|
||||||
//memcpy(p_line0 + 14, BITMAP_VFO_Default, sizeof(BITMAP_VFO_Default));
|
//memcpy(p_line0 + 14, BITMAP_VFO_Default, sizeof(BITMAP_VFO_Default));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -761,7 +637,7 @@ void UI_DisplayMain(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (IS_MR_CHANNEL(gEeprom.ScreenChannel[vfo_num])) { // channel mode
|
if (IS_MR_CHANNEL(gEeprom.ScreenChannel[vfo_num])) { // channel mode
|
||||||
const unsigned int x = 2;
|
const unsigned int x = 20;
|
||||||
const bool inputting = gInputBoxIndex != 0 && gEeprom.TX_VFO == vfo_num;
|
const bool inputting = gInputBoxIndex != 0 && gEeprom.TX_VFO == vfo_num;
|
||||||
if (!inputting)
|
if (!inputting)
|
||||||
sprintf(String, "M%u", gEeprom.ScreenChannel[vfo_num] + 1);
|
sprintf(String, "M%u", gEeprom.ScreenChannel[vfo_num] + 1);
|
||||||
@@ -770,7 +646,7 @@ void UI_DisplayMain(void) {
|
|||||||
UI_PrintStringSmallNormal(String, x, 0, line + 1);
|
UI_PrintStringSmallNormal(String, x, 0, line + 1);
|
||||||
} else if (IS_FREQ_CHANNEL(gEeprom.ScreenChannel[vfo_num])) { // frequency mode
|
} else if (IS_FREQ_CHANNEL(gEeprom.ScreenChannel[vfo_num])) { // frequency mode
|
||||||
// show the frequency band number
|
// show the frequency band number
|
||||||
const unsigned int x = 2;
|
const unsigned int x = 0;
|
||||||
char *buf = gEeprom.VfoInfo[vfo_num].pRX->Frequency < _1GHz_in_KHz ? "" : "+";
|
char *buf = gEeprom.VfoInfo[vfo_num].pRX->Frequency < _1GHz_in_KHz ? "" : "+";
|
||||||
sprintf(String, "F%u%s", 1 + gEeprom.ScreenChannel[vfo_num] - FREQ_CHANNEL_FIRST, buf);
|
sprintf(String, "F%u%s", 1 + gEeprom.ScreenChannel[vfo_num] - FREQ_CHANNEL_FIRST, buf);
|
||||||
UI_PrintStringSmallNormal(String, x, 0, line + 1);
|
UI_PrintStringSmallNormal(String, x, 0, line + 1);
|
||||||
@@ -802,24 +678,15 @@ void UI_DisplayMain(void) {
|
|||||||
#endif
|
#endif
|
||||||
if (state != VFO_STATE_NORMAL) {
|
if (state != VFO_STATE_NORMAL) {
|
||||||
if (state < ARRAY_SIZE(VfoStateStr))
|
if (state < ARRAY_SIZE(VfoStateStr))
|
||||||
UI_PrintString(VfoStateStr[state], 31, 0, line, 8);
|
UI_PrintString(VfoStateStr[state], 31, 0, line /*, 8 */);
|
||||||
} else if (gInputBoxIndex > 0 && IS_FREQ_CHANNEL(gEeprom.ScreenChannel[vfo_num]) &&
|
} else if (gInputBoxIndex > 0 && IS_FREQ_CHANNEL(gEeprom.ScreenChannel[vfo_num]) &&
|
||||||
gEeprom.TX_VFO == vfo_num) { // user entering a frequency
|
gEeprom.TX_VFO == vfo_num) { // user entering a frequency
|
||||||
const char *ascii = INPUTBOX_GetAscii();
|
const char *ascii = INPUTBOX_GetAscii();
|
||||||
bool isGigaF = frequency >= _1GHz_in_KHz;
|
bool isGigaF = frequency >= _1GHz_in_KHz;
|
||||||
sprintf(String, "%.*s.%.3s", 3 + isGigaF, ascii, ascii + 3 + isGigaF);
|
sprintf(String, "%.*s.%.3s", 3 + isGigaF, ascii, ascii + 3 + isGigaF);
|
||||||
#ifdef ENABLE_BIG_FREQ
|
|
||||||
if (!isGigaF) {
|
|
||||||
// show the remaining 2 small frequency digits
|
|
||||||
UI_PrintStringSmallNormal(String + 7, 113, 0, line + 1);
|
|
||||||
String[7] = 0;
|
|
||||||
// show the main large frequency digits
|
|
||||||
UI_DisplayFrequency(String, 32, line, false);
|
|
||||||
} else
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
// show the frequency in the main font
|
// show the frequency in the main font
|
||||||
UI_PrintString(String, 32, 0, line, 8);
|
UI_PrintString(String, 45, 0, line /*, 8 */);
|
||||||
}
|
}
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
@@ -872,35 +739,33 @@ void UI_DisplayMain(void) {
|
|||||||
|
|
||||||
// compander symbol
|
// compander symbol
|
||||||
#ifndef ENABLE_BIG_FREQ
|
#ifndef ENABLE_BIG_FREQ
|
||||||
const ChannelAttributes_t att = gMR_ChannelAttributes[gEeprom.ScreenChannel[vfo_num]];
|
//const ChannelAttributes_t att = gMR_ChannelAttributes[gEeprom.ScreenChannel[vfo_num]];
|
||||||
if (att.compander)
|
|
||||||
memcpy(p_line0 + 120 + LCD_WIDTH, BITMAP_compand, sizeof(BITMAP_compand));
|
|
||||||
#else
|
#else
|
||||||
// TODO: // find somewhere else to put the symbol
|
// TODO: // find somewhere else to put the symbol
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
switch (gEeprom.CHANNEL_DISPLAY_MODE) {
|
switch (gEeprom.CHANNEL_DISPLAY_MODE) {
|
||||||
case MDF_FREQUENCY: // show the channel frequency
|
case MDF_FREQUENCY: // show the channel frequency
|
||||||
sprintf(String, "%3u.%05u", frequency / 100000, frequency % 100000);
|
sprintf(String, "%3lu.%05lu", frequency / 100000, frequency % 100000);
|
||||||
#ifdef ENABLE_BIG_FREQ
|
#ifdef ENABLE_BIG_FREQ
|
||||||
if (frequency < _1GHz_in_KHz) {
|
if (frequency < _1GHz_in_KHz) {
|
||||||
// show the remaining 2 small frequency digits
|
// show the remaining 2 small frequency digits
|
||||||
UI_PrintStringSmallNormal(String + 7, 113, 0, line + 1);
|
UI_PrintStringSmallNormal(String + 7, 113, 0, line + 1);
|
||||||
String[7] = 0;
|
String[7] = 0;
|
||||||
// show the main large frequency digits
|
// show the main large frequency digits
|
||||||
UI_DisplayFrequency(String, 32, line, false);
|
UI_DisplayFrequency(String, 20, line, false);
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
// show the frequency in the main font
|
// show the frequency in the main font
|
||||||
UI_PrintString(String, 32, 0, line, 8);
|
UI_PrintStringSmallBold(String, 40, 0, line /*, 8 */);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MDF_CHANNEL: // show the channel number
|
case MDF_CHANNEL: // show the channel number
|
||||||
sprintf(String, "CH-%03u", gEeprom.ScreenChannel[vfo_num] + 1);
|
sprintf(String, "CH-%03u", gEeprom.ScreenChannel[vfo_num] + 1);
|
||||||
UI_PrintString(String, 32, 0, line, 8);
|
UI_PrintStringSmallBold(String, 40, 0, line /*, 8 */);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MDF_NAME: // show the channel name
|
case MDF_NAME: // show the channel name
|
||||||
@@ -912,50 +777,50 @@ void UI_DisplayMain(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (gEeprom.CHANNEL_DISPLAY_MODE == MDF_NAME) {
|
if (gEeprom.CHANNEL_DISPLAY_MODE == MDF_NAME) {
|
||||||
UI_PrintString(String, 32, 0, line, 8);
|
UI_PrintStringSmallBold(String, 40, 0, line /*, 8 */);
|
||||||
} else {
|
} else {
|
||||||
#ifdef ENABLE_FEAT_F4HWN
|
#ifdef ENABLE_FEAT_F4HWN
|
||||||
if (isMainOnly()) {
|
if (isMainOnly()) {
|
||||||
UI_PrintString(String, 32, 0, line, 8);
|
UI_PrintStringSmallBold(String, 40, 0, line /*, 8 */);
|
||||||
} else {
|
} else {
|
||||||
if (activeTxVFO == vfo_num) {
|
if (activeTxVFO == vfo_num) {
|
||||||
UI_PrintStringSmallBold(String, 32 + 4, 0, line);
|
UI_PrintStringSmallBold(String, 40 + 4, 0, line);
|
||||||
} else {
|
} else {
|
||||||
UI_PrintStringSmallNormal(String, 32 + 4, 0, line);
|
UI_PrintStringSmallNormal(String, 40 + 4, 0, line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
UI_PrintStringSmallBold(String, 32 + 4, 0, line);
|
UI_PrintStringSmallBold(String, 20 + 4, 0, line);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN
|
#ifdef ENABLE_FEAT_F4HWN
|
||||||
if (isMainOnly()) {
|
if (isMainOnly()) {
|
||||||
sprintf(String, "%3u.%05u", frequency / 100000, frequency % 100000);
|
sprintf(String, "%3lu.%05lu", frequency / 100000, frequency % 100000);
|
||||||
if (frequency < _1GHz_in_KHz) {
|
if (frequency < _1GHz_in_KHz) {
|
||||||
// show the remaining 2 small frequency digits
|
// show the remaining 2 small frequency digits
|
||||||
UI_PrintStringSmallNormal(String + 7, 113, 0, line + 4);
|
UI_PrintStringSmallNormal(String + 7, 113, 0, line + 4);
|
||||||
String[7] = 0;
|
String[7] = 0;
|
||||||
// show the main large frequency digits
|
// show the main large frequency digits
|
||||||
//UI_DisplayFrequency(String, 32, line + 3, false);
|
//UI_DisplayFrequency(String, 20, line + 3, false);
|
||||||
UI_PrintStringSmallNormal(String, 0, 20, line + 3);
|
UI_PrintStringSmallBold(String, 20, 20, line + 3);
|
||||||
} else {
|
} else {
|
||||||
// show the frequency in the main font
|
// show the frequency in the main font
|
||||||
UI_PrintString(String, 32, 0, line + 3, 8);
|
UI_PrintString(String, 40, 0, line + 3 /*, 8 */);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
sprintf(String, "%03u.%05u", frequency / 100000, frequency % 100000);
|
sprintf(String, "%03lu.%05lu", frequency / 100000, frequency % 100000);
|
||||||
UI_PrintStringSmallNormal(String, 32 + 4, 0, line + 1);
|
UI_PrintStringSmallBold(String, 40 + 4, 0, line + 1);
|
||||||
}
|
}
|
||||||
#else // show the channel frequency below the channel number/name
|
#else // show the channel frequency below the channel number/name
|
||||||
sprintf(String, "%03u.%05u", frequency / 100000, frequency % 100000);
|
sprintf(String, "%03u.%05lu", frequency / 100000, frequency % 100000);
|
||||||
UI_PrintStringSmallNormal(String, 32 + 4, 0, line + 1);
|
UI_PrintStringSmallNormal(String, 20 + 4, 0, line + 1);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else { // frequency mode
|
} else { // frequency mode
|
||||||
sprintf(String, "%3u.%05u", frequency / 100000, frequency % 100000);
|
sprintf(String, "%3lu.%05lu", frequency / 100000, frequency % 100000);
|
||||||
|
|
||||||
#ifdef ENABLE_BIG_FREQ
|
#ifdef ENABLE_BIG_FREQ
|
||||||
if (frequency < _1GHz_in_KHz) {
|
if (frequency < _1GHz_in_KHz) {
|
||||||
@@ -963,22 +828,16 @@ void UI_DisplayMain(void) {
|
|||||||
UI_PrintStringSmallNormal(String + 7, 113, 0, line + 1);
|
UI_PrintStringSmallNormal(String + 7, 113, 0, line + 1);
|
||||||
String[7] = 0;
|
String[7] = 0;
|
||||||
// show the main large frequency digits
|
// show the main large frequency digits
|
||||||
UI_DisplayFrequency(String, 32, line, false);
|
UI_DisplayFrequency(String, 20, line, false);
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
// show the frequency in the main font
|
// show the frequency in the main font
|
||||||
UI_PrintString(String, 32, 0, line, 8);
|
UI_PrintStringSmallBold(String, 40, 0, line /*, 8 */);
|
||||||
}
|
}
|
||||||
|
|
||||||
// show the channel symbols
|
// show the channel symbols
|
||||||
const ChannelAttributes_t att = gMR_ChannelAttributes[gEeprom.ScreenChannel[vfo_num]];
|
//const ChannelAttributes_t att = gMR_ChannelAttributes[gEeprom.ScreenChannel[vfo_num]];
|
||||||
if (att.compander)
|
|
||||||
#ifdef ENABLE_BIG_FREQ
|
|
||||||
memcpy(p_line0 + 120, BITMAP_compand, sizeof(BITMAP_compand));
|
|
||||||
#else
|
|
||||||
memcpy(p_line0 + 120 + LCD_WIDTH, BITMAP_compand, sizeof(BITMAP_compand));
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1008,7 +867,7 @@ void UI_DisplayMain(void) {
|
|||||||
Level = 2;
|
Level = 2;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
Level = gRxVfo->OUTPUT_POWER - 1;
|
Level = gRxVfo->OUTPUT_POWER;
|
||||||
} else if (mode == VFO_MODE_RX) { // RX signal level
|
} else if (mode == VFO_MODE_RX) { // RX signal level
|
||||||
#ifndef ENABLE_RSSI_BAR
|
#ifndef ENABLE_RSSI_BAR
|
||||||
// bar graph
|
// bar graph
|
||||||
@@ -1056,7 +915,6 @@ void UI_DisplayMain(void) {
|
|||||||
#if ENABLE_FEAT_F4HWN
|
#if ENABLE_FEAT_F4HWN
|
||||||
const FREQ_Config_t *pConfig = (mode == VFO_MODE_TX) ? vfoInfo->pTX : vfoInfo->pRX;
|
const FREQ_Config_t *pConfig = (mode == VFO_MODE_TX) ? vfoInfo->pTX : vfoInfo->pRX;
|
||||||
int8_t shift = 0;
|
int8_t shift = 0;
|
||||||
|
|
||||||
switch ((int) pConfig->CodeType) {
|
switch ((int) pConfig->CodeType) {
|
||||||
case 1:
|
case 1:
|
||||||
sprintf(String, "%u.%u", CTCSS_Options[pConfig->Code] / 10, CTCSS_Options[pConfig->Code] % 10);
|
sprintf(String, "%u.%u", CTCSS_Options[pConfig->Code] / 10, CTCSS_Options[pConfig->Code] % 10);
|
||||||
@@ -1075,103 +933,43 @@ void UI_DisplayMain(void) {
|
|||||||
shift = -10;
|
shift = -10;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gSetting_set_gui) {
|
|
||||||
UI_PrintStringSmallNormal(s, LCD_WIDTH + 22, 0, line + 1);
|
|
||||||
UI_PrintStringSmallNormal(t, LCD_WIDTH + 2, 0, line + 1);
|
|
||||||
|
|
||||||
if (isMainOnly() && !gDTMF_InputMode) {
|
|
||||||
if (shift == 0) {
|
|
||||||
UI_PrintStringSmallNormal(String, 2, 0, 6);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((vfoInfo->StepFrequency / 100) < 100) {
|
UI_PrintStringSmallNormal(s, 50, 0, line + 2);
|
||||||
sprintf(String, "%d.%02uK", vfoInfo->StepFrequency / 100, vfoInfo->StepFrequency % 100);
|
UI_PrintStringSmallNormal(t, 2, 0, line + 2);
|
||||||
} else {
|
|
||||||
sprintf(String, "%dK", vfoInfo->StepFrequency / 100);
|
|
||||||
}
|
|
||||||
UI_PrintStringSmallNormal(String, 46, 0, 6);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if ((s != NULL) && (s[0] != '\0')) {
|
|
||||||
GUI_DisplaySmallest(s, 58, line == 0 ? 17 : 49, false, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((t != NULL) && (t[0] != '\0')) {
|
if (shift == 0) {
|
||||||
GUI_DisplaySmallest(t, 3, line == 0 ? 17 : 49, false, true);
|
UI_PrintStringSmallNormal(String, 65, 0, line + 2);
|
||||||
}
|
|
||||||
|
|
||||||
GUI_DisplaySmallest(String, 68 + shift, line == 0 ? 17 : 49, false, true);
|
|
||||||
|
|
||||||
//sprintf(String, "%d.%02u", vfoInfo->StepFrequency / 100, vfoInfo->StepFrequency % 100);
|
|
||||||
//GUI_DisplaySmallest(String, 91, line == 0 ? 2 : 34, false, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((vfoInfo->StepFrequency / 100) < 100) {
|
||||||
|
sprintf(String, "%d.%02uK", vfoInfo->StepFrequency / 100, vfoInfo->StepFrequency % 100);
|
||||||
|
} else {
|
||||||
|
sprintf(String, "%dK", vfoInfo->StepFrequency / 100);
|
||||||
|
}
|
||||||
|
UI_PrintStringSmallNormal(String, 55, 0, line + 1);
|
||||||
#else
|
#else
|
||||||
UI_PrintStringSmallNormal(s, LCD_WIDTH + 24, 0, line + 1);
|
UI_PrintStringSmallNormal(s, LCD_WIDTH + 24, 0, line + 1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (state == VFO_STATE_NORMAL || state == VFO_STATE_ALARM) { // show the TX power
|
if (state == VFO_STATE_NORMAL || state == VFO_STATE_ALARM) { // show the TX power
|
||||||
uint8_t currentPower = vfoInfo->OUTPUT_POWER % 8;
|
const char pwr_short[][3] = {"L1", "L2", "L3", "L4", "L5", "ME",
|
||||||
uint8_t arrowPos = 19;
|
"HI"};
|
||||||
bool userPower = false;
|
UI_PrintStringSmallNormal(pwr_short[vfoInfo->OUTPUT_POWER], LCD_WIDTH + 25, 0, line + 1);
|
||||||
|
|
||||||
if (currentPower == OUTPUT_POWER_USER) {
|
|
||||||
currentPower = gSetting_set_pwr;
|
|
||||||
userPower = true;
|
|
||||||
} else {
|
|
||||||
currentPower--;
|
|
||||||
userPower = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gSetting_set_gui) {
|
|
||||||
const char pwr_short[][3] = {"L1", "L2", "L3", "L4", "L5", "M", "H"};
|
|
||||||
//sprintf(String, "%s", pwr_short[currentPower]);
|
|
||||||
//UI_PrintStringSmallNormal(String, LCD_WIDTH + 42, 0, line + 1);
|
|
||||||
UI_PrintStringSmallNormal(pwr_short[currentPower], LCD_WIDTH + 42, 0, line + 1);
|
|
||||||
|
|
||||||
arrowPos = 38;
|
|
||||||
} else {
|
|
||||||
const char pwr_long[][5] = {"LOW1", "LOW2", "LOW3", "LOW4", "LOW5", "MID", "HIGH"};
|
|
||||||
//sprintf(String, "%s", pwr_long[currentPower]);
|
|
||||||
//GUI_DisplaySmallest(String, 24, line == 0 ? 17 : 49, false, true);
|
|
||||||
GUI_DisplaySmallest(pwr_long[currentPower], 24, line == 0 ? 17 : 49, false, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (userPower == true) {
|
|
||||||
memcpy(p_line0 + 256 + arrowPos, BITMAP_PowerUser, sizeof(BITMAP_PowerUser));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vfoInfo->freq_config_RX.Frequency != vfoInfo->freq_config_TX.Frequency) { // show the TX offset symbol
|
if (vfoInfo->freq_config_RX.Frequency != vfoInfo->freq_config_TX.Frequency) { // show the TX offset symbol
|
||||||
int i = vfoInfo->TX_OFFSET_FREQUENCY_DIRECTION % 3;
|
int i = vfoInfo->TX_OFFSET_FREQUENCY_DIRECTION % 3;
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
|
||||||
const char dir_list[][2] = {"", "+", "-", "D"};
|
const char dir_list[][2] = {"", "+", "-", "D"};
|
||||||
|
|
||||||
if(gTxVfo->TX_OFFSET_FREQUENCY_DIRECTION != 0 && gTxVfo->pTX == &gTxVfo->freq_config_RX && !vfoInfo->FrequencyReverse)
|
if(gTxVfo->TX_OFFSET_FREQUENCY_DIRECTION != 0 && gTxVfo->pTX == &gTxVfo->freq_config_RX && !vfoInfo->FrequencyReverse)
|
||||||
{
|
{
|
||||||
i = 3;
|
i = 3;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
const char dir_list[][2] = {"", "+", "-"};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if ENABLE_FEAT_F4HWN
|
#if ENABLE_FEAT_F4HWN
|
||||||
if (gSetting_set_gui) {
|
UI_PrintStringSmallNormal(dir_list[i], LCD_WIDTH + 60, 0, line + 1);
|
||||||
UI_PrintStringSmallNormal(dir_list[i], LCD_WIDTH + 60, 0, line + 1);
|
|
||||||
} else {
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
|
||||||
if(i == 3)
|
|
||||||
{
|
|
||||||
GUI_DisplaySmallest(dir_list[i], 43, line == 0 ? 17 : 49, false, true);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
#endif
|
|
||||||
UI_PrintStringSmallNormal(dir_list[i], LCD_WIDTH + 41, 0, line + 1);
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
UI_PrintStringSmallNormal(dir_list[i], LCD_WIDTH + 54, 0, line + 1);
|
UI_PrintStringSmallNormal(dir_list[i], LCD_WIDTH + 54, 0, line + 1);
|
||||||
#endif
|
#endif
|
||||||
@@ -1181,100 +979,40 @@ void UI_DisplayMain(void) {
|
|||||||
if (vfoInfo->FrequencyReverse)
|
if (vfoInfo->FrequencyReverse)
|
||||||
#if ENABLE_FEAT_F4HWN
|
#if ENABLE_FEAT_F4HWN
|
||||||
{
|
{
|
||||||
if (gSetting_set_gui) {
|
UI_PrintStringSmallNormal("R", LCD_WIDTH + 110, 0, line + 1);
|
||||||
UI_PrintStringSmallNormal("R", LCD_WIDTH + 68, 0, line + 1);
|
|
||||||
} else {
|
|
||||||
GUI_DisplaySmallest("R", 51, line == 0 ? 17 : 49, false, true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
UI_PrintStringSmallNormal("R", LCD_WIDTH + 62, 0, line + 1);
|
UI_PrintStringSmallNormal("R", LCD_WIDTH + 110, 0, line + 1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLE_FEAT_F4HWN
|
#if ENABLE_FEAT_F4HWN
|
||||||
#ifdef ENABLE_FEAT_F4HWN_NARROWER
|
|
||||||
bool narrower = 0;
|
|
||||||
|
|
||||||
if (vfoInfo->CHANNEL_BANDWIDTH == BANDWIDTH_NARROW && gSetting_set_nfm == 1) {
|
const char *bandWidthNames[] = {"WID", "NAR", "NR+", "FSK"};
|
||||||
narrower = 1;
|
UI_PrintStringSmallNormal(bandWidthNames[vfoInfo->CHANNEL_BANDWIDTH], LCD_WIDTH + 30, 0,
|
||||||
}
|
line);
|
||||||
|
|
||||||
if (gSetting_set_gui) {
|
|
||||||
const char *bandWidthNames[] = {"W", "N", "N+"};
|
|
||||||
UI_PrintStringSmallNormal(bandWidthNames[vfoInfo->CHANNEL_BANDWIDTH + narrower], LCD_WIDTH + 80, 0,
|
|
||||||
line + 1);
|
|
||||||
} else {
|
|
||||||
const char *bandWidthNames[] = {"WIDE", "NAR", "NAR+"};
|
|
||||||
GUI_DisplaySmallest(bandWidthNames[vfoInfo->CHANNEL_BANDWIDTH + narrower], 91, line == 0 ? 17 : 49, false,
|
|
||||||
true);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
if (gSetting_set_gui)
|
|
||||||
{
|
|
||||||
const char *bandWidthNames[] = {"W", "N"};
|
|
||||||
UI_PrintStringSmallNormal(bandWidthNames[vfoInfo->CHANNEL_BANDWIDTH], LCD_WIDTH + 80, 0, line + 1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
const char *bandWidthNames[] = {"WIDE", "NAR"};
|
|
||||||
GUI_DisplaySmallest(bandWidthNames[vfoInfo->CHANNEL_BANDWIDTH], 91, line == 0 ? 17 : 49, false, true);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#else
|
#else
|
||||||
if (vfoInfo->CHANNEL_BANDWIDTH == BANDWIDTH_NARROW)
|
if (vfoInfo->CHANNEL_BANDWIDTH == BANDWIDTH_NARROW)
|
||||||
UI_PrintStringSmallNormal("N", LCD_WIDTH + 70, 0, line + 1);
|
UI_PrintStringSmallNormal("N", LCD_WIDTH + 70, 0, line + 1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
// show the DTMF decoding symbol
|
|
||||||
if (vfoInfo->DTMF_DECODING_ENABLE)
|
|
||||||
UI_PrintStringSmallNormal("DTMF", LCD_WIDTH + 78, 0, line + 1);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// show the audio scramble symbol
|
// show the audio scramble symbol
|
||||||
if (vfoInfo->SCRAMBLING_TYPE > 0)
|
if (vfoInfo->SCRAMBLING_TYPE > 0) {
|
||||||
UI_PrintStringSmallNormal("S", LCD_WIDTH + 106, 0, line);
|
sprintf(String, "S%d", inverse_scale_freq(vfoInfo->SCRAMBLING_TYPE));
|
||||||
|
UI_PrintStringSmallNormal(String, 90, 0, line + 2);
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN
|
#ifdef ENABLE_FEAT_F4HWN
|
||||||
/*
|
if (isMainVFO && gMonitor) {
|
||||||
if(isMainVFO)
|
strcpy(String, "MONI");
|
||||||
{
|
|
||||||
if(gMonitor)
|
|
||||||
{
|
|
||||||
sprintf(String, "%s", "MONI");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gSetting_set_gui)
|
} else {
|
||||||
{
|
sprintf(String, "SQL%d", gEeprom.SQUELCH_LEVEL);
|
||||||
if(!gMonitor)
|
|
||||||
{
|
|
||||||
sprintf(String, "SQL%d", gEeprom.SQUELCH_LEVEL);
|
|
||||||
}
|
|
||||||
UI_PrintStringSmallNormal(String, LCD_WIDTH + 98, 0, line + 1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if(!gMonitor)
|
|
||||||
{
|
|
||||||
sprintf(String, "SQL%d", gEeprom.SQUELCH_LEVEL);
|
|
||||||
}
|
|
||||||
GUI_DisplaySmallest(String, 110, line == 0 ? 17 : 49, false, true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
if (isMainVFO) {
|
|
||||||
if (gMonitor) {
|
|
||||||
strcpy(String, "MONI");
|
|
||||||
} else {
|
|
||||||
sprintf(String, "SQL%d", gEeprom.SQUELCH_LEVEL);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gSetting_set_gui) {
|
UI_PrintStringSmallNormal(String, LCD_WIDTH + 98, 0, line);
|
||||||
UI_PrintStringSmallNormal(String, LCD_WIDTH + 98, 0, line + 1);
|
|
||||||
} else {
|
|
||||||
GUI_DisplaySmallest(String, 110, line == 0 ? 17 : 49, false, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1298,9 +1036,6 @@ void UI_DisplayMain(void) {
|
|||||||
if (rx && gEeprom.VfoInfo[gEeprom.RX_VFO].Modulation == MODULATION_AM && gSetting_AM_fix)
|
if (rx && gEeprom.VfoInfo[gEeprom.RX_VFO].Modulation == MODULATION_AM && gSetting_AM_fix)
|
||||||
{
|
{
|
||||||
if (gScreenToDisplay != DISPLAY_MAIN
|
if (gScreenToDisplay != DISPLAY_MAIN
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
|| gDTMF_CallState != DTMF_CALL_STATE_NONE
|
|
||||||
#endif
|
|
||||||
)
|
)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -1324,9 +1059,6 @@ void UI_DisplayMain(void) {
|
|||||||
const unsigned int idx = (len > (17 - 5)) ? len - (17 - 5) : 0; // limit to last 'n' chars
|
const unsigned int idx = (len > (17 - 5)) ? len - (17 - 5) : 0; // limit to last 'n' chars
|
||||||
|
|
||||||
if (gScreenToDisplay != DISPLAY_MAIN
|
if (gScreenToDisplay != DISPLAY_MAIN
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
|| gDTMF_CallState != DTMF_CALL_STATE_NONE
|
|
||||||
#endif
|
|
||||||
)
|
)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -1365,9 +1097,6 @@ void UI_DisplayMain(void) {
|
|||||||
else if (gChargingWithTypeC)
|
else if (gChargingWithTypeC)
|
||||||
{ // charging .. show the battery state
|
{ // charging .. show the battery state
|
||||||
if (gScreenToDisplay != DISPLAY_MAIN
|
if (gScreenToDisplay != DISPLAY_MAIN
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
|| gDTMF_CallState != DTMF_CALL_STATE_NONE
|
|
||||||
#endif
|
|
||||||
)
|
)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ extern const int8_t dBmCorrTable[7];
|
|||||||
void UI_DisplayAudioBar(void);
|
void UI_DisplayAudioBar(void);
|
||||||
void UI_MAIN_TimeSlice500ms(void);
|
void UI_MAIN_TimeSlice500ms(void);
|
||||||
void UI_DisplayMain(void);
|
void UI_DisplayMain(void);
|
||||||
|
bool isMainOnly();
|
||||||
|
|
||||||
#ifdef ENABLE_AGC_SHOW_DATA
|
#ifdef ENABLE_AGC_SHOW_DATA
|
||||||
void UI_MAIN_PrintAGC(bool force);
|
void UI_MAIN_PrintAGC(bool force);
|
||||||
|
|||||||
@@ -48,13 +48,12 @@ const t_menu_item MenuList[] =
|
|||||||
{"TCTCS", MENU_T_CTCS}, // was "T_CTCS"
|
{"TCTCS", MENU_T_CTCS}, // was "T_CTCS"
|
||||||
{"TxODir", MENU_SFT_D}, // was "SFT_D"
|
{"TxODir", MENU_SFT_D}, // was "SFT_D"
|
||||||
{"TxOffs", MENU_OFFSET}, // was "OFFSET"
|
{"TxOffs", MENU_OFFSET}, // was "OFFSET"
|
||||||
{"W/N", MENU_W_N},
|
{"WID", MENU_W_N},
|
||||||
{"SCR", MENU_SCR}, // was "SCR"
|
{"SCR", MENU_SCR}, // was "SCR"
|
||||||
{"BusyL", MENU_BCL}, // was "BCL"
|
{"BusyL", MENU_BCL}, // was "BCL"
|
||||||
{"COMP", MENU_COMPAND},
|
{"COMP", MENU_COMPAND},
|
||||||
{"Mod", MENU_AM}, // was "AM"
|
{"Mod", MENU_AM}, // was "AM"
|
||||||
#ifdef ENABLE_FEAT_F4HWN
|
#ifdef ENABLE_FEAT_F4HWN
|
||||||
{"TXLck", MENU_TX_LOCK},
|
|
||||||
#endif
|
#endif
|
||||||
{"ScAdd1", MENU_S_ADD1},
|
{"ScAdd1", MENU_S_ADD1},
|
||||||
{"ScAdd2", MENU_S_ADD2},
|
{"ScAdd2", MENU_S_ADD2},
|
||||||
@@ -80,7 +79,7 @@ const t_menu_item MenuList[] =
|
|||||||
{"ML", MENU_MLONG},
|
{"ML", MENU_MLONG},
|
||||||
|
|
||||||
{"KeyLck", MENU_AUTOLK}, // was "AUTOLk"
|
{"KeyLck", MENU_AUTOLK}, // was "AUTOLk"
|
||||||
{"TxTOut", MENU_TOT}, // was "TOT"
|
{"TXTime", MENU_TOT},
|
||||||
{"BatSav", MENU_SAVE}, // was "SAVE"
|
{"BatSav", MENU_SAVE}, // was "SAVE"
|
||||||
{"BatTxt", MENU_BAT_TXT},
|
{"BatTxt", MENU_BAT_TXT},
|
||||||
{"Mic", MENU_MIC},
|
{"Mic", MENU_MIC},
|
||||||
@@ -88,6 +87,9 @@ const t_menu_item MenuList[] =
|
|||||||
{"ChDisp", MENU_MDF}, // was "MDF"
|
{"ChDisp", MENU_MDF}, // was "MDF"
|
||||||
{"FSKMod", MENU_FSKMOD},
|
{"FSKMod", MENU_FSKMOD},
|
||||||
{"FSKSRC", MENU_FSKSRC}, // was "AUTOLk"
|
{"FSKSRC", MENU_FSKSRC}, // was "AUTOLk"
|
||||||
|
#ifdef ENABLE_POCSAG
|
||||||
|
{"PocMon", MENU_PMON}, // POCSAG monitor: receive all RICs
|
||||||
|
#endif
|
||||||
{"BLTime", MENU_ABR}, // was "ABR"
|
{"BLTime", MENU_ABR}, // was "ABR"
|
||||||
{"BLMin", MENU_ABR_MIN},
|
{"BLMin", MENU_ABR_MIN},
|
||||||
{"BLMax", MENU_ABR_MAX},
|
{"BLMax", MENU_ABR_MAX},
|
||||||
@@ -102,23 +104,13 @@ const t_menu_item MenuList[] =
|
|||||||
{"1 Call", MENU_1_CALL},
|
{"1 Call", MENU_1_CALL},
|
||||||
#ifdef ENABLE_ALARM
|
#ifdef ENABLE_ALARM
|
||||||
{"AlarmT", MENU_AL_MOD},
|
{"AlarmT", MENU_AL_MOD},
|
||||||
#endif
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
{"ANI ID", MENU_ANI_ID },
|
|
||||||
#endif
|
#endif
|
||||||
{"UPCode", MENU_UPCODE},
|
{"UPCode", MENU_UPCODE},
|
||||||
{"DNCode", MENU_DWCODE},
|
{"DNCode", MENU_DWCODE},
|
||||||
{"PTT ID", MENU_PTT_ID},
|
{"PTT ID", MENU_PTT_ID},
|
||||||
{"L DTMF", MENU_D_ST},
|
{"L DTMF", MENU_D_ST},
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
{"D Resp", MENU_D_RSP },
|
|
||||||
{"D Hold", MENU_D_HOLD },
|
|
||||||
#endif
|
|
||||||
{"D Prel", MENU_D_PRE},
|
{"D Prel", MENU_D_PRE},
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
{"D Decd", MENU_D_DCD },
|
|
||||||
{"D List", MENU_D_LIST },
|
|
||||||
#endif
|
|
||||||
{"D Live", MENU_D_LIVE_DEC}, // live DTMF decoder
|
{"D Live", MENU_D_LIVE_DEC}, // live DTMF decoder
|
||||||
#ifndef ENABLE_FEAT_F4HWN
|
#ifndef ENABLE_FEAT_F4HWN
|
||||||
#ifdef ENABLE_AM_FIX
|
#ifdef ENABLE_AM_FIX
|
||||||
@@ -131,28 +123,15 @@ const t_menu_item MenuList[] =
|
|||||||
{"RxMode", MENU_TDR},
|
{"RxMode", MENU_TDR},
|
||||||
{"Sql", MENU_SQL},
|
{"Sql", MENU_SQL},
|
||||||
#ifdef ENABLE_FEAT_F4HWN
|
#ifdef ENABLE_FEAT_F4HWN
|
||||||
{"SPwr", MENU_SET_PWR},
|
|
||||||
{"SPTT", MENU_SET_PTT},
|
{"SPTT", MENU_SET_PTT},
|
||||||
{"STOT", MENU_SET_TOT},
|
|
||||||
{"SEOT", MENU_SET_EOT},
|
|
||||||
{"SCtr", MENU_SET_CTR},
|
|
||||||
{"SInv", MENU_SET_INV},
|
{"SInv", MENU_SET_INV},
|
||||||
{"SLck", MENU_SET_LCK},
|
|
||||||
//{"SMet", MENU_SET_MET},
|
|
||||||
//{"SGUI", MENU_SET_GUI},
|
|
||||||
{"STmr", MENU_SET_TMR},
|
{"STmr", MENU_SET_TMR},
|
||||||
#ifdef ENABLE_FEAT_F4HWN_SLEEP
|
#ifdef ENABLE_FEAT_F4HWN_SLEEP
|
||||||
{"SOff", MENU_SET_OFF},
|
{"SOff", MENU_SET_OFF},
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_FEAT_F4HWN_NARROWER
|
|
||||||
{"SNFM", MENU_SET_NFM},
|
|
||||||
#endif
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_VOL
|
#ifdef ENABLE_FEAT_F4HWN_VOL
|
||||||
{"SVol", MENU_SET_VOL},
|
{"SVol", MENU_SET_VOL},
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
|
||||||
{"SKey", MENU_SET_KEY },
|
|
||||||
#endif
|
|
||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_NOAA
|
||||||
{"SNWR", MENU_NOAA_S },
|
{"SNWR", MENU_NOAA_S },
|
||||||
#endif
|
#endif
|
||||||
@@ -160,13 +139,6 @@ const t_menu_item MenuList[] =
|
|||||||
// hidden menu items from here on
|
// hidden menu items from here on
|
||||||
// enabled if pressing both the PTT and upper side button at power-on
|
// enabled if pressing both the PTT and upper side button at power-on
|
||||||
{"F Lock", MENU_F_LOCK},
|
{"F Lock", MENU_F_LOCK},
|
||||||
#ifndef ENABLE_FEAT_F4HWN
|
|
||||||
{"Tx 200", MENU_200TX }, // was "200TX"
|
|
||||||
{"Tx 350", MENU_350TX }, // was "350TX"
|
|
||||||
{"Tx 500", MENU_500TX }, // was "500TX"
|
|
||||||
{"350 En", MENU_350EN }, // was "350EN"
|
|
||||||
#endif
|
|
||||||
//{"ScraEn", MENU_SCREN }, // was "SCREN"
|
|
||||||
#ifdef ENABLE_F_CAL_MENU
|
#ifdef ENABLE_F_CAL_MENU
|
||||||
{"FrCali", MENU_F_CALI}, // reference xtal calibration
|
{"FrCali", MENU_F_CALI}, // reference xtal calibration
|
||||||
#endif
|
#endif
|
||||||
@@ -177,18 +149,15 @@ const t_menu_item MenuList[] =
|
|||||||
{"", 0xff} // end of list - DO NOT delete or move this this
|
{"", 0xff} // end of list - DO NOT delete or move this this
|
||||||
};
|
};
|
||||||
|
|
||||||
const uint8_t FIRST_HIDDEN_MENU_ITEM = MENU_F_LOCK;
|
const char gSubMenu_TXP[][5] =
|
||||||
|
|
||||||
const char gSubMenu_TXP[][6] =
|
|
||||||
{
|
{
|
||||||
"USR",
|
"<.02",
|
||||||
"L1",
|
".125",
|
||||||
"L2",
|
".25",
|
||||||
"L3",
|
".5",
|
||||||
"L4",
|
"1",
|
||||||
"L5",
|
"2",
|
||||||
"M",
|
"5"
|
||||||
"H"
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const char gSubMenu_SFT_D[][4] =
|
const char gSubMenu_SFT_D[][4] =
|
||||||
@@ -198,10 +167,12 @@ const char gSubMenu_SFT_D[][4] =
|
|||||||
"-"
|
"-"
|
||||||
};
|
};
|
||||||
|
|
||||||
const char gSubMenu_W_N[][7] =
|
const char gSubMenu_W_N[][5] =
|
||||||
{
|
{
|
||||||
"WIDE",
|
"WIDE",
|
||||||
"NARR"
|
"NARR",
|
||||||
|
"NAR+",
|
||||||
|
"FSKQ"
|
||||||
};
|
};
|
||||||
|
|
||||||
const char gSubMenu_OFF_ON[][4] =
|
const char gSubMenu_OFF_ON[][4] =
|
||||||
@@ -219,8 +190,8 @@ const char *const gSubMenu_RXMode[] =
|
|||||||
{
|
{
|
||||||
"MAIN", // TX and RX on main only
|
"MAIN", // TX and RX on main only
|
||||||
"RESP", // Watch both and respond
|
"RESP", // Watch both and respond
|
||||||
"XBAND ONLY", // TX on main, RX on secondary
|
"XBAND", // TX on main, RX on secondary
|
||||||
"DUALMON" // always TX on main, but RX on both
|
"DMON" // always TX on main, but RX on both
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
@@ -235,7 +206,7 @@ const char gSubMenu_VOICE[][4] =
|
|||||||
const char *const gSubMenu_MDF[] =
|
const char *const gSubMenu_MDF[] =
|
||||||
{
|
{
|
||||||
"FREQ",
|
"FREQ",
|
||||||
"CHNUMB",
|
"CHNUM",
|
||||||
"NAME",
|
"NAME",
|
||||||
"NAME\n+\nFREQ"
|
"NAME\n+\nFREQ"
|
||||||
};
|
};
|
||||||
@@ -248,16 +219,6 @@ const char gSubMenu_AL_MOD[][5] =
|
|||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
const char gSubMenu_D_RSP[][11] =
|
|
||||||
{
|
|
||||||
"DO\nNOTHING",
|
|
||||||
"RING",
|
|
||||||
"REPLY",
|
|
||||||
"BOTH"
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
const char *const gSubMenu_PTT_ID[] =
|
const char *const gSubMenu_PTT_ID[] =
|
||||||
{
|
{
|
||||||
"OFF",
|
"OFF",
|
||||||
@@ -271,10 +232,16 @@ const char gSubMenu_FSKMod[][8] =
|
|||||||
{
|
{
|
||||||
"450",
|
"450",
|
||||||
"700",
|
"700",
|
||||||
|
"1200",
|
||||||
|
"2400",
|
||||||
"A1200",
|
"A1200",
|
||||||
"A2400",
|
"A2400",
|
||||||
"2400",
|
"NOAA",
|
||||||
"NOAA"
|
#ifdef ENABLE_POCSAG
|
||||||
|
"PCS1200",
|
||||||
|
"PCS512",
|
||||||
|
"PCS2400"
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
const char gSubMenu_ROGER[][6] =
|
const char gSubMenu_ROGER[][6] =
|
||||||
@@ -319,85 +286,27 @@ const char gSubMenu_RX_TX[][6] =
|
|||||||
"TX/RX"
|
"TX/RX"
|
||||||
};
|
};
|
||||||
|
|
||||||
const char gSubMenu_BAT_TXT[][8] =
|
const char gSubMenu_BAT_TXT[][5] =
|
||||||
{
|
{
|
||||||
"NONE",
|
"NONE",
|
||||||
"VLT",
|
"VLT",
|
||||||
"PRC"
|
"PRC"
|
||||||
};
|
};
|
||||||
|
|
||||||
const char gSubMenu_BATTYP[][9] =
|
const char gSubMenu_BATTYP[][3] =
|
||||||
{
|
{
|
||||||
"16",
|
"16",
|
||||||
"22",
|
"22",
|
||||||
"35"
|
"35"
|
||||||
};
|
};
|
||||||
|
|
||||||
const char gSubMenu_SCRAMBLER[][7] =
|
|
||||||
{
|
|
||||||
"OFF",
|
|
||||||
"26K",
|
|
||||||
"27K",
|
|
||||||
"28K",
|
|
||||||
"29K",
|
|
||||||
"30K",
|
|
||||||
"31K",
|
|
||||||
"32K",
|
|
||||||
"33K",
|
|
||||||
"34K",
|
|
||||||
"35K"
|
|
||||||
};
|
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN
|
#ifdef ENABLE_FEAT_F4HWN
|
||||||
const char gSubMenu_SET_PWR[][6] =
|
|
||||||
{
|
|
||||||
"<.02",
|
|
||||||
".125",
|
|
||||||
".25",
|
|
||||||
".5",
|
|
||||||
"1",
|
|
||||||
"2",
|
|
||||||
"5"
|
|
||||||
};
|
|
||||||
|
|
||||||
const char gSubMenu_SET_PTT[][8] =
|
const char gSubMenu_SET_PTT[][4] =
|
||||||
{
|
{
|
||||||
"HOLD",
|
"HOL",
|
||||||
"TAP"
|
"TOG",
|
||||||
};
|
};
|
||||||
|
|
||||||
const char gSubMenu_SET_TOT[][7] = // Use by SET_EOT too
|
|
||||||
{
|
|
||||||
"OFF",
|
|
||||||
"SND",
|
|
||||||
"VIS",
|
|
||||||
"ALL"
|
|
||||||
};
|
|
||||||
|
|
||||||
const char gSubMenu_SET_LCK[][9] =
|
|
||||||
{
|
|
||||||
"KEY",
|
|
||||||
"KEY+PTT"
|
|
||||||
};
|
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_NARROWER
|
|
||||||
const char gSubMenu_SET_NFM[][9] =
|
|
||||||
{
|
|
||||||
"NRW",
|
|
||||||
"NRWER"
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
|
||||||
const char gSubMenu_SET_KEY[][9] =
|
|
||||||
{
|
|
||||||
"KEY_MENU",
|
|
||||||
"KEY_UP",
|
|
||||||
"KEY_DOWN",
|
|
||||||
"KEY_EXIT",
|
|
||||||
"KEY_STAR"
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const t_sidefunction gSubMenu_SIDEFUNCTIONS[] =
|
const t_sidefunction gSubMenu_SIDEFUNCTIONS[] =
|
||||||
@@ -434,16 +343,11 @@ const t_sidefunction gSubMenu_SIDEFUNCTIONS[] =
|
|||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_FEAT_F4HWN
|
#ifdef ENABLE_FEAT_F4HWN
|
||||||
{"RX MOD", ACTION_OPT_RXMODE},
|
{"RX MOD", ACTION_OPT_RXMODE},
|
||||||
{"MAIN ONLY", ACTION_OPT_MAINONLY},
|
|
||||||
{"PTT", ACTION_OPT_PTT},
|
{"PTT", ACTION_OPT_PTT},
|
||||||
{"WIDE\nNAR", ACTION_OPT_WN},
|
{"WIDE\nNAR", ACTION_OPT_WN},
|
||||||
#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
|
#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
|
||||||
{"MUTE", ACTION_OPT_MUTE},
|
{"MUTE", ACTION_OPT_MUTE},
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
|
||||||
{"POWER\nHIGH", ACTION_OPT_POWER_HIGH},
|
|
||||||
{"REMOVE\nOFFSET", ACTION_OPT_REMOVE_OFFSET},
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -480,9 +384,6 @@ void UI_DisplayMenu(void) {
|
|||||||
unsigned int i;
|
unsigned int i;
|
||||||
char String[64]; // bigger cuz we can now do multi-line in one string (use '\n' char)
|
char String[64]; // bigger cuz we can now do multi-line in one string (use '\n' char)
|
||||||
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
char Contact[16];
|
|
||||||
#endif
|
|
||||||
|
|
||||||
UI_DisplayClear();
|
UI_DisplayClear();
|
||||||
|
|
||||||
@@ -500,7 +401,7 @@ void UI_DisplayMenu(void) {
|
|||||||
for (i = 0; i < 3; i++)
|
for (i = 0; i < 3; i++)
|
||||||
if (gMenuCursor > 0 || i > 0)
|
if (gMenuCursor > 0 || i > 0)
|
||||||
if ((gMenuListCount - 1) != gMenuCursor || i != 2)
|
if ((gMenuListCount - 1) != gMenuCursor || i != 2)
|
||||||
UI_PrintString(MenuList[gMenuCursor + i - 1].name, 0, 0, i * 2, 8);
|
UI_PrintString(MenuList[gMenuCursor + i - 1].name, 0, 0, i * 2 /*, 8 */);
|
||||||
|
|
||||||
// invert the current menu list item pixels
|
// invert the current menu list item pixels
|
||||||
for (i = 0; i < (8 * menu_list_width); i++)
|
for (i = 0; i < (8 * menu_list_width); i++)
|
||||||
@@ -525,14 +426,17 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
|||||||
#else
|
#else
|
||||||
{ // new menu layout .. experimental & unfinished
|
{ // new menu layout .. experimental & unfinished
|
||||||
const int menu_index = gMenuCursor; // current selected menu item
|
const int menu_index = gMenuCursor; // current selected menu item
|
||||||
i = 1;
|
i = 0;
|
||||||
|
|
||||||
if (!gIsInSubMenu) {
|
if (!gIsInSubMenu) {
|
||||||
while (i < 2) { // leading menu items - small text
|
while (i < 2) { // leading menu items - small text
|
||||||
const int k = menu_index + i - 2;
|
const int k = menu_index + i - 2;
|
||||||
if (k < 0)
|
if (k < 0)
|
||||||
UI_PrintStringSmallNormal(MenuList[gMenuListCount + k].name, 0, 0, i); // wrap-a-round
|
UI_PrintStringSmallNormal(MenuList[(gMenuListCount + k) % gMenuListCount].name, 0, 0,
|
||||||
else if (k >= 0 && k < (int) gMenuListCount)
|
i); // wrap-around
|
||||||
|
else if (k >= (int) gMenuListCount)
|
||||||
|
UI_PrintStringSmallNormal(MenuList[k % gMenuListCount].name, 0, 0, i); // wrap-around
|
||||||
|
else
|
||||||
UI_PrintStringSmallNormal(MenuList[k].name, 0, 0, i);
|
UI_PrintStringSmallNormal(MenuList[k].name, 0, 0, i);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
@@ -546,10 +450,13 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
|||||||
|
|
||||||
while (i < 5) { // trailing menu item - small text
|
while (i < 5) { // trailing menu item - small text
|
||||||
const int k = menu_index + i - 2;
|
const int k = menu_index + i - 2;
|
||||||
if (k >= 0 && k < (int) gMenuListCount)
|
if (k < 0)
|
||||||
UI_PrintStringSmallNormal(MenuList[k].name, 0, 0, i);
|
UI_PrintStringSmallNormal(MenuList[(gMenuListCount + k) % gMenuListCount].name, 0, 0,
|
||||||
|
i); // wrap-around
|
||||||
else if (k >= (int) gMenuListCount)
|
else if (k >= (int) gMenuListCount)
|
||||||
UI_PrintStringSmallNormal(MenuList[gMenuListCount - k].name, 0, 0, i); // wrap-a-round
|
UI_PrintStringSmallNormal(MenuList[k % gMenuListCount].name, 0, 0, i); // wrap-around
|
||||||
|
else
|
||||||
|
UI_PrintStringSmallNormal(MenuList[k].name, 0, 0, i);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -560,7 +467,7 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
|||||||
#endif
|
#endif
|
||||||
} else if (menu_index >= 0 && menu_index < (int) gMenuListCount) { // current menu item
|
} else if (menu_index >= 0 && menu_index < (int) gMenuListCount) { // current menu item
|
||||||
// strcat(String, ":");
|
// strcat(String, ":");
|
||||||
UI_PrintString(MenuList[menu_index].name, 0, 0, 0, 8);
|
UI_PrintString(MenuList[menu_index].name, 0, 0, 0 /*, 8 */);
|
||||||
// UI_PrintStringSmallNormal(String, 0, 0, 0);
|
// UI_PrintStringSmallNormal(String, 0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -583,15 +490,9 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
|||||||
|
|
||||||
BACKLIGHT_TurnOn();
|
BACKLIGHT_TurnOn();
|
||||||
|
|
||||||
#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
|
|
||||||
uint8_t gaugeLine = 0;
|
|
||||||
uint8_t gaugeMin = 0;
|
|
||||||
uint8_t gaugeMax = 0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
switch (UI_MENU_GetCurrentMenuId()) {
|
switch (UI_MENU_GetCurrentMenuId()) {
|
||||||
case MENU_SQL:
|
case MENU_SQL:
|
||||||
sprintf(String, "%d", gSubMenuSelection);
|
sprintf(String, "%ld", gSubMenuSelection);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_MIC: { // display the mic gain in actual dB rather than just an index number
|
case MENU_MIC: { // display the mic gain in actual dB rather than just an index number
|
||||||
@@ -615,11 +516,7 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
|||||||
}
|
}
|
||||||
|
|
||||||
case MENU_TXP:
|
case MENU_TXP:
|
||||||
if (gSubMenuSelection == 0) {
|
sprintf(String, "%sW", gSubMenu_TXP[gSubMenuSelection]);
|
||||||
strcpy(String, gSubMenu_TXP[gSubMenuSelection]);
|
|
||||||
} else {
|
|
||||||
sprintf(String, "%s\n%sW", gSubMenu_TXP[gSubMenuSelection], gSubMenu_SET_PWR[gSubMenuSelection - 1]);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_R_DCS:
|
case MENU_R_DCS:
|
||||||
@@ -648,15 +545,15 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
|||||||
|
|
||||||
case MENU_OFFSET:
|
case MENU_OFFSET:
|
||||||
if (!gIsInSubMenu || gInputBoxIndex == 0) {
|
if (!gIsInSubMenu || gInputBoxIndex == 0) {
|
||||||
sprintf(String, "%3d.%05u", gSubMenuSelection / 100000, abs(gSubMenuSelection) % 100000);
|
sprintf(String, "%3ld.%05u", gSubMenuSelection / 100000, abs(gSubMenuSelection) % 100000);
|
||||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 1, 8);
|
UI_PrintString(String, menu_item_x1, menu_item_x2, 1 /*, 8 */);
|
||||||
} else {
|
} else {
|
||||||
const char *ascii = INPUTBOX_GetAscii();
|
const char *ascii = INPUTBOX_GetAscii();
|
||||||
sprintf(String, "%.3s.%.3s ", ascii, ascii + 3);
|
sprintf(String, "%.3s.%.3s ", ascii, ascii + 3);
|
||||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 1, 8);
|
UI_PrintString(String, menu_item_x1, menu_item_x2, 1 /*, 8 */);
|
||||||
}
|
}
|
||||||
|
|
||||||
UI_PrintString("MHz", menu_item_x1, menu_item_x2, 3, 8);
|
UI_PrintString("MHz", menu_item_x1, menu_item_x2, 3 /*, 8 */);
|
||||||
|
|
||||||
already_printed = true;
|
already_printed = true;
|
||||||
break;
|
break;
|
||||||
@@ -666,16 +563,17 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_SCR:
|
case MENU_SCR:
|
||||||
strcpy(String, gSubMenu_SCRAMBLER[gSubMenuSelection]);
|
if (gSubMenuSelection > 0) {
|
||||||
if (gSubMenuSelection > 0)
|
sprintf(String, "%huHz\n%ld", inverse_scale_freq(gSubMenuSelection), gSubMenuSelection);
|
||||||
BK4819_EnableScramble(gSubMenuSelection - 1);
|
} else {
|
||||||
else
|
strcpy(String, "OFF");
|
||||||
BK4819_DisableScramble();
|
}
|
||||||
|
BK4819_SetScramble(gSubMenuSelection);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_VOX:
|
case MENU_VOX:
|
||||||
#ifdef ENABLE_VOX
|
#ifdef ENABLE_VOX
|
||||||
sprintf(String, gSubMenuSelection == 0 ? gSubMenu_OFF_ON[0] : "%u", gSubMenuSelection);
|
sprintf(String, gSubMenuSelection == 0 ? gSubMenu_OFF_ON[0] : "%lu", gSubMenuSelection);
|
||||||
#else
|
#else
|
||||||
strcpy(String, gSubMenu_NA);
|
strcpy(String, gSubMenu_NA);
|
||||||
#endif
|
#endif
|
||||||
@@ -685,13 +583,7 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
|||||||
if (gSubMenuSelection == 0) {
|
if (gSubMenuSelection == 0) {
|
||||||
strcpy(String, gSubMenu_OFF_ON[0]);
|
strcpy(String, gSubMenu_OFF_ON[0]);
|
||||||
} else if (gSubMenuSelection < 61) {
|
} else if (gSubMenuSelection < 61) {
|
||||||
sprintf(String, "%02dm:%02ds", (((gSubMenuSelection) * 5) / 60), (((gSubMenuSelection) * 5) % 60));
|
sprintf(String, "%02ldm:%02lds", (((gSubMenuSelection) * 5) / 60), (((gSubMenuSelection) * 5) % 60));
|
||||||
#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
|
|
||||||
//ST7565_Gauge(4, 1, 60, gSubMenuSelection);
|
|
||||||
gaugeLine = 4;
|
|
||||||
gaugeMin = 1;
|
|
||||||
gaugeMax = 60;
|
|
||||||
#endif
|
|
||||||
} else {
|
} else {
|
||||||
strcpy(String, "ON");
|
strcpy(String, "ON");
|
||||||
}
|
}
|
||||||
@@ -703,7 +595,7 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
|||||||
|
|
||||||
case MENU_ABR_MIN:
|
case MENU_ABR_MIN:
|
||||||
case MENU_ABR_MAX:
|
case MENU_ABR_MAX:
|
||||||
sprintf(String, "%d", gSubMenuSelection);
|
sprintf(String, "%ld", gSubMenuSelection);
|
||||||
if (gIsInSubMenu)
|
if (gIsInSubMenu)
|
||||||
BACKLIGHT_SetBrightness(gSubMenuSelection);
|
BACKLIGHT_SetBrightness(gSubMenuSelection);
|
||||||
// Obsolete ???
|
// Obsolete ???
|
||||||
@@ -715,22 +607,24 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
|||||||
strcpy(String, gModulationStr[gSubMenuSelection]);
|
strcpy(String, gModulationStr[gSubMenuSelection]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case MENU_TOT:
|
||||||
|
if (gSubMenuSelection == 0) {
|
||||||
|
strcpy(String, "OFF");
|
||||||
|
} else {
|
||||||
|
sprintf(String, "%02ldm:%02lds", (((gSubMenuSelection + 1) * 5) / 60), (((gSubMenuSelection + 1) * 5) % 60));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case MENU_AUTOLK:
|
case MENU_AUTOLK:
|
||||||
if (gSubMenuSelection == 0)
|
if (gSubMenuSelection == 0)
|
||||||
strcpy(String, gSubMenu_OFF_ON[0]);
|
strcpy(String, gSubMenu_OFF_ON[0]);
|
||||||
else {
|
else {
|
||||||
sprintf(String, "%02dm:%02ds", ((gSubMenuSelection * 15) / 60), ((gSubMenuSelection * 15) % 60));
|
sprintf(String, "%02ldm:%02lds", ((gSubMenuSelection * 15) / 60), ((gSubMenuSelection * 15) % 60));
|
||||||
#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
|
|
||||||
//ST7565_Gauge(4, 1, 40, gSubMenuSelection);
|
|
||||||
gaugeLine = 4;
|
|
||||||
gaugeMin = 1;
|
|
||||||
gaugeMax = 40;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_FSKSRC:
|
case MENU_FSKSRC:
|
||||||
sprintf(String, "%d", gSubMenuSelection);
|
sprintf(String, "%ld", gSubMenuSelection);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_COMPAND:
|
case MENU_COMPAND:
|
||||||
@@ -745,25 +639,16 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
|||||||
#endif
|
#endif
|
||||||
case MENU_BCL:
|
case MENU_BCL:
|
||||||
case MENU_BEEP:
|
case MENU_BEEP:
|
||||||
|
case MENU_PMON:
|
||||||
case MENU_S_ADD1:
|
case MENU_S_ADD1:
|
||||||
case MENU_S_ADD2:
|
case MENU_S_ADD2:
|
||||||
case MENU_S_ADD3:
|
case MENU_S_ADD3:
|
||||||
case MENU_STE:
|
case MENU_STE:
|
||||||
case MENU_D_ST:
|
case MENU_D_ST:
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
case MENU_D_DCD:
|
|
||||||
#endif
|
|
||||||
case MENU_D_LIVE_DEC:
|
case MENU_D_LIVE_DEC:
|
||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_NOAA
|
||||||
case MENU_NOAA_S:
|
case MENU_NOAA_S:
|
||||||
#endif
|
#endif
|
||||||
#ifndef ENABLE_FEAT_F4HWN
|
|
||||||
case MENU_350TX:
|
|
||||||
case MENU_200TX:
|
|
||||||
case MENU_500TX:
|
|
||||||
#endif
|
|
||||||
case MENU_350EN:
|
|
||||||
//case MENU_SCREN:
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN
|
#ifdef ENABLE_FEAT_F4HWN
|
||||||
case MENU_SET_TMR:
|
case MENU_SET_TMR:
|
||||||
#endif
|
#endif
|
||||||
@@ -776,16 +661,16 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
|||||||
const bool valid = RADIO_CheckValidChannel(gSubMenuSelection, false, 0);
|
const bool valid = RADIO_CheckValidChannel(gSubMenuSelection, false, 0);
|
||||||
|
|
||||||
UI_GenerateChannelStringEx(String, valid, gSubMenuSelection);
|
UI_GenerateChannelStringEx(String, valid, gSubMenuSelection);
|
||||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 0, 8);
|
UI_PrintString(String, menu_item_x1, menu_item_x2, 0 /*, 8 */);
|
||||||
|
|
||||||
if (valid && !gAskForConfirmation) { // show the frequency so that the user knows the channels frequency
|
if (valid && !gAskForConfirmation) { // show the frequency so that the user knows the channels frequency
|
||||||
const uint32_t frequency = SETTINGS_FetchChannelFrequency(gSubMenuSelection);
|
const uint32_t frequency = SETTINGS_FetchChannelFrequency(gSubMenuSelection);
|
||||||
sprintf(String, "%u.%05u", frequency / 100000, frequency % 100000);
|
sprintf(String, "%lu.%05lu", frequency / 100000, frequency % 100000);
|
||||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 4, 8);
|
UI_PrintString(String, menu_item_x1, menu_item_x2, 4 /*, 8 */);
|
||||||
}
|
}
|
||||||
|
|
||||||
SETTINGS_FetchChannelName(String, gSubMenuSelection);
|
SETTINGS_FetchChannelName(String, gSubMenuSelection);
|
||||||
UI_PrintString(String[0] ? String : "--", menu_item_x1, menu_item_x2, 2, 8);
|
UI_PrintString(String[0] ? String : "--", menu_item_x1, menu_item_x2, 2 /*, 8 */);
|
||||||
already_printed = true;
|
already_printed = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -794,7 +679,7 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
|||||||
const bool valid = RADIO_CheckValidChannel(gSubMenuSelection, false, 0);
|
const bool valid = RADIO_CheckValidChannel(gSubMenuSelection, false, 0);
|
||||||
|
|
||||||
UI_GenerateChannelStringEx(String, valid, gSubMenuSelection);
|
UI_GenerateChannelStringEx(String, valid, gSubMenuSelection);
|
||||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 0, 8);
|
UI_PrintString(String, menu_item_x1, menu_item_x2, 0 /*, 8 */);
|
||||||
|
|
||||||
if (valid) {
|
if (valid) {
|
||||||
const uint32_t frequency = SETTINGS_FetchChannelFrequency(gSubMenuSelection);
|
const uint32_t frequency = SETTINGS_FetchChannelFrequency(gSubMenuSelection);
|
||||||
@@ -805,18 +690,18 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
|||||||
if (edit_index < 0) { // show the channel name
|
if (edit_index < 0) { // show the channel name
|
||||||
SETTINGS_FetchChannelName(String, gSubMenuSelection);
|
SETTINGS_FetchChannelName(String, gSubMenuSelection);
|
||||||
char *pPrintStr = String[0] ? String : "--";
|
char *pPrintStr = String[0] ? String : "--";
|
||||||
UI_PrintString(pPrintStr, menu_item_x1, menu_item_x2, 2, 8);
|
UI_PrintString(pPrintStr, menu_item_x1, menu_item_x2, 2 /*, 8 */);
|
||||||
} else { // show the channel name being edited
|
} else { // show the channel name being edited
|
||||||
//UI_PrintString(edit, menu_item_x1, 0, 2, 8);
|
//UI_PrintString(edit, menu_item_x1, 0, 2 /*, 8 */);
|
||||||
UI_PrintString(edit, menu_item_x1, menu_item_x2, 2, 8);
|
UI_PrintString(edit, menu_item_x1, menu_item_x2, 2 /*, 8 */);
|
||||||
if (edit_index < 10)
|
if (edit_index < 10)
|
||||||
//UI_PrintString("^", menu_item_x1 + (8 * edit_index), 0, 4, 8); // show the cursor
|
//UI_PrintString("^", menu_item_x1 + (8 * edit_index), 0, 4 /*, 8 */); // show the cursor
|
||||||
UI_PrintString("^", menu_item_x1 - 1 + (8 * edit_index), 0, 4, 8); // show the cursor
|
UI_PrintString("^", menu_item_x1 - 1 + (8 * edit_index), 0, 4 /*, 8 */); // show the cursor
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gAskForConfirmation) { // show the frequency so that the user knows the channels frequency
|
if (!gAskForConfirmation) { // show the frequency so that the user knows the channels frequency
|
||||||
sprintf(String, "%u.%05u", frequency / 100000, frequency % 100000);
|
sprintf(String, "%lu.%05lu", frequency / 100000, frequency % 100000);
|
||||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 4 + (gIsInSubMenu && edit_index >= 0), 8);
|
UI_PrintString(String, menu_item_x1, menu_item_x2, 4 + (gIsInSubMenu && edit_index >= 0) /*, 8 */);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -825,23 +710,13 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
|||||||
}
|
}
|
||||||
|
|
||||||
case MENU_SAVE:
|
case MENU_SAVE:
|
||||||
sprintf(String, gSubMenuSelection == 0 ? gSubMenu_OFF_ON[0] : "1:%u", gSubMenuSelection);
|
sprintf(String, gSubMenuSelection == 0 ? gSubMenu_OFF_ON[0] : "1:%ld", gSubMenuSelection);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_TDR:
|
case MENU_TDR:
|
||||||
strcpy(String, gSubMenu_RXMode[gSubMenuSelection]);
|
strcpy(String, gSubMenu_RXMode[gSubMenuSelection]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_TOT:
|
|
||||||
sprintf(String, "%02dm:%02ds", (((gSubMenuSelection + 1) * 5) / 60), (((gSubMenuSelection + 1) * 5) % 60));
|
|
||||||
#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
|
|
||||||
//ST7565_Gauge(4, 5, 179, gSubMenuSelection);
|
|
||||||
gaugeLine = 4;
|
|
||||||
gaugeMin = 5;
|
|
||||||
gaugeMax = 179;
|
|
||||||
#endif
|
|
||||||
break;
|
|
||||||
|
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
case MENU_VOICE:
|
case MENU_VOICE:
|
||||||
strcpy(String, gSubMenu_VOICE[gSubMenuSelection]);
|
strcpy(String, gSubMenu_VOICE[gSubMenuSelection]);
|
||||||
@@ -852,22 +727,16 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
|||||||
if (gSubMenuSelection == 0) {
|
if (gSubMenuSelection == 0) {
|
||||||
strcpy(String, "STOP");
|
strcpy(String, "STOP");
|
||||||
} else if (gSubMenuSelection < 81) {
|
} else if (gSubMenuSelection < 81) {
|
||||||
sprintf(String, "CARRIER\n%02ds:%03dms", ((gSubMenuSelection * 250) / 1000),
|
sprintf(String, "CARRIER\n%02lds:%03ldms", ((gSubMenuSelection * 250) / 1000),
|
||||||
((gSubMenuSelection * 250) % 1000));
|
((gSubMenuSelection * 250) % 1000));
|
||||||
#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
|
#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
|
||||||
//ST7565_Gauge(5, 1, 80, gSubMenuSelection);
|
//ST7565_Gauge(5, 1, 80, gSubMenuSelection);
|
||||||
gaugeLine = 5;
|
|
||||||
gaugeMin = 1;
|
|
||||||
gaugeMax = 80;
|
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
sprintf(String, "TIMEOUT\n%02dm:%02ds", (((gSubMenuSelection - 80) * 5) / 60),
|
sprintf(String, "TIMEOUT\n%02ldm:%02lds", (((gSubMenuSelection - 80) * 5) / 60),
|
||||||
(((gSubMenuSelection - 80) * 5) % 60));
|
(((gSubMenuSelection - 80) * 5) % 60));
|
||||||
#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
|
#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
|
||||||
//ST7565_Gauge(5, 80, 104, gSubMenuSelection);
|
//ST7565_Gauge(5, 80, 104, gSubMenuSelection);
|
||||||
gaugeLine = 5;
|
|
||||||
gaugeMin = 80;
|
|
||||||
gaugeMax = 104;
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -877,14 +746,14 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_RP_STE:
|
case MENU_RP_STE:
|
||||||
sprintf(String, gSubMenuSelection == 0 ? gSubMenu_OFF_ON[0] : "%u*100ms", gSubMenuSelection);
|
sprintf(String, gSubMenuSelection == 0 ? gSubMenu_OFF_ON[0] : "%lu*100ms", gSubMenuSelection);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_S_LIST:
|
case MENU_S_LIST:
|
||||||
if (gSubMenuSelection == 0)
|
if (gSubMenuSelection == 0)
|
||||||
strcpy(String, "LIST [0]\nNO LIST");
|
strcpy(String, "LIST [0]\nNO LIST");
|
||||||
else if (gSubMenuSelection < 4)
|
else if (gSubMenuSelection < 4)
|
||||||
sprintf(String, "LIST [%u]", gSubMenuSelection);
|
sprintf(String, "LIST [%lu]", gSubMenuSelection);
|
||||||
else if (gSubMenuSelection == 4)
|
else if (gSubMenuSelection == 4)
|
||||||
strcpy(String, "LISTS\n[1, 2, 3]");
|
strcpy(String, "LISTS\n[1, 2, 3]");
|
||||||
else if (gSubMenuSelection == 5)
|
else if (gSubMenuSelection == 5)
|
||||||
@@ -897,11 +766,6 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
|||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
case MENU_ANI_ID:
|
|
||||||
strcpy(String, gEeprom.ANI_DTMF_ID);
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
case MENU_UPCODE:
|
case MENU_UPCODE:
|
||||||
sprintf(String, "%.8s\n%.8s", gEeprom.DTMF_UP_CODE, gEeprom.DTMF_UP_CODE + 8);
|
sprintf(String, "%.8s\n%.8s", gEeprom.DTMF_UP_CODE, gEeprom.DTMF_UP_CODE + 8);
|
||||||
break;
|
break;
|
||||||
@@ -910,17 +774,8 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
|||||||
sprintf(String, "%.8s\n%.8s", gEeprom.DTMF_DOWN_CODE, gEeprom.DTMF_DOWN_CODE + 8);
|
sprintf(String, "%.8s\n%.8s", gEeprom.DTMF_DOWN_CODE, gEeprom.DTMF_DOWN_CODE + 8);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
case MENU_D_RSP:
|
|
||||||
strcpy(String, gSubMenu_D_RSP[gSubMenuSelection]);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case MENU_D_HOLD:
|
|
||||||
sprintf(String, "%ds", gSubMenuSelection);
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
case MENU_D_PRE:
|
case MENU_D_PRE:
|
||||||
sprintf(String, "%d*10ms", gSubMenuSelection);
|
sprintf(String, "%ld*10ms", gSubMenuSelection);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_PTT_ID:
|
case MENU_PTT_ID:
|
||||||
@@ -931,15 +786,6 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
|||||||
strcpy(String, gSubMenu_BAT_TXT[gSubMenuSelection]);
|
strcpy(String, gSubMenu_BAT_TXT[gSubMenuSelection]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
case MENU_D_LIST:
|
|
||||||
gIsDtmfContactValid = DTMF_GetContact((int)gSubMenuSelection - 1, Contact);
|
|
||||||
if (!gIsDtmfContactValid)
|
|
||||||
strcpy(String, "NULL");
|
|
||||||
else
|
|
||||||
memcpy(String, Contact, 8);
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
case MENU_FSKMOD:
|
case MENU_FSKMOD:
|
||||||
strcpy(String, gSubMenu_FSKMod[gSubMenuSelection]);
|
strcpy(String, gSubMenu_FSKMod[gSubMenuSelection]);
|
||||||
@@ -958,22 +804,22 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef ENABLE_F_CAL_MENU
|
#ifdef ENABLE_F_CAL_MENU
|
||||||
case MENU_F_CALI: {
|
case MENU_F_CALI: {
|
||||||
const uint32_t value = 22656 + gSubMenuSelection;
|
const uint32_t value = 22656 + gSubMenuSelection;
|
||||||
const uint32_t xtal_Hz = (0x4f0000u + value) * 5;
|
const uint32_t xtal_Hz = (0x4f0000u + value) * 5;
|
||||||
|
|
||||||
writeXtalFreqCal(gSubMenuSelection, false);
|
writeXtalFreqCal(gSubMenuSelection, false);
|
||||||
|
|
||||||
sprintf(String, "%d\n%u.%06u\nMHz",
|
sprintf(String, "%ld\n%lu.%06lu\nMHz",
|
||||||
gSubMenuSelection,
|
gSubMenuSelection,
|
||||||
xtal_Hz / 1000000, xtal_Hz % 1000000);
|
xtal_Hz / 1000000, xtal_Hz % 1000000);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
case MENU_BATCAL: {
|
case MENU_BATCAL: {
|
||||||
const uint16_t vol = (uint32_t) gBatteryVoltageAverage * gBatteryCalibration[3] / gSubMenuSelection;
|
const uint16_t vol = (uint32_t) gBatteryVoltageAverage * gBatteryCalibration[3] / gSubMenuSelection;
|
||||||
sprintf(String, "%u.%02uV\n%u", vol / 100, vol % 100, gSubMenuSelection);
|
sprintf(String, "%u.%02dV\n%lu", vol / 100, vol % 100, gSubMenuSelection);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -994,41 +840,16 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
|||||||
if (gSubMenuSelection == 0) {
|
if (gSubMenuSelection == 0) {
|
||||||
strcpy(String, gSubMenu_OFF_ON[0]);
|
strcpy(String, gSubMenu_OFF_ON[0]);
|
||||||
} else if (gSubMenuSelection < 121) {
|
} else if (gSubMenuSelection < 121) {
|
||||||
sprintf(String, "%dh:%02dm", (gSubMenuSelection / 60), (gSubMenuSelection % 60));
|
sprintf(String, "%ldh:%02ldm", (gSubMenuSelection / 60), (gSubMenuSelection % 60));
|
||||||
#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
|
|
||||||
//ST7565_Gauge(4, 1, 120, gSubMenuSelection);
|
|
||||||
gaugeLine = 4;
|
|
||||||
gaugeMin = 1;
|
|
||||||
gaugeMax = 120;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN
|
#ifdef ENABLE_FEAT_F4HWN
|
||||||
case MENU_SET_PWR:
|
|
||||||
sprintf(String, "%s\n%sW", gSubMenu_TXP[gSubMenuSelection + 1], gSubMenu_SET_PWR[gSubMenuSelection]);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case MENU_SET_PTT:
|
case MENU_SET_PTT:
|
||||||
strcpy(String, gSubMenu_SET_PTT[gSubMenuSelection]);
|
strcpy(String, gSubMenu_SET_PTT[gSubMenuSelection]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_SET_TOT:
|
|
||||||
case MENU_SET_EOT:
|
|
||||||
strcpy(String, gSubMenu_SET_TOT[gSubMenuSelection]); // Same as SET_TOT
|
|
||||||
break;
|
|
||||||
|
|
||||||
case MENU_SET_CTR:
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_CTR
|
|
||||||
sprintf(String, "%d", gSubMenuSelection);
|
|
||||||
gSetting_set_ctr = gSubMenuSelection;
|
|
||||||
ST7565_ContrastAndInv();
|
|
||||||
#else
|
|
||||||
strcpy(String, gSubMenu_NA);
|
|
||||||
#endif
|
|
||||||
break;
|
|
||||||
|
|
||||||
case MENU_SET_INV:
|
case MENU_SET_INV:
|
||||||
#ifdef ENABLE_FEAT_F4HWN_INV
|
#ifdef ENABLE_FEAT_F4HWN_INV
|
||||||
strcpy(String, gSubMenu_OFF_ON[gSubMenuSelection]);
|
strcpy(String, gSubMenu_OFF_ON[gSubMenuSelection]);
|
||||||
@@ -1038,65 +859,32 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
|||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_TX_LOCK:
|
|
||||||
if (TX_freq_check(gEeprom.VfoInfo[gEeprom.TX_VFO].pRX->Frequency) == 0) {
|
|
||||||
strcpy(String, "Inside\nF Lock\nPlan");
|
|
||||||
} else {
|
|
||||||
strcpy(String, gSubMenu_OFF_ON[gSubMenuSelection]);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case MENU_SET_LCK:
|
|
||||||
strcpy(String, gSubMenu_SET_LCK[gSubMenuSelection]);
|
|
||||||
break;
|
|
||||||
|
|
||||||
//case MENU_SET_MET:
|
|
||||||
//case MENU_SET_GUI:
|
|
||||||
strcpy(String, gSubMenu_SET_MET[gSubMenuSelection]); // Same as SET_MET
|
|
||||||
break;
|
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_NARROWER
|
|
||||||
case MENU_SET_NFM:
|
|
||||||
strcpy(String, gSubMenu_SET_NFM[gSubMenuSelection]);
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_VOL
|
#ifdef ENABLE_FEAT_F4HWN_VOL
|
||||||
case MENU_SET_VOL:
|
case MENU_SET_VOL:
|
||||||
if (gSubMenuSelection == 0) {
|
if (gSubMenuSelection == 0) {
|
||||||
strcpy(String, gSubMenu_OFF_ON[0]);
|
strcpy(String, gSubMenu_OFF_ON[0]);
|
||||||
} else if (gSubMenuSelection < 64) {
|
} else if (gSubMenuSelection < 64) {
|
||||||
sprintf(String, "%02u", gSubMenuSelection);
|
sprintf(String, "%02lu", gSubMenuSelection);
|
||||||
#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
|
#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
|
||||||
//ST7565_Gauge(4, 1, 63, gSubMenuSelection);
|
|
||||||
gaugeLine = 4;
|
|
||||||
gaugeMin = 1;
|
|
||||||
gaugeMax = 63;
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
gEeprom.VOLUME_GAIN = gSubMenuSelection;
|
gEeprom.VOLUME_GAIN = gSubMenuSelection;
|
||||||
BK4819_WriteRegister(BK4819_REG_48,
|
BK4819_WriteRegister(BK4819_REG_48,
|
||||||
(11u << 12) | // ??? .. 0 ~ 15, doesn't seem to make any difference
|
(11u << 12) | // ??? .. 0 ~ 15, doesn't seem to make any difference
|
||||||
(0u << 10) | // AF Rx Gain-1
|
(0u << 10) | // AF Rx Gain-1
|
||||||
(gEeprom.VOLUME_GAIN << 4) | // AF Rx Gain-2
|
(gEeprom.VOLUME_GAIN << 4) | // AF Rx Gain-2
|
||||||
(gEeprom.DAC_GAIN << 0)); // AF DAC Gain (after Gain-1 and Gain-2)
|
(gEeprom.DAC_GAIN << 0)); // AF DAC Gain (after Gain-1 and Gain-2)
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
|
||||||
case MENU_SET_KEY:
|
|
||||||
strcpy(String, gSubMenu_SET_KEY[gSubMenuSelection]);
|
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
|
//#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
|
||||||
if (gaugeLine != 0) {
|
// if (gaugeLine != 0) {
|
||||||
ST7565_Gauge(gaugeLine, gaugeMin, gaugeMax, gSubMenuSelection);
|
// ST7565_Gauge(gaugeLine, gaugeMin, gaugeMax, gSubMenuSelection);
|
||||||
}
|
// }
|
||||||
#endif
|
//#endif
|
||||||
|
|
||||||
if (!already_printed) { // we now do multi-line text in a single string
|
if (!already_printed) { // we now do multi-line text in a single string
|
||||||
|
|
||||||
@@ -1135,7 +923,7 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
|||||||
if (small)
|
if (small)
|
||||||
UI_PrintStringSmallNormal(String + i, menu_item_x1, menu_item_x2, y);
|
UI_PrintStringSmallNormal(String + i, menu_item_x1, menu_item_x2, y);
|
||||||
else
|
else
|
||||||
UI_PrintString(String + i, menu_item_x1, menu_item_x2, y, 8);
|
UI_PrintString(String + i, menu_item_x1, menu_item_x2, y /*, 8 */);
|
||||||
|
|
||||||
// look for start of next line
|
// look for start of next line
|
||||||
while (i < len && String[i] >= 32)
|
while (i < len && String[i] >= 32)
|
||||||
@@ -1164,25 +952,25 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
|||||||
}
|
}
|
||||||
|
|
||||||
// channel number
|
// channel number
|
||||||
UI_PrintString(pPrintStr, menu_item_x1, menu_item_x2, 0, 8);
|
UI_PrintString(pPrintStr, menu_item_x1, menu_item_x2, 0 /*, 8 */);
|
||||||
|
|
||||||
SETTINGS_FetchChannelName(String, gSubMenuSelection);
|
SETTINGS_FetchChannelName(String, gSubMenuSelection);
|
||||||
pPrintStr = String[0] ? String : "--";
|
pPrintStr = String[0] ? String : "--";
|
||||||
|
|
||||||
// channel name and scan-list
|
// channel name and scan-list
|
||||||
if (gSubMenuSelection < 0 || !gEeprom.SCAN_LIST_ENABLED[i]) {
|
if (gSubMenuSelection < 0 || !gEeprom.SCAN_LIST_ENABLED[i]) {
|
||||||
UI_PrintString(pPrintStr, menu_item_x1, menu_item_x2, 2, 8);
|
UI_PrintString(pPrintStr, menu_item_x1, menu_item_x2, 2 /*, 8 */);
|
||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
UI_PrintStringSmallNormal(pPrintStr, menu_item_x1, menu_item_x2, 2);
|
UI_PrintStringSmallNormal(pPrintStr, menu_item_x1, menu_item_x2, 2);
|
||||||
|
|
||||||
if (IS_MR_CHANNEL(gEeprom.SCANLIST_PRIORITY_CH1[i])) {
|
if (IS_MR_CHANNEL(gEeprom.SCANLIST_PRIORITY_CH1[i])) {
|
||||||
sprintf(String, "PRI%d:%u", 1, gEeprom.SCANLIST_PRIORITY_CH1[i] + 1);
|
sprintf(String, "PRI%ld:%u", 1, gEeprom.SCANLIST_PRIORITY_CH1[i] + 1);
|
||||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 3, 8);
|
UI_PrintString(String, menu_item_x1, menu_item_x2, 3 , 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IS_MR_CHANNEL(gEeprom.SCANLIST_PRIORITY_CH2[i])) {
|
if (IS_MR_CHANNEL(gEeprom.SCANLIST_PRIORITY_CH2[i])) {
|
||||||
sprintf(String, "PRI%d:%u", 2, gEeprom.SCANLIST_PRIORITY_CH2[i] + 1);
|
sprintf(String, "PRI%ld:%u", 2, gEeprom.SCANLIST_PRIORITY_CH2[i] + 1);
|
||||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 5, 8);
|
UI_PrintString(String, menu_item_x1, menu_item_x2, 5, 8);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
@@ -1194,7 +982,7 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
|||||||
|
|
||||||
if (IS_MR_CHANNEL(channel)) {
|
if (IS_MR_CHANNEL(channel)) {
|
||||||
sprintf(String, "PRI%d:%u", pri, channel + 1);
|
sprintf(String, "PRI%d:%u", pri, channel + 1);
|
||||||
UI_PrintString(String, menu_item_x1, menu_item_x2, pri * 2 + 1, 8);
|
UI_PrintString(String, menu_item_x1, menu_item_x2, pri * 2 + 1 /*, 8 */);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1202,26 +990,15 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((UI_MENU_GetCurrentMenuId() == MENU_R_CTCS || UI_MENU_GetCurrentMenuId() == MENU_R_DCS) && gCssBackgroundScan)
|
if ((UI_MENU_GetCurrentMenuId() == MENU_R_CTCS || UI_MENU_GetCurrentMenuId() == MENU_R_DCS) && gCssBackgroundScan)
|
||||||
UI_PrintString("SCAN", menu_item_x1, menu_item_x2, 4, 8);
|
UI_PrintString("SCAN", menu_item_x1, menu_item_x2, 4 /*, 8 */);
|
||||||
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
if (UI_MENU_GetCurrentMenuId() == MENU_D_LIST && gIsDtmfContactValid) {
|
|
||||||
Contact[11] = 0;
|
|
||||||
memcpy(&gDTMF_ID, Contact + 8, 4);
|
|
||||||
sprintf(String, "ID:%4s", gDTMF_ID);
|
|
||||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 4, 8);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (UI_MENU_GetCurrentMenuId() == MENU_R_CTCS ||
|
if (UI_MENU_GetCurrentMenuId() == MENU_R_CTCS ||
|
||||||
UI_MENU_GetCurrentMenuId() == MENU_T_CTCS ||
|
UI_MENU_GetCurrentMenuId() == MENU_T_CTCS ||
|
||||||
UI_MENU_GetCurrentMenuId() == MENU_R_DCS ||
|
UI_MENU_GetCurrentMenuId() == MENU_R_DCS ||
|
||||||
UI_MENU_GetCurrentMenuId() == MENU_T_DCS
|
UI_MENU_GetCurrentMenuId() == MENU_T_DCS
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
|| UI_MENU_GetCurrentMenuId() == MENU_D_LIST
|
|
||||||
#endif
|
|
||||||
) {
|
) {
|
||||||
sprintf(String, "%2d", gSubMenuSelection);
|
sprintf(String, "%2ld", gSubMenuSelection);
|
||||||
UI_PrintStringSmallNormal(String, 105, 0, 0);
|
UI_PrintStringSmallNormal(String, 105, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1230,7 +1007,7 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
|||||||
UI_MENU_GetCurrentMenuId() == MENU_MEM_NAME ||
|
UI_MENU_GetCurrentMenuId() == MENU_MEM_NAME ||
|
||||||
UI_MENU_GetCurrentMenuId() == MENU_DEL_CH) && gAskForConfirmation) { // display confirmation
|
UI_MENU_GetCurrentMenuId() == MENU_DEL_CH) && gAskForConfirmation) { // display confirmation
|
||||||
char *pPrintStr = (gAskForConfirmation == 1) ? "SURE?" : "WAIT!";
|
char *pPrintStr = (gAskForConfirmation == 1) ? "SURE?" : "WAIT!";
|
||||||
UI_PrintString(pPrintStr, menu_item_x1, menu_item_x2, 5, 8);
|
UI_PrintString(pPrintStr, menu_item_x1, menu_item_x2, 5 /*, 8 */);
|
||||||
}
|
}
|
||||||
|
|
||||||
ST7565_BlitFullScreen();
|
ST7565_BlitFullScreen();
|
||||||
|
|||||||
@@ -42,9 +42,6 @@ enum {
|
|||||||
MENU_W_N,
|
MENU_W_N,
|
||||||
MENU_SCR,
|
MENU_SCR,
|
||||||
MENU_BCL,
|
MENU_BCL,
|
||||||
#ifdef ENABLE_FEAT_F4HWN
|
|
||||||
MENU_TX_LOCK,
|
|
||||||
#endif
|
|
||||||
MENU_MEM_CH,
|
MENU_MEM_CH,
|
||||||
MENU_DEL_CH,
|
MENU_DEL_CH,
|
||||||
MENU_MEM_NAME,
|
MENU_MEM_NAME,
|
||||||
@@ -77,26 +74,16 @@ enum {
|
|||||||
MENU_SLIST3,
|
MENU_SLIST3,
|
||||||
#ifdef ENABLE_ALARM
|
#ifdef ENABLE_ALARM
|
||||||
MENU_AL_MOD,
|
MENU_AL_MOD,
|
||||||
#endif
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
MENU_ANI_ID,
|
|
||||||
#endif
|
#endif
|
||||||
MENU_UPCODE,
|
MENU_UPCODE,
|
||||||
MENU_DWCODE,
|
MENU_DWCODE,
|
||||||
MENU_PTT_ID,
|
MENU_PTT_ID,
|
||||||
MENU_D_ST,
|
MENU_D_ST,
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
MENU_D_RSP,
|
|
||||||
MENU_D_HOLD,
|
|
||||||
#endif
|
|
||||||
MENU_D_PRE,
|
MENU_D_PRE,
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
MENU_D_DCD,
|
|
||||||
MENU_D_LIST,
|
|
||||||
#endif
|
|
||||||
MENU_D_LIVE_DEC,
|
MENU_D_LIVE_DEC,
|
||||||
MENU_FSKSRC,
|
MENU_FSKSRC,
|
||||||
MENU_FSKMOD,
|
MENU_FSKMOD,
|
||||||
|
MENU_PMON,
|
||||||
MENU_ROGER,
|
MENU_ROGER,
|
||||||
MENU_BAT_TXT,
|
MENU_BAT_TXT,
|
||||||
MENU_AM,
|
MENU_AM,
|
||||||
@@ -110,13 +97,6 @@ enum {
|
|||||||
#endif
|
#endif
|
||||||
MENU_RESET,
|
MENU_RESET,
|
||||||
MENU_F_LOCK,
|
MENU_F_LOCK,
|
||||||
#ifndef ENABLE_FEAT_F4HWN
|
|
||||||
MENU_200TX,
|
|
||||||
MENU_350TX,
|
|
||||||
MENU_500TX,
|
|
||||||
MENU_SCREN,
|
|
||||||
#endif
|
|
||||||
MENU_350EN,
|
|
||||||
#ifdef ENABLE_F_CAL_MENU
|
#ifdef ENABLE_F_CAL_MENU
|
||||||
MENU_F_CALI, // reference xtal calibration
|
MENU_F_CALI, // reference xtal calibration
|
||||||
#endif
|
#endif
|
||||||
@@ -124,25 +104,12 @@ enum {
|
|||||||
MENU_SET_OFF,
|
MENU_SET_OFF,
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_FEAT_F4HWN
|
#ifdef ENABLE_FEAT_F4HWN
|
||||||
MENU_SET_PWR,
|
|
||||||
MENU_SET_PTT,
|
MENU_SET_PTT,
|
||||||
MENU_SET_TOT,
|
|
||||||
MENU_SET_EOT,
|
|
||||||
MENU_SET_CTR,
|
|
||||||
MENU_SET_INV,
|
MENU_SET_INV,
|
||||||
MENU_SET_LCK,
|
|
||||||
MENU_SET_MET,
|
|
||||||
MENU_SET_GUI,
|
|
||||||
MENU_SET_TMR,
|
MENU_SET_TMR,
|
||||||
#ifdef ENABLE_FEAT_F4HWN_NARROWER
|
|
||||||
MENU_SET_NFM,
|
|
||||||
#endif
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_VOL
|
#ifdef ENABLE_FEAT_F4HWN_VOL
|
||||||
MENU_SET_VOL,
|
MENU_SET_VOL,
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
|
||||||
MENU_SET_KEY,
|
|
||||||
#endif
|
|
||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_NOAA
|
||||||
MENU_NOAA_S,
|
MENU_NOAA_S,
|
||||||
#endif
|
#endif
|
||||||
@@ -156,15 +123,13 @@ enum {
|
|||||||
MENU_BATTYP
|
MENU_BATTYP
|
||||||
};
|
};
|
||||||
|
|
||||||
extern const uint8_t FIRST_HIDDEN_MENU_ITEM;
|
|
||||||
extern const t_menu_item MenuList[];
|
extern const t_menu_item MenuList[];
|
||||||
|
|
||||||
extern const char gSubMenu_TXP[8][6];
|
extern const char gSubMenu_TXP[7][5];
|
||||||
extern const char gSubMenu_SFT_D[3][4];
|
extern const char gSubMenu_SFT_D[3][4];
|
||||||
extern const char gSubMenu_W_N[2][7];
|
extern const char gSubMenu_W_N[4][5];
|
||||||
extern const char gSubMenu_OFF_ON[2][4];
|
extern const char gSubMenu_OFF_ON[2][4];
|
||||||
extern const char gSubMenu_NA[4];
|
extern const char gSubMenu_NA[4];
|
||||||
extern const char gSubMenu_TOT[11][7];
|
|
||||||
extern const char *const gSubMenu_RXMode[4];
|
extern const char *const gSubMenu_RXMode[4];
|
||||||
|
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
@@ -174,34 +139,23 @@ extern const char *const gSubMenu_MDF[4];
|
|||||||
#ifdef ENABLE_ALARM
|
#ifdef ENABLE_ALARM
|
||||||
extern const char gSubMenu_AL_MOD[2][5];
|
extern const char gSubMenu_AL_MOD[2][5];
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
|
||||||
extern const char gSubMenu_D_RSP[4][11];
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN
|
#ifdef ENABLE_FEAT_F4HWN
|
||||||
extern const char gSubMenu_SET_PWR[7][6];
|
extern const char gSubMenu_SET_PTT[2][4];
|
||||||
extern const char gSubMenu_SET_PTT[2][8];
|
|
||||||
extern const char gSubMenu_SET_TOT[4][7];
|
|
||||||
extern const char gSubMenu_SET_LCK[2][9];
|
|
||||||
extern const char gSubMenu_SET_MET[2][8];
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_NARROWER
|
|
||||||
extern const char gSubMenu_SET_NFM[2][9];
|
|
||||||
#endif
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
|
||||||
extern const char gSubMenu_SET_KEY[][9];
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern const char *const gSubMenu_PTT_ID[5];
|
extern const char *const gSubMenu_PTT_ID[5];
|
||||||
extern const char gSubMenu_FSKMod[6][8];
|
#ifdef ENABLE_POCSAG
|
||||||
|
extern const char gSubMenu_FSKMod[10][8];
|
||||||
|
#else
|
||||||
|
extern const char gSubMenu_FSKMod[7][8];
|
||||||
|
#endif
|
||||||
extern const char gSubMenu_ROGER[3][6];
|
extern const char gSubMenu_ROGER[3][6];
|
||||||
extern const char gSubMenu_RESET[2][4];
|
extern const char gSubMenu_RESET[2][4];
|
||||||
extern const char *const gSubMenu_F_LOCK[F_LOCK_LEN];
|
extern const char *const gSubMenu_F_LOCK[F_LOCK_LEN];
|
||||||
extern const char gSubMenu_RX_TX[4][6];
|
extern const char gSubMenu_RX_TX[4][6];
|
||||||
extern const char gSubMenu_BAT_TXT[3][8];
|
extern const char gSubMenu_BAT_TXT[3][5];
|
||||||
extern const char gSubMenu_BATTYP[3][9];
|
extern const char gSubMenu_BATTYP[3][3];
|
||||||
|
|
||||||
extern const char gSubMenu_SCRAMBLER[11][7];
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char *name;
|
char *name;
|
||||||
|
|||||||
@@ -0,0 +1,94 @@
|
|||||||
|
//
|
||||||
|
// Created by bruno on 3/30/25.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "messages.h"
|
||||||
|
#include "../external/printf/printf.h"
|
||||||
|
|
||||||
|
|
||||||
|
// Convert a 32-bit number to a string (10 digits, zero-padded)
|
||||||
|
void u32_to_str(uint32_t num, char *str) {
|
||||||
|
for (int i = 9; i >= 0; i--) {
|
||||||
|
str[i] = '0' + (num % 10);
|
||||||
|
num /= 10;
|
||||||
|
}
|
||||||
|
str[10] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert an 8-bit number to a 2-digit string (zero-padded)
|
||||||
|
void u8_to_str(uint8_t num, char *str) {
|
||||||
|
str[0] = '0' + (num / 100); // Hundreds place
|
||||||
|
str[1] = '0' + ((num / 10) % 10); // Tens place
|
||||||
|
str[2] = '0' + (num % 10); // Ones place
|
||||||
|
str[3] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Print text wrapped over `lines` display lines starting at `line`.
|
||||||
|
static void UI_PrintWrapped(const char *text, const uint8_t line, const uint8_t lines) {
|
||||||
|
char chunk[MESSAGES_LINE_CHARS + 1U];
|
||||||
|
const size_t length = strlen(text);
|
||||||
|
|
||||||
|
for (uint8_t l = 0; l < lines && l * MESSAGES_LINE_CHARS < length; l++) {
|
||||||
|
strncpy(chunk, text + l * MESSAGES_LINE_CHARS, MESSAGES_LINE_CHARS);
|
||||||
|
chunk[MESSAGES_LINE_CHARS] = '\0';
|
||||||
|
UI_PrintStringSmallNormal(chunk, 1, 0, line + l);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void UI_DisplayMessages(void) {
|
||||||
|
char String[24];
|
||||||
|
UI_DisplayClear();
|
||||||
|
if (gEnteringSMS != SMS_NOT_ENTERING) {
|
||||||
|
if (gEnteringSMS == SMS_ENTERING_DEST) {
|
||||||
|
UI_PrintString(MODEM_IS_POCSAG(gEeprom.FSKMode) ? "RIC" : "SMS dest", 0, 0, 0 /*, 8 */);
|
||||||
|
u32_to_str(dataPacket.dest, String);
|
||||||
|
UI_PrintStringSmallNormal(String, 0, 0, 2);
|
||||||
|
} else if (gEnteringSMS == SMS_ENTERING_MESSAGE) {
|
||||||
|
const size_t length = strlen(gMessageText);
|
||||||
|
UI_PrintString(MODEM_IS_POCSAG(gEeprom.FSKMode) ? "Page text" : "SMS data", 0, 0, 0 /*, 8 */);
|
||||||
|
UI_PrintWrapped(gMessageText, 1, MESSAGES_TEXT_LINES);
|
||||||
|
// cursor block after the last character
|
||||||
|
const uint8_t cursorLine = 1U + length / MESSAGES_LINE_CHARS;
|
||||||
|
if (length < MESSAGES_TEXT_LENGTH && cursorLine < 8U)
|
||||||
|
memset(gFrameBuffer[cursorLine] + 2 + (7 * (length % MESSAGES_LINE_CHARS)),
|
||||||
|
gKeyTimeout == 0 ? 0xFF : 0x80, 6);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
char text[MESSAGES_TEXT_LENGTH + 1U];
|
||||||
|
uint8_t Data[8];
|
||||||
|
EEPROM_ReadBuffer(SEQParameterEEPROM, Data, 8);
|
||||||
|
uint8_t msgIndex = Data[1]; // index of latest written message
|
||||||
|
|
||||||
|
// Determine oldest message index (next to be overwritten)
|
||||||
|
uint8_t startIndex = (msgIndex + 1) % MESSAGES_COUNT;
|
||||||
|
|
||||||
|
// Pages run from oldest to newest
|
||||||
|
uint8_t pageOffset = gActiveMessageBank * MESSAGES_PER_PAGE;
|
||||||
|
|
||||||
|
for (uint8_t ixa = 0; ixa < MESSAGES_PER_PAGE; ixa++) {
|
||||||
|
// If out of stored range, stop
|
||||||
|
if (pageOffset + ixa >= MESSAGES_COUNT)
|
||||||
|
break;
|
||||||
|
|
||||||
|
// Logical order from oldest to newest
|
||||||
|
gActiveMessage = (startIndex + pageOffset + ixa) % MESSAGES_COUNT;
|
||||||
|
MESSAGES_GET();
|
||||||
|
|
||||||
|
// header: sender (POCSAG: "P:" + RIC), sequence, position in the list, EEPROM slot
|
||||||
|
// header (max 18 chars): POCSAG "P:<RIC> #nn", SMS "<address> s<seq> #nn"
|
||||||
|
if (loadedPacket.flags & MESSAGE_FLAG_POCSAG)
|
||||||
|
sprintf(String, "P:%07lu #%02u", (unsigned long) loadedPacket.src, ixa + pageOffset + 1U);
|
||||||
|
else
|
||||||
|
sprintf(String, "%08lu s%03u #%02u", (unsigned long) (loadedPacket.src % 100000000UL),
|
||||||
|
loadedPacket.seq, ixa + pageOffset + 1U);
|
||||||
|
|
||||||
|
// header line, then the text wrapped over MESSAGES_TEXT_LINES lines
|
||||||
|
const uint8_t line = ixa * (1U + MESSAGES_TEXT_LINES);
|
||||||
|
UI_PrintString(String, 2, 0, line);
|
||||||
|
MESSAGES_GetText(text);
|
||||||
|
UI_PrintWrapped(text, line + 1U, MESSAGES_TEXT_LINES);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ST7565_BlitFullScreen();
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
//
|
||||||
|
// Created by bruno on 3/30/25.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef BRNQUANFW_MESSAGES_UI_H
|
||||||
|
#define BRNQUANFW_MESSAGES_UI_H
|
||||||
|
#include "stdio.h"
|
||||||
|
#include "helper.h"
|
||||||
|
#include "../driver/st7565.h"
|
||||||
|
#include "string.h"
|
||||||
|
#include "../app/messages.h"
|
||||||
|
#include "../app/fskmodem.h"
|
||||||
|
|
||||||
|
void UI_DisplayMessages(void);
|
||||||
|
void u8_to_str(uint8_t num, char *str);
|
||||||
|
void u32_to_str(uint32_t num, char *str);
|
||||||
|
|
||||||
|
#endif //BRNQUANFW_MESSAGES_UI_H
|
||||||
@@ -0,0 +1,73 @@
|
|||||||
|
//
|
||||||
|
// Created by bruno on 3/30/25.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "ooksender.h"
|
||||||
|
#include "../app/ooksender.h"
|
||||||
|
#include "../external/printf/printf.h"
|
||||||
|
#include "../misc.h"
|
||||||
|
#include "../radio.h"
|
||||||
|
|
||||||
|
static const char OOKPROTONAMES[OOKSENDER_PROTO_END][7] = {
|
||||||
|
"PT2262",
|
||||||
|
"EV1527",
|
||||||
|
"RC-SW",
|
||||||
|
"INTECH",
|
||||||
|
"MANCH",
|
||||||
|
};
|
||||||
|
|
||||||
|
static void OOK_FormatValue(const uint8_t field, char *out)
|
||||||
|
{
|
||||||
|
const uint32_t value = gOOKSenderValue[field];
|
||||||
|
|
||||||
|
if (gOOKSenderProtocol == OOKSENDER_PROTO_PT2262 && field == OOK_FIELD_CODE) {
|
||||||
|
const uint32_t trits = gOOKSenderValue[OOK_FIELD_ARG];
|
||||||
|
for (uint32_t i = 0; i < trits; i++) {
|
||||||
|
const uint32_t trit = (value >> (2U * (trits - 1U - i))) & 3U;
|
||||||
|
out[i] = trit == 2U ? 'F' : (char) ('0' + trit);
|
||||||
|
}
|
||||||
|
out[trits] = '\0';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
sprintf(out, "%lu", (unsigned long) value);
|
||||||
|
}
|
||||||
|
|
||||||
|
void OOKSENDER_Display(void) {
|
||||||
|
char String[22];
|
||||||
|
UI_DisplayClear();
|
||||||
|
switch (gOOKSenderState) {
|
||||||
|
case OOKSENDER_PROTO_CHOOSE:
|
||||||
|
UI_PrintStringSmallBold("OOK protocol", 0, 0, 0);
|
||||||
|
for (uint8_t i = 0; i < OOKSENDER_PROTO_END; i++) {
|
||||||
|
sprintf(String, "%c %s", gOOKSenderProtocol == i ? '>' : ' ', OOKPROTONAMES[i]);
|
||||||
|
UI_PrintStringSmallNormal(String, 0, 0, 1 + i);
|
||||||
|
}
|
||||||
|
UI_PrintStringSmallNormal("MENU = OK", 0, 0, 7);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case OOKSENDER_DATA_INPUT:
|
||||||
|
case OOKSENDER_SENDING: {
|
||||||
|
uint8_t line = 1;
|
||||||
|
sprintf(String, "%s %lu.%05lu", OOKPROTONAMES[gOOKSenderProtocol],
|
||||||
|
(unsigned long) (gCurrentVfo->pTX->Frequency / 100000U),
|
||||||
|
(unsigned long) (gCurrentVfo->pTX->Frequency % 100000U));
|
||||||
|
UI_PrintStringSmallBold(String, 0, 0, 0);
|
||||||
|
for (uint8_t f = 0; f < OOK_FIELD_COUNT; f++) {
|
||||||
|
const char *label = OOKSENDER_FieldLabel(gOOKSenderProtocol, f);
|
||||||
|
char value[14];
|
||||||
|
if (label == NULL)
|
||||||
|
continue;
|
||||||
|
OOK_FormatValue(f, value);
|
||||||
|
sprintf(String, "%c%-6s %s", gOOKSenderField == f ? '>' : ' ', label, value);
|
||||||
|
UI_PrintStringSmallNormal(String, 0, 0, line++);
|
||||||
|
}
|
||||||
|
UI_PrintStringSmallNormal(gOOKSenderState == OOKSENDER_SENDING ? "Sending" : "PTT send",
|
||||||
|
0, 0, 7);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
ST7565_BlitFullScreen();
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
//
|
||||||
|
// Created by bruno on 3/30/25.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef BRNQUANFW_OOKSENDER_UI_H
|
||||||
|
#define BRNQUANFW_OOKSENDER_UI_H
|
||||||
|
#include "stdio.h"
|
||||||
|
#include "helper.h"
|
||||||
|
#include "../driver/st7565.h"
|
||||||
|
#include "string.h"
|
||||||
|
|
||||||
|
void OOKSENDER_Display(void);
|
||||||
|
|
||||||
|
#endif //BRNQUANFW_OOKSENDER_UI_H
|
||||||
+8
-8
@@ -40,7 +40,7 @@ void UI_DisplayScanner(void)
|
|||||||
pPrintStr = "FREQ:**.*****";
|
pPrintStr = "FREQ:**.*****";
|
||||||
}
|
}
|
||||||
|
|
||||||
UI_PrintString(pPrintStr, 2, 0, 1, 8);
|
UI_PrintString(pPrintStr, 2, 0, 1 /*, 8 */);
|
||||||
|
|
||||||
if (gScanCssState < SCAN_CSS_STATE_FOUND || !gScanUseCssResult) {
|
if (gScanCssState < SCAN_CSS_STATE_FOUND || !gScanUseCssResult) {
|
||||||
pPrintStr = "CTC:******";
|
pPrintStr = "CTC:******";
|
||||||
@@ -52,10 +52,10 @@ void UI_DisplayScanner(void)
|
|||||||
pPrintStr = String;
|
pPrintStr = String;
|
||||||
}
|
}
|
||||||
|
|
||||||
UI_PrintString(pPrintStr, 2, 0, 3, 8);
|
UI_PrintString(pPrintStr, 2, 0, 3 /*, 8 */);
|
||||||
memset(String, 0, sizeof(String));
|
memset(String, 0, sizeof(String));
|
||||||
if (gScannerSaveState == SCAN_SAVE_CHANNEL) {
|
if (gScannerSaveState == SCAN_SAVE_CHANNEL) {
|
||||||
pPrintStr = "SAVE?";
|
pPrintStr = "SAV?";
|
||||||
Start = 0;
|
Start = 0;
|
||||||
bCentered = 1;
|
bCentered = 1;
|
||||||
} else {
|
} else {
|
||||||
@@ -63,21 +63,21 @@ void UI_DisplayScanner(void)
|
|||||||
bCentered = 0;
|
bCentered = 0;
|
||||||
|
|
||||||
if (gScannerSaveState == SCAN_SAVE_CHAN_SEL) {
|
if (gScannerSaveState == SCAN_SAVE_CHAN_SEL) {
|
||||||
strcpy(String, "SAVE:");
|
strcpy(String, "SAV:");
|
||||||
UI_GenerateChannelStringEx(String + 5, gShowChPrefix, gScanChannel);
|
UI_GenerateChannelStringEx(String + 5, gShowChPrefix, gScanChannel);
|
||||||
pPrintStr = String;
|
pPrintStr = String;
|
||||||
} else if (gScanCssState < SCAN_CSS_STATE_FOUND) {
|
} else if (gScanCssState < SCAN_CSS_STATE_FOUND) {
|
||||||
strcpy(String, "SCAN");
|
strcpy(String, "SCN");
|
||||||
memset(String + 4, '.', (gScanProgressIndicator & 7) + 1);
|
memset(String + 4, '.', (gScanProgressIndicator & 7) + 1);
|
||||||
pPrintStr = String;
|
pPrintStr = String;
|
||||||
} else if (gScanCssState == SCAN_CSS_STATE_FOUND) {
|
} else if (gScanCssState == SCAN_CSS_STATE_FOUND) {
|
||||||
pPrintStr = "SCAN CMP.";
|
pPrintStr = "SCN CMP.";
|
||||||
} else {
|
} else {
|
||||||
pPrintStr = "SCAN FAIL.";
|
pPrintStr = "SCN FAIL.";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
UI_PrintString(pPrintStr, Start, bCentered ? 127 : 0, 5, 8);
|
UI_PrintString(pPrintStr, Start, bCentered ? 127 : 0, 5 /*, 8 */);
|
||||||
|
|
||||||
ST7565_BlitFullScreen();
|
ST7565_BlitFullScreen();
|
||||||
}
|
}
|
||||||
+15
-7
@@ -54,6 +54,17 @@ static void convertTime(uint8_t *line, uint8_t type)
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
//static const char* const FunctionStrings[] = {
|
||||||
|
// [FUNCTION_FOREGROUND] = "FG",
|
||||||
|
// [FUNCTION_TRANSMIT] = "TX",
|
||||||
|
// [FUNCTION_MONITOR] = "MON",
|
||||||
|
// [FUNCTION_INCOMING] = "INC",
|
||||||
|
// [FUNCTION_RECEIVE] = "RX",
|
||||||
|
// [FUNCTION_POWER_SAVE] = "PWS",
|
||||||
|
// [FUNCTION_BAND_SCOPE] = "BS",
|
||||||
|
// [FUNCTION_N_ELEM] = "NE"
|
||||||
|
//};
|
||||||
|
|
||||||
void UI_DisplayStatus()
|
void UI_DisplayStatus()
|
||||||
{
|
{
|
||||||
char str[8] = "";
|
char str[8] = "";
|
||||||
@@ -227,10 +238,6 @@ void UI_DisplayStatus()
|
|||||||
size = sizeof(gFontMute);
|
size = sizeof(gFontMute);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
else if (gBackLight) {
|
|
||||||
src = gFontLight;
|
|
||||||
size = sizeof(gFontLight);
|
|
||||||
}
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_CHARGING_C
|
#ifdef ENABLE_FEAT_F4HWN_CHARGING_C
|
||||||
else if (gChargingWithTypeC) {
|
else if (gChargingWithTypeC) {
|
||||||
src = BITMAP_USB_C;
|
src = BITMAP_USB_C;
|
||||||
@@ -239,9 +246,7 @@ void UI_DisplayStatus()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Perform the memcpy if a source was selected
|
// Perform the memcpy if a source was selected
|
||||||
if (src) {
|
memcpy(line + x + 1, src, size);
|
||||||
memcpy(line + x + 1, src, size);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Battery
|
// Battery
|
||||||
unsigned int x2 = LCD_WIDTH - sizeof(BITMAP_BatteryLevel1) - 0;
|
unsigned int x2 = LCD_WIDTH - sizeof(BITMAP_BatteryLevel1) - 0;
|
||||||
@@ -282,5 +287,8 @@ void UI_DisplayStatus()
|
|||||||
|
|
||||||
// **************
|
// **************
|
||||||
|
|
||||||
|
// x2 -= (7 * strlen(str));
|
||||||
|
// UI_PrintStringSmallBufferNormal(FunctionStrings[gCurrentFunction], line + x2 - 20);
|
||||||
|
|
||||||
ST7565_BlitStatusLine();
|
ST7565_BlitStatusLine();
|
||||||
}
|
}
|
||||||
@@ -39,6 +39,10 @@
|
|||||||
#include "ui/scanner.h"
|
#include "ui/scanner.h"
|
||||||
#include "ui/ui.h"
|
#include "ui/ui.h"
|
||||||
#include "../misc.h"
|
#include "../misc.h"
|
||||||
|
#include "messages.h"
|
||||||
|
#ifdef ENABLE_OOK_SENDER
|
||||||
|
#include "ooksender.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
GUI_DisplayType_t gScreenToDisplay;
|
GUI_DisplayType_t gScreenToDisplay;
|
||||||
GUI_DisplayType_t gRequestDisplayScreen = DISPLAY_INVALID;
|
GUI_DisplayType_t gRequestDisplayScreen = DISPLAY_INVALID;
|
||||||
@@ -52,6 +56,10 @@ void (*UI_DisplayFunctions[])(void) = {
|
|||||||
[DISPLAY_MAIN] = &UI_DisplayMain,
|
[DISPLAY_MAIN] = &UI_DisplayMain,
|
||||||
[DISPLAY_MENU] = &UI_DisplayMenu,
|
[DISPLAY_MENU] = &UI_DisplayMenu,
|
||||||
[DISPLAY_SCANNER] = &UI_DisplayScanner,
|
[DISPLAY_SCANNER] = &UI_DisplayScanner,
|
||||||
|
[DISPLAY_MESSAGES] = &UI_DisplayMessages,
|
||||||
|
#ifdef ENABLE_OOK_SENDER
|
||||||
|
[DISPLAY_OOKSENDER] = &OOKSENDER_Display,
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_FMRADIO
|
#ifdef ENABLE_FMRADIO
|
||||||
[DISPLAY_FM] = &UI_DisplayFM,
|
[DISPLAY_FM] = &UI_DisplayFM,
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ enum GUI_DisplayType_t
|
|||||||
DISPLAY_MAIN = 0,
|
DISPLAY_MAIN = 0,
|
||||||
DISPLAY_MENU,
|
DISPLAY_MENU,
|
||||||
DISPLAY_SCANNER,
|
DISPLAY_SCANNER,
|
||||||
|
DISPLAY_MESSAGES,
|
||||||
|
DISPLAY_OOKSENDER,
|
||||||
|
|
||||||
#ifdef ENABLE_FMRADIO
|
#ifdef ENABLE_FMRADIO
|
||||||
DISPLAY_FM,
|
DISPLAY_FM,
|
||||||
|
|||||||
+4
-3
@@ -35,8 +35,7 @@ void UI_DisplayReleaseKeys(void) {
|
|||||||
#endif
|
#endif
|
||||||
UI_DisplayClear();
|
UI_DisplayClear();
|
||||||
|
|
||||||
UI_PrintString("RELEASE", 0, 127, 1, 10);
|
UI_PrintString("RELEASE KEYS", 0, 127, 1 /*, 10 */);
|
||||||
UI_PrintString("ALL KEYS", 0, 127, 3, 10);
|
|
||||||
|
|
||||||
ST7565_BlitStatusLine(); // blank status line
|
ST7565_BlitStatusLine(); // blank status line
|
||||||
ST7565_BlitFullScreen();
|
ST7565_BlitFullScreen();
|
||||||
@@ -56,7 +55,9 @@ void UI_DisplayWelcome(void) {
|
|||||||
|
|
||||||
UI_DrawLineBuffer(gFrameBuffer, 0, 31, 127, 31, 1); // Be ware, status zone = 8 lines, the rest = 56 ->total 64
|
UI_DrawLineBuffer(gFrameBuffer, 0, 31, 127, 31, 1); // Be ware, status zone = 8 lines, the rest = 56 ->total 64
|
||||||
|
|
||||||
for (uint8_t i = 18; i < 110; i++) {
|
// firmware name in an inverted bar
|
||||||
|
UI_PrintStringSmallNormal(Version, 0, 127, 4);
|
||||||
|
for (uint8_t i = 0; i < 128; i++) {
|
||||||
gFrameBuffer[4][i] ^= 0xFF;
|
gFrameBuffer[4][i] ^= 0xFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,9 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN
|
#ifdef ENABLE_FEAT_F4HWN
|
||||||
const char Version[] = AUTHOR_STRING_2 " " VERSION_STRING_2;
|
// reported to CHIRP: a distinct name, because this fork has its own EEPROM layout
|
||||||
|
// (chirp/uvk5_brnpocsag.py); F4HWN / egzumer drivers must not accept it
|
||||||
|
const char Version[] = "BRN-POCSAG " VERSION_STRING_2;
|
||||||
#else
|
#else
|
||||||
const char Version[] = AUTHOR_STRING VER;
|
const char Version[] = AUTHOR_STRING VER;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user