temperature: Fixing issues.
*We are running out of memory. *Less safe I2C transaction. *Discovered a bug in clock.
This commit is contained in:
parent
fc2a05a9d8
commit
b891695bfc
@ -93,7 +93,7 @@ void Clock::updateClock()
|
||||
diff_overflows = (old_overflows <= this->_overflows)
|
||||
//Usually it is new amount of overflows - old.
|
||||
? (this->_overflows - old_overflows)
|
||||
//It is possible that overflows counter will overflow.
|
||||
//It is possible that overflows counter will overflow. (Seems that it causes the timer to get insane count when it works.)
|
||||
: (0xffffffffffffffff - old_overflows + this->_overflows);
|
||||
|
||||
//First case -> no overflow
|
||||
|
||||
@ -103,7 +103,7 @@ I2C::transaction (uint8_t devAddr, uint8_t *txBuffPtr, uint16_t txSize,
|
||||
I2CM_XFER_T i2cmXferRec;
|
||||
|
||||
// make sure that master is idle
|
||||
while (Chip_I2CM_StateChanged(this->device) == 0);
|
||||
//while (Chip_I2CM_StateChanged(this->device) == 0);
|
||||
|
||||
/* Setup I2C transfer record */
|
||||
i2cmXferRec.slaveAddr = devAddr;
|
||||
|
||||
@ -121,19 +121,19 @@ void thread_master(void* pvParams) {
|
||||
|
||||
LOG_INFO("Master is creating tasks");
|
||||
manager->tm->createTask(thread_manager, "manager",
|
||||
configMINIMAL_STACK_SIZE * 14,tskIDLE_PRIORITY + 1UL,
|
||||
configMINIMAL_STACK_SIZE * 13,tskIDLE_PRIORITY + 1UL,
|
||||
static_cast<void*>(manager));
|
||||
manager->tm->createTask(thread_rotary, "rotary",
|
||||
configMINIMAL_STACK_SIZE * 9,tskIDLE_PRIORITY + 1UL,
|
||||
configMINIMAL_STACK_SIZE * 8,tskIDLE_PRIORITY + 1UL,
|
||||
static_cast<void*>(manager));
|
||||
manager->tm->createTask(thread_user_interface, "user_interface",
|
||||
configMINIMAL_STACK_SIZE * 9,tskIDLE_PRIORITY + 1UL,
|
||||
configMINIMAL_STACK_SIZE * 8,tskIDLE_PRIORITY + 1UL,
|
||||
static_cast<void*>(manager));
|
||||
manager->tm->createTask(thread_relay, "relay",
|
||||
configMINIMAL_STACK_SIZE * 9,tskIDLE_PRIORITY + 1UL,
|
||||
configMINIMAL_STACK_SIZE * 8,tskIDLE_PRIORITY + 1UL,
|
||||
static_cast<void*>(manager));
|
||||
manager->tm->createTask(thread_temperature, "temperature",
|
||||
configMINIMAL_STACK_SIZE * 9,tskIDLE_PRIORITY + 1UL,
|
||||
configMINIMAL_STACK_SIZE * 8,tskIDLE_PRIORITY + 1UL,
|
||||
static_cast<void*>(manager));
|
||||
LOG_INFO("Master created tasks");
|
||||
m.taskFunction();
|
||||
|
||||
@ -51,7 +51,7 @@ uint8_t SensorTempTC74::read()
|
||||
if (this->on_standby())
|
||||
{
|
||||
this->remove_standby();
|
||||
vTaskDelay(1);
|
||||
vTaskDelay(3000);
|
||||
}
|
||||
|
||||
//if ready and up - read
|
||||
@ -64,7 +64,7 @@ uint8_t SensorTempTC74::read()
|
||||
LOG_WARNING("Unable to read temperature sensor [%d] value.", this->_dev_addr);
|
||||
|
||||
//set standy.
|
||||
this->set_standby();
|
||||
//this->set_standby();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
@ -33,7 +33,7 @@ void Temperature::taskFunction()
|
||||
void thread_temperature(void* pvParams)
|
||||
{
|
||||
ThreadCommon::CommonManagers * manager = static_cast<ThreadCommon::CommonManagers*>(pvParams);
|
||||
I2C_config conf{0x4a, 55000};
|
||||
I2C_config conf{0x4a, 100000};
|
||||
I2C i2c(conf);
|
||||
Temperature t(manager->qm, &i2c);
|
||||
t.taskFunction();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user