<div dir="ltr">Hi,<div><br></div><div style>I'm trying to create a fault/error SMS function for the vehicle_thinkcity.c</div><div style>The idea is making a two columns array, where the first column keeps different alarm messages available, while the second column keeps the state-variables of the corresponding error.</div>
<div style>Later on, only active errors, which has it's state-variable flag set, will be sent in the SMS (and the number of active errors).</div><div style><br></div><div style>Unfortunately my code did not work, and I therefor ask you for some help.</div>
<div style><br></div><div style><br></div><div style><i>The code is currently:</i></div><div style><div><i>void vehicle_thinkcity_fault_prepmsg(void)</i></div><div><i>{</i></div><div><i><br></i></div><div><i> rom char vehicle_thinkcity_fault_txttable[][] = </i></div>
<div><i> {</i></div><div><i> "MnyFailCel", // -> tc_bit_manyfailedcells;</i></div><div><i> "Crash", // -> tc_bit_crash;</i></div><div><i> "GenErr", // -> tc_bit_generalerr;</i></div>
<div><i> "IsoErr", // -> tc_bit_isoerr;</i></div><div><i> "IntIso", // -> tc_bit_intisoerr;</i></div><div><i> "ExtIso", // -> tc_bit_extisoerr;</i></div><div><i> "ThermIso", // -> tc_bit_thermalisoerr;</i></div>
<div><i> "EmgEPO", // -> tc_bit_epoemerg;</i></div><div><i> "ChgWaitTemp", // -> tc_bit_chgwaittemp;</i></div><div><i> "ReachEOC", // -> tc_bit_reacheocplease;</i></div><div>
<i> "WaitOkTpDcg", // -> tc_bit_waitoktmpdisch;</i></div><div><i> "CrgWaitTp2", // -> tc_bit_chgwaitttemp2;</i></div><div><i> "NoChgCur", // -> tc_bit_nochgcurr;</i></div><div>
<i> "ChgOverVolt", // -> tc_bit_chgovervolt;</i></div><div><i> "ChgOverCur", // -> tc_bit_chgovercurr;</i></div><div><i> ""</i></div><div><i> };</i></div><div><i> </i></div><div>
<i> rom char vehicle_thinkcity_fault_vartable[] = </i></div><div><i> {</i></div><div><i> tc_bit_manyfailedcells,</i></div><div><i> tc_bit_crash,</i></div><div><i> tc_bit_generalerr,</i></div><div><i> tc_bit_isoerr,</i></div>
<div><i> tc_bit_intisoerr,</i></div><div><i> tc_bit_extisoerr,</i></div><div><i> tc_bit_thermalisoerr,</i></div><div><i> tc_bit_epoemerg,</i></div><div><i> tc_bit_chgwaittemp,</i></div><div><i> tc_bit_reacheocplease,</i></div>
<div><i> tc_bit_waitoktmpdisch,</i></div><div><i> tc_bit_chgwaitttemp2,</i></div><div><i> tc_bit_nochgcurr,</i></div><div><i> tc_bit_chgovervolt,</i></div><div><i> tc_bit_chgovercurr</i></div><div><i> };</i></div>
<div><i><br></i></div><div><i><br></i></div><div><i> char *s;</i></div><div><i> int k;</i></div><div><i> int errcount = 0 ;</i></div><div><i><br></i></div><div><i><br></i></div><div><i> s = strchr(net_scratchpad, 0);</i></div>
<div><i> s = stp_rom(s, "Act err:");</i></div><div><i> </i></div><div style><i> //additional info for error-print</i></div><div><i> if (tc_pack_failedcells != 0)</i></div><div><i> {</i></div><div><i> s = stp_i(s, "\rFailCel:", tc_pack_failedcells);</i></div>
<div><i><span class="" style="white-space:pre"> </span>errcount++;</i></div><div><i> }</i></div><div style><i> // end additional info </i></div><div><i><br></i></div><div><i> for (k = 0; vehicle_thinkcity_fault_txttable[k][0] != 0; k++)</i></div>
<div><i> {</i></div><div><i> if (vehicle_thinkcity_fault_vartable[k] != 0)</i></div><div><i> {</i></div><div><i> s = stp_i(s, "\r", vehicle_thinkcity_fault_txttable[k]);</i></div><div><i> k++;</i></div>
<div><i><span class="" style="white-space:pre"> </span>errcount++;</i></div><div><i> }</i></div><div><i> }</i></div><div><i> s = stp_i(s, "\rTot err: ", errcount);</i></div><div><i><br></i></div><div><i><br>
</i></div><div><i><br></i></div><div><i>}</i></div><div><br></div><div style>Best regards</div><div style>Håkon</div></div></div>