避免微网间隔和超时时间超大

This commit is contained in:
nnhy 2016-01-15 07:11:16 +00:00
parent 90092ff0b7
commit de46b80994
3 changed files with 5 additions and 5 deletions

View File

@ -74,7 +74,7 @@ ITransport* Create2401(SPI spi_, Pin ce, Pin irq, Pin power, bool powerInvert, I
nrf->Init(spi, ce, irq, power); nrf->Init(spi, ce, irq, power);
auto tc = TinyConfig::Create(); auto tc = TinyConfig::Create();
if(tc->Interval < 40) if(tc->New)
{ {
tc->Channel = 120; tc->Channel = 120;
tc->Speed = 250; tc->Speed = 250;
@ -123,7 +123,7 @@ ITransport* CreateShunCom(COM index, int baudRate, Pin rst, Pin power, Pin slp,
{ {
auto tc = TinyConfig::Create(); auto tc = TinyConfig::Create();
debug_printf("tc->Interval %d\r\n",tc->Interval ); debug_printf("tc->Interval %d\r\n",tc->Interval );
if(tc->Interval == 0) if(tc->New)
{ {
tc->Channel = 0x0F; tc->Channel = 0x0F;
tc->Speed = 250; tc->Speed = 250;

View File

@ -220,7 +220,7 @@ TinyController::TinyController() : Controller()
{ {
bool flag = false; bool flag = false;
// 调整重发参数 // 调整重发参数
if(cfg->Interval == 0) if(cfg->Interval == 0 || cfg->Interval > 1000 || cfg->Timeout > 10000)
{ {
cfg->Interval = Interval; cfg->Interval = Interval;
cfg->Timeout = Timeout; cfg->Timeout = Timeout;

View File

@ -212,7 +212,7 @@ ITransport* Token::Create2401(SPI spi_, Pin ce, Pin irq, Pin power, bool powerIn
nrf.Init(&spi, ce, irq, power); nrf.Init(&spi, ce, irq, power);
auto tc = TinyConfig::Create(); auto tc = TinyConfig::Create();
if(tc->Interval == 0) if(tc->New)
{ {
tc->Channel = 120; tc->Channel = 120;
tc->Speed = 250; tc->Speed = 250;
@ -238,7 +238,7 @@ ITransport* Token::Create2401(SPI spi_, Pin ce, Pin irq, Pin power, bool powerIn
ITransport* Token::CreateShunCom(COM index, int baudRate, Pin rst, Pin power, Pin slp, Pin cfg, IDataPort* led) ITransport* Token::CreateShunCom(COM index, int baudRate, Pin rst, Pin power, Pin slp, Pin cfg, IDataPort* led)
{ {
auto tc = TinyConfig::Create(); auto tc = TinyConfig::Create();
if(tc->Interval == 0) if(tc->New)
{ {
tc->Channel = 0x0F; tc->Channel = 0x0F;
tc->Speed = 250; tc->Speed = 250;