Fixed $$ lockup problem. Root cause was mis-handling of stale NV lists.

This commit is contained in:
Alden Hart
2016-12-24 10:03:19 -05:00
parent 295d7ba36d
commit 5a0d99a40a
4 changed files with 16 additions and 13 deletions
+4 -4
View File
@@ -1117,7 +1117,7 @@ static stat_t _do_outputs(nvObj_t *nv) // print parameters for all output group
} }
return (STAT_COMPLETE); return (STAT_COMPLETE);
} }
/*
static stat_t _do_heaters(nvObj_t *nv) // print parameters for all heater groups static stat_t _do_heaters(nvObj_t *nv) // print parameters for all heater groups
{ {
char group[GROUP_LEN]; char group[GROUP_LEN];
@@ -1127,7 +1127,7 @@ static stat_t _do_heaters(nvObj_t *nv) // print parameters for all heater group
} }
return (STAT_COMPLETE); return (STAT_COMPLETE);
} }
*/
static stat_t _do_all(nvObj_t *nv) // print all parameters static stat_t _do_all(nvObj_t *nv) // print all parameters
{ {
_do_group(nv, (char *)"sys"); // System group _do_group(nv, (char *)"sys"); // System group
@@ -1135,10 +1135,10 @@ static stat_t _do_all(nvObj_t *nv) // print all parameters
_do_axes(nv); _do_axes(nv);
_do_inputs(nv); _do_inputs(nv);
_do_outputs(nv); _do_outputs(nv);
// _do_heaters(nv); // there are no text mode prints for heaters _do_heaters(nv); // there are no text mode prints for heaters
_do_group(nv, (char *)"p1"); // PWM group _do_group(nv, (char *)"p1"); // PWM group
_do_offsets(nv); // coordinate system offsets _do_offsets(nv); // coordinate system offsets
return (STAT_OK); return (STAT_COMPLETE); // STAT_COMPLETE suppresses a second JSON write that would cause a fault
} }
/*********************************************************************************** /***********************************************************************************
+1 -1
View File
@@ -204,7 +204,7 @@ char *get_status_message(stat_t status);
#define STAT_MAX_DEPTH_EXCEEDED 115 // JSON exceeded maximum nesting depth #define STAT_MAX_DEPTH_EXCEEDED 115 // JSON exceeded maximum nesting depth
#define STAT_VALUE_TYPE_ERROR 116 // JSON value does not agree with variable type #define STAT_VALUE_TYPE_ERROR 116 // JSON value does not agree with variable type
#define STAT_INPUT_FROM_MUTED_CHANNEL_ERROR 117 // input from a muted channel was ignored #define STAT_INPUT_FROM_MUTED_CHANNEL_ERROR 117 // input from a muted channel was ignored
#define STAT_ERROR_118 118 #define STAT_ERROR_118 118
#define STAT_ERROR_119 119 #define STAT_ERROR_119 119
+6 -6
View File
@@ -5,7 +5,7 @@
<ProjectVersion>7.0</ProjectVersion> <ProjectVersion>7.0</ProjectVersion>
<ToolchainName>com.Atmel.ARMGCC.CPP</ToolchainName> <ToolchainName>com.Atmel.ARMGCC.CPP</ToolchainName>
<ProjectGuid>{44ea8fec-55d7-4149-8a78-a574fc26bf51}</ProjectGuid> <ProjectGuid>{44ea8fec-55d7-4149-8a78-a574fc26bf51}</ProjectGuid>
<avrdevice>ATSAMS70N19</avrdevice> <avrdevice>ATSAM3X8C</avrdevice>
<avrdeviceseries>none</avrdeviceseries> <avrdeviceseries>none</avrdeviceseries>
<OutputType>Executable</OutputType> <OutputType>Executable</OutputType>
<Language>CPP</Language> <Language>CPP</Language>
@@ -68,12 +68,12 @@
<com_atmel_avrdbg_tool_atmelice> <com_atmel_avrdbg_tool_atmelice>
<ToolOptions> <ToolOptions>
<InterfaceProperties> <InterfaceProperties>
<SwdClock>2000000</SwdClock> <SwdClock>10000000</SwdClock>
</InterfaceProperties> </InterfaceProperties>
<InterfaceName>SWD</InterfaceName> <InterfaceName>SWD</InterfaceName>
</ToolOptions> </ToolOptions>
<ToolType>com.atmel.avrdbg.tool.atmelice</ToolType> <ToolType>com.atmel.avrdbg.tool.atmelice</ToolType>
<ToolNumber>J41800019454</ToolNumber> <ToolNumber>J41800036434</ToolNumber>
<ToolName>Atmel-ICE</ToolName> <ToolName>Atmel-ICE</ToolName>
</com_atmel_avrdbg_tool_atmelice> </com_atmel_avrdbg_tool_atmelice>
<UseGdb>True</UseGdb> <UseGdb>True</UseGdb>
@@ -100,9 +100,9 @@
<HWProgramCounterSampling>True</HWProgramCounterSampling> <HWProgramCounterSampling>True</HWProgramCounterSampling>
</PercepioTrace> </PercepioTrace>
<preserveEEPROM>true</preserveEEPROM> <preserveEEPROM>true</preserveEEPROM>
<avrtoolserialnumber>J41800019454</avrtoolserialnumber> <avrtoolserialnumber>J41800036434</avrtoolserialnumber>
<avrdeviceexpectedsignature>0xA11D0A00</avrdeviceexpectedsignature> <avrdeviceexpectedsignature>0x284E0A60</avrdeviceexpectedsignature>
<avrtoolinterfaceclock>2000000</avrtoolinterfaceclock> <avrtoolinterfaceclock>10000000</avrtoolinterfaceclock>
<custom> <custom>
<ToolOptions xmlns=""> <ToolOptions xmlns="">
<InterfaceProperties> <InterfaceProperties>
Executable → Regular
+5 -2
View File
@@ -568,10 +568,13 @@ void json_print_response(uint8_t status, const bool only_to_muted /*= false*/)
nv->valuetype = TYPE_EMPTY; nv->valuetype = TYPE_EMPTY;
} }
} }
} while ((nv = nv->nx) != NULL); } while ((nv = nv->nx) != NULL); // Emergency escape
} }
// Footer processing // Footer processing - wind to the end of the populated blocks
if (nv == NULL) { // this can happen when processing a stale list
return; //...that already has a null-terminated footer
}
while(nv->valuetype != TYPE_EMPTY) { // find a free nvObj at end of the list... while(nv->valuetype != TYPE_EMPTY) { // find a free nvObj at end of the list...
if ((nv = nv->nx) == NULL) { // oops! No free nvObj! if ((nv = nv->nx) == NULL) { // oops! No free nvObj!
rpt_exception(STAT_JSON_OUTPUT_TOO_LONG, "json_print_response() json too long"); // report this as an exception rpt_exception(STAT_JSON_OUTPUT_TOO_LONG, "json_print_response() json too long"); // report this as an exception