Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
atc1441 authored Sep 8, 2020
1 parent 00d823a commit a2819e3
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
7 changes: 6 additions & 1 deletion ATC_Thermometer/app.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ RAM bool temp_C_or_F;
RAM bool blinking_smiley = true;
RAM bool show_batt_enabled = true;
RAM bool advertising_type = false;//Custom or Mi Advertising
RAM uint8_t advertising_interval = 6;
RAM uint8_t advertising_interval = 6;//multiply by 10 for value
RAM int8_t temp_offset;
RAM int8_t humi_offset;
RAM uint8_t temp_alarm_point = 5;//divide by ten for value
RAM uint8_t humi_alarm_point = 5;

void user_init_normal(void){//this will get executed one time after power up
random_generator_init(); //must
Expand Down Expand Up @@ -82,6 +84,9 @@ void main_loop(){
last_adv_delay = clock_time();
}

if((temp-last_temp > temp_alarm_point)||(last_temp-temp > temp_alarm_point)||(humi-last_humi > humi_alarm_point)||(last_humi-humi > humi_alarm_point)){// instant advertise on to much sensor difference
set_adv_data(temp, humi, battery_level, battery_mv);
}
last_temp = temp;
last_humi = humi;

Expand Down
9 changes: 9 additions & 0 deletions ATC_Thermometer/cmd_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ extern bool show_batt_enabled;
extern uint8_t advertising_interval;
extern int8_t temp_offset;
extern int8_t humi_offset;
extern uint8_t temp_alarm_point;
extern uint8_t humi_alarm_point;
void cmd_parser(void * p){
rf_packet_att_data_t *req = (rf_packet_att_data_t*)p;
uint8_t inData = req->dat[0];
Expand Down Expand Up @@ -44,5 +46,12 @@ void cmd_parser(void * p){
humi_offset = req->dat[1];//Set humi offset, -50 - +50 %
if(humi_offset<-50)humi_offset=-50;
if(humi_offset>50)humi_offset=50;
}else if(inData == 0xFC){
temp_alarm_point = req->dat[1];//Set temp alarm point value divided by 10 for temp in °C
if(temp_alarm_point==0)temp_alarm_point = 1;
}else if(inData == 0xFD){
humi_alarm_point = req->dat[1];//Set humi alarm point
if(humi_alarm_point==0)humi_alarm_point = 1;
if(humi_alarm_point>50)humi_alarm_point = 50;
}
}
5 changes: 5 additions & 0 deletions ATC_Thermometer/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ _attribute_ram_code_ int main (void) //must run in ramcode
#endif
blc_app_loadCustomizedParameters();

gpio_set_func(GPIO_PB6, AS_GPIO);//LCD on low temp needs this, its an unknown pin going to the LCD controller chip
gpio_set_output_en(GPIO_PB6, 1);
gpio_set_input_en(GPIO_PB6, 0);
gpio_write(GPIO_PB6, 0);

init_i2c();
if( deepRetWakeUp ){
user_init_deepRetn ();
Expand Down

0 comments on commit a2819e3

Please sign in to comment.