- added suspend state
- needed to modify init values of variables - switch is off on start up git-svn-id: http://moon:8086/svn/projects/HendiControl@184 fda53097-d464-4ada-af97-ba876c37ca34
This commit is contained in:
@@ -120,6 +120,7 @@
|
||||
</avrgcc.assembler.general.IncludePaths>
|
||||
</AvrGcc>
|
||||
</ToolchainSettings>
|
||||
<PostBuildEvent>copy "$(OutputDirectory)\$(OutputFileName).srec" Z:\brewpi\$(OutputFileName).srec</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||
<ToolchainSettings>
|
||||
|
||||
@@ -48,8 +48,8 @@ int g_debug = 0;
|
||||
|
||||
// Switch IN
|
||||
int16_t g_switch_in_digits = 0;
|
||||
int g_switch_in = 0;
|
||||
int g_switch_in_last = 0;
|
||||
int g_switch_in = 0xFFFF;
|
||||
int g_switch_in_last = 0xFFFF;
|
||||
|
||||
// Switch OUT
|
||||
int g_switch_out = 0;
|
||||
@@ -64,13 +64,14 @@ typedef enum _eState_t
|
||||
{
|
||||
StateNormal = 0,
|
||||
StateRemote = 1,
|
||||
StateError = 2,
|
||||
StateSuspend = 2,
|
||||
StateError = 3,
|
||||
State_NumStates
|
||||
} State_t;
|
||||
|
||||
static const char SW_IDENTIFIER[] = "Hendi-Control";
|
||||
static const char SW_VERSION[] = "v1.1";
|
||||
static const char *state_str[State_NumStates] = {"Normal","Remote","Error"};
|
||||
static const char SW_VERSION[] = "v1.12";
|
||||
static const char *state_str[State_NumStates] = {"Normal", "Remote", "Suspend", "Error"};
|
||||
static const uint16_t POTI_HSYTERSE = 1;
|
||||
|
||||
typedef enum _eSwitch
|
||||
@@ -109,8 +110,8 @@ int main(void)
|
||||
wdt_reset();
|
||||
wdt_disable();
|
||||
|
||||
State_t state = StateNormal;
|
||||
State_t state_next = StateNormal;
|
||||
State_t state = StateSuspend;
|
||||
State_t state_next = StateSuspend;
|
||||
|
||||
fifo_init(&messageFifo, 8, sizeof(Msg_t), "Fifo");
|
||||
|
||||
@@ -134,7 +135,6 @@ int main(void)
|
||||
// Start Timer
|
||||
timer_start(TIMER_GENERAL, 0);
|
||||
timer_start(TIMER_ADC, 0);
|
||||
setSwitch(1);
|
||||
|
||||
sei();
|
||||
while (1)
|
||||
@@ -235,7 +235,7 @@ int main(void)
|
||||
if (arg == 1)
|
||||
{
|
||||
// Enter remote
|
||||
if (state == StateNormal)
|
||||
if (state == StateNormal || state == StateSuspend)
|
||||
{
|
||||
setPower(PowerLow);
|
||||
setSwitch(SwitchOff);
|
||||
@@ -254,7 +254,7 @@ int main(void)
|
||||
{
|
||||
setPower(PowerLow);
|
||||
setSwitch(SwitchOff);
|
||||
state_next = StateNormal;
|
||||
state_next = StateSuspend;
|
||||
PRINT_ANSWER("OK:%d", arg);
|
||||
}
|
||||
else
|
||||
@@ -413,7 +413,7 @@ int main(void)
|
||||
PRINT_DEBUG ("PwrSwitch_in = %d\n", g_switch_in);
|
||||
if (g_switch_in == 0)
|
||||
{
|
||||
if (state == StateError || state == StateRemote)
|
||||
if (state == StateError || state == StateRemote || state == StateSuspend)
|
||||
{
|
||||
setSwitch(SwitchOn);
|
||||
state_next = StateNormal;
|
||||
|
||||
@@ -13,7 +13,7 @@ void port_init()
|
||||
DDRD = 0xFC;
|
||||
DDRB = 0x06;
|
||||
PORTD = 0xFC;
|
||||
PORTB = 0x04;
|
||||
PORTB = 0x06;
|
||||
}
|
||||
|
||||
typedef struct _sPort_t
|
||||
|
||||
Reference in New Issue
Block a user