Skip to content

Commit

Permalink
Never use SWD when RELAY is selected.
Browse files Browse the repository at this point in the history
RELAY "audioproc" uses these pins to control motorized resistor,
so in standby mode is should not reinit pins to SWD.
  • Loading branch information
WiseLord committed Nov 19, 2023
1 parent b8e2b73 commit acbac20
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/amp.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <stdlib.h>
#include <string.h>

#include "audio/audio.h"
#include "input.h"
#include "rtc.h"
#include "utils.h"
Expand All @@ -21,7 +22,7 @@ Amp *ampGet(void)
void ampRun(void)
{
while (1) {
utilEnableSwd(SCREEN_STANDBY == amp.screen);
utilEnableSwd(ALLOW_SWD && (SCREEN_STANDBY == amp.screen));

ampSyncFromOthers();

Expand Down
4 changes: 3 additions & 1 deletion src/amp.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ extern "C" {
#include <stdint.h>

#include "action.h"
#include "audio/audiodefs.h"
#include "audio/audio.h"
#include "gui/canvas.h"
#include "gui/icons.h"

Expand All @@ -20,6 +20,8 @@ extern "C" {
#define LCD_BR_MIN 1
#define LCD_BR_MAX 32

#define ALLOW_SWD (audioGet()->par.ic != AUDIO_IC_RELAY)

typedef uint8_t ScreenType;
enum {
// Screens allowed to be default
Expand Down
2 changes: 1 addition & 1 deletion src/amp_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1298,7 +1298,7 @@ void ampInit(void)
{
amp = ampGet();

utilEnableSwd(true);
utilEnableSwd(ALLOW_SWD && true);

settingsInit();
utilInitSysCounter();
Expand Down

0 comments on commit acbac20

Please sign in to comment.