Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/maxou/few improvements #76

Merged
merged 2 commits into from
Oct 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 0 additions & 21 deletions Build-Instructions/Extra-Settings.md

This file was deleted.

27 changes: 19 additions & 8 deletions Source/base-fw/main/GateControl.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ static void GateControlTask( void *pvParameters )

if (m_eCurrentMode == GATECONTROL_EMODE_GoHome)
{
SGUBRCOMM_ChevronLightning(&g_sSGUBRCOMMHandle, SGUBRPROTOCOL_ECHEVRONANIM_AllSymbolsOn);
SGUBRCOMM_ChevronLightning(&g_sSGUBRCOMMHandle, SGUBRPROTOCOL_ECHEVRONANIM_FadeIn);
vTaskDelay(pdMS_TO_TICKS(750));
if (DoHoming(&sProcCycle))
SGUBRCOMM_ChevronLightning(&g_sSGUBRCOMMHandle, SGUBRPROTOCOL_ECHEVRONANIM_FadeOut);
Expand Down Expand Up @@ -271,6 +271,7 @@ static bool AutoCalibrate(const SProcCycle* psProcCycle)
// Move until it's outside
GPIO_StartStepper();
GPIO_ReleaseClamp();
SOUNDFX_Stop();

const int32_t s32AttemptCount = 10;
int32_t s32StepCount = 0;
Expand Down Expand Up @@ -366,6 +367,7 @@ static bool DoHoming(const SProcCycle* psProcCycle)

m_bIsHomingCompleted = false;

SOUNDFX_Stop();
GPIO_StartStepper();
GPIO_ReleaseClamp();
ESP_LOGI(TAG, "[DoHoming] Started");
Expand Down Expand Up @@ -523,6 +525,7 @@ void GATECONTROL_AnimRampLight(bool bIsActive)
static bool DoDialSequence(const GATECONTROL_SDialArg* psDialArg, const SProcCycle* psProcCycle)
{
const char* szErrorString = "unknown";
bool bIsCancelled = false;

if (!m_bIsHomingCompleted)
{
Expand All @@ -544,17 +547,23 @@ static bool DoDialSequence(const GATECONTROL_SDialArg* psDialArg, const SProcCyc
const int32_t s32StepPerRotation = NVSJSON_GetValueInt32(&g_sSettingHandle, SETTINGS_EENTRY_StepPerRotation);
const uint32_t u32SymbBright = (uint32_t)NVSJSON_GetValueInt32(&g_sSettingHandle, SETTINGS_EENTRY_RingSymbolBrightness);

#define CHECK_CANCEL_JUMP \
do { \
if (m_bIsStop) \
{ \
bIsCancelled = true; \
szErrorString = "cancelled"; \
goto ERROR; \
} \
} while(0)

for(int i = 0; i < psDialArg->u8SymbolCount; i++)
{
if (m_bIsStop)
{
szErrorString = "cancelled";
goto ERROR;
}

const uint8_t u8SymbolIndex = psDialArg->u8Symbols[i];
int32_t s32TicksTarget = GetAbsoluteSymbolTarget(u8SymbolIndex, s32StepPerRotation);

CHECK_CANCEL_JUMP;

ESP_LOGI(TAG, "Go Home - Symbol: %d, previous target: %d, new target: %d, current: %d", /*0*/(int)u8SymbolIndex, /*1*/(int)m_s32Count, /*2*/(int)s32TicksTarget, /*3*/(int)m_s32Count);

int32_t s32Move = (s32TicksTarget - m_s32Count);
Expand All @@ -569,6 +578,7 @@ static bool DoDialSequence(const GATECONTROL_SDialArg* psDialArg, const SProcCyc
SOUNDFX_StartRollingSound();
vTaskDelay(pdMS_TO_TICKS(250));
MoveRelative(s32Move);
CHECK_CANCEL_JUMP;
SOUNDFX_Stop();
vTaskDelay(pdMS_TO_TICKS(150));
SOUNDFX_EngageChevron();
Expand Down Expand Up @@ -603,7 +613,8 @@ static bool DoDialSequence(const GATECONTROL_SDialArg* psDialArg, const SProcCyc
GPIO_StopStepper();
SOUNDFX_Fail();
GATECONTROL_AnimRampLight(false);
SGUBRCOMM_ChevronLightning(&g_sSGUBRCOMMHandle, SGUBRPROTOCOL_ECHEVRONANIM_ErrorToOff);
const SGUBRPROTOCOL_ECHEVRONANIM eChevronAnim = (bIsCancelled ? SGUBRPROTOCOL_ECHEVRONANIM_FadeOut : SGUBRPROTOCOL_ECHEVRONANIM_ErrorToOff);
SGUBRCOMM_ChevronLightning(&g_sSGUBRCOMMHandle, eChevronAnim);
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion Source/base-fw/main/Settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ static NVSJSON_SSettingEntry m_sConfigEntries[SETTINGS_EENTRY_Count] =
[SETTINGS_EENTRY_RampOnPercent] = NVSJSON_INITINT32_RNG("Ramp.LightOn", "Ramp illumination ON (percent)", 30, 0, 100, NVSJSON_EFLAGS_None),

[SETTINGS_EENTRY_WormholeMaxBrightness] = NVSJSON_INITINT32_RNG("WH.MaxBright", "Maximum brightness for wormhole leds. (Warning: can cause voltage drop)", 220, 0, 255, NVSJSON_EFLAGS_None),
[SETTINGS_EENTRY_WormholeType] = NVSJSON_INITINT32_RNG("WH.Type", "0: SGU, 1: SG1, 2: Hell", (int)WORMHOLE_ETYPE_NormalSGU, 0, (int)WORMHOLE_ETYPE_Count-1, NVSJSON_EFLAGS_None),
[SETTINGS_EENTRY_WormholeType] = NVSJSON_INITINT32_RNG("WH.Type", "0: SGU, 1: SG1, 2: Hell, 3: Blackhole, 4: Strobe, 5: Glitch", (int)WORMHOLE_ETYPE_NormalSGU, 0, (int)WORMHOLE_ETYPE_Count-1, NVSJSON_EFLAGS_None),

// WiFi Station related
[SETTINGS_EENTRY_WSTAIsActive] = NVSJSON_INITINT32_RNG("WSTA.IsActive", "Wi-Fi is active", 0, 0, 1, NVSJSON_EFLAGS_NeedsReboot),
Expand Down
Loading
Loading