| 254 | Since COM3 and COM4 are handled by the mainboard processor they allow repeating outputs to be specified with variables for weight, units, etc... This is used by the CScoreboard class in applications such as ID storage. This can be useful because the application can just specify the output and does not have to continue sending constantly. |
| 255 | |
| 256 | |
| 257 | {{{ |
| 258 | |
| 259 | bool SetMnBdRepeatFormat(void) |
| 260 | { |
| 261 | g_serial_fmt.fmt = 1; |
| 262 | |
| 263 | switch(_format) |
| 264 | { |
| 265 | case FMT_SB500: |
| 266 | if(_sbOverCap) |
| 267 | { |
| 268 | strcpy((char*)g_serial_fmt.data, "%%%0 O CAP r\r"); |
| 269 | } |
| 270 | else |
| 271 | { |
| 272 | if(_scale == 0) |
| 273 | { |
| 274 | strcpy((char*)g_serial_fmt.data, "%%%0%G6%%U%G \r"); |
| 275 | g_serial_fmt.data[12] = _sbLightCode; |
| 276 | } |
| 277 | else |
| 278 | { |
| 279 | sprintf((char*)g_serial_fmt.data, "%%%%%%0%%G(%d)6%%%%U%%G%c\r", _scale, _sbLightCode); |
| 280 | } |
| 281 | } |
| 282 | break; |
| 283 | case FMT_COMPIF: |
| 284 | strcpy((char*)g_serial_fmt.data, "%G% %U% G %M% \r"); |
| 285 | break; |
| 286 | case FMT_SB200: |
| 287 | strcpy((char*)g_serial_fmt.data, "%G% %U% G %M% \r"); |
| 288 | break; |
| 289 | case FMT_GENERIC: |
| 290 | strcpy((char*)g_serial_fmt.data, "%G% %U% G %M% \r"); |
| 291 | break; |
| 292 | default: |
| 293 | strcpy((char*)g_serial_fmt.data, "%G% %U% G %M% \r"); |
| 294 | } |
| 295 | |
| 296 | g_serial_fmt.len = strlen((char*)g_serial_fmt.data); |
| 297 | |
| 298 | if(MnBdRequest(MNBD_DEV, MNBD_REQ_SET_SERIAL_FMT, WAIT_ACK) != OK) |
| 299 | { |
| 300 | _errStr = "Error setting format\r\n"; |
| 301 | return false; |
| 302 | } |
| 303 | else |
| 304 | { |
| 305 | return true; |
| 306 | } |
| 307 | } |
| 308 | |
| 309 | |
| 310 | }}} |
| 311 | |
| 312 | Variables |
| 313 | |
| 314 | %<item code><len>% |
| 315 | |
| 316 | item code: |
| 317 | |
| 318 | G - Gross weight |
| 319 | T - Tare weight |
| 320 | N - Net weight |
| 321 | U - upper case weight units |
| 322 | u - lower case weight units |
| 323 | C - weight status |
| 324 | S - SMA weight status |
| 325 | M - motion status |
| 326 | |
| 327 | Use two percent characters %% to output a percent character |
| 328 | |
| 329 | |