| 310 | bool Start(void) |
| 311 | { |
| 312 | _errStr = ""; |
| 313 | bool result = false; |
| 314 | |
| 315 | Stop(); |
| 316 | if (_port != 0) |
| 317 | { |
| 318 | // If COM3 tell mainboard to automatically send output |
| 319 | if(_port > 2) |
| 320 | { |
| 321 | int minor_ver = 0; |
| 322 | int ver = GetMnBdVer(&minor_ver); |
| 323 | if(ver >= 120 && minor_ver >= 6) |
| 324 | { |
| 325 | if(SetMnBdRepeatFormat()) |
| 326 | { |
| 327 | if(_scale == 0) |
| 328 | { |
| 329 | SetMnBdSerialDefaultScale(0x7F); |
| 330 | } |
| 331 | |
| 332 | g_serial_rep.fmt = 1; |
| 333 | g_serial_rep.intv = _interval; |
| 334 | if (MnBdRequest(MNBD_DEV + _port - 3, MNBD_REQ_REP_SEND_SERIAL_FMT, WAIT_ACK) != OK) |
| 335 | { |
| 336 | _errStr = "Error starting scoreboard repeat\r\n"; |
| 337 | } |
| 338 | else |
| 339 | { |
| 340 | _mnbdRepeating = true; |
| 341 | result = true; |
| 342 | } |
| 343 | } |
| 344 | } |
| 345 | else if (ver == 0) |
| 346 | { |
| 347 | _errStr = "Call MnBdStartup before SB start"; |
| 348 | } |
| 349 | else |
| 350 | { |
| 351 | _errStr = "Update MnBd for SB repeating"; |
| 352 | } |
| 353 | } |
| 354 | else |
| 355 | { |
| 356 | _file.Open(pszCommPortDev[_port], "w"); |
| 357 | _timer.Start(_interval, true); |
| 358 | result = true; |
| 359 | } |
| 360 | } |
| 361 | return result; |
| 362 | } |