Skip to content

Commit

Permalink
lazy config again changed
Browse files Browse the repository at this point in the history
  • Loading branch information
pa-pa committed Feb 28, 2017
1 parent 58d80e7 commit d9ba555
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
6 changes: 6 additions & 0 deletions AskSinPP.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ class AskSin {
RadioType radio;
Activity activity;

static void pgm_read(uint8_t* dest,uint16_t adr,uint8_t size) {
for( int i=0; i<size; ++i, ++dest ) {
*dest = pgm_read_byte(adr + i);
}
}

};

}
Expand Down
15 changes: 5 additions & 10 deletions Device.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ class Device {
}

void setModel (uint16_t address) {
pgm_read(model,address,sizeof(model));
HalType::pgm_read(model,address,sizeof(model));
}

void setSubType (uint8_t st) {
Expand All @@ -140,7 +140,7 @@ class Device {
}

void setDeviceID (uint16_t address) {
pgm_read((uint8_t*)&devid,address,sizeof(devid));
HalType::pgm_read((uint8_t*)&devid,address,sizeof(devid));
}

const HMID& getDeviceID () const {
Expand All @@ -153,7 +153,7 @@ class Device {
}

void setSerial (uint16_t address) {
pgm_read((uint8_t*)serial,address,10);
HalType::pgm_read((uint8_t*)serial,address,10);
}

const char* getSerial () const {
Expand Down Expand Up @@ -243,8 +243,9 @@ class Device {
#endif
{
result = response.isAck();
// we request wakeup
// we got the fag to stay awake
if( response.isKeepAwake() ) {
if( msg.isWakeMeUp() /*response.isKeepAwake()*/ ) {
activity().stayAwake(millis2ticks(500));
}
}
Expand Down Expand Up @@ -421,12 +422,6 @@ class Device {
return false;
}

void pgm_read(uint8_t* dest,uint16_t adr,uint8_t size) {
for( int i=0; i<size; ++i, ++dest ) {
*dest = pgm_read_byte(adr + i);
}
}

#ifdef USE_AES
void sendAckAes (Message& msg,const uint8_t* data) {
msg.ackAes().init(data);
Expand Down
2 changes: 1 addition & 1 deletion MultiChannelDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ class MultiChannelDevice : public Device<HalType> {
uint8_t mcomm = msg.command();
uint8_t msubc = msg.subcommand();
if( mtype == AS_MESSAGE_CONFIG ) {
DeviceType::activity().stayAwake(seconds2ticks(2));
DeviceType::activity().stayAwake(millis2ticks(500));
// PAIR_SERIAL
if( msubc == AS_CONFIG_PAIR_SERIAL && memcmp(msg.data(),DeviceType::getSerial(),10)==0 ) {
DeviceType::led().set(StatusLed::pairing);
Expand Down

0 comments on commit d9ba555

Please sign in to comment.