#include #include #include #include "main.h" #include "def.h" //extern uint8_t devices_found ; extern uint8_t roms[MAX_DEVICES][8]; extern char rx_buffer[64]; extern TEMP temp_sense[30]; extern uint8_t init; int test_var=0; //void handle_command(char* cmd) // //{ // if (strncmp(cmd, "list", 4) == 0) // { // printf("find %d devices:\r\n", devices_found); // for (int i = 0; i < devices_found; i++) // { // printf("Device #%d: ", i); // for (int j = 0; j < 8; j++) // printf("%02X ", roms[i][j]); // printf("\r\n"); // } // } // else if (strncmp(cmd, "temp all", 8) == 0) // { // for (int i = 0; i < devices_found; i++) // { // ds_reset(); // ds_write_byte(0x55); // for (int j = 0; j < 8; j++) // ds_write_byte(roms[i][j]); // ds_write_byte(0x44); // } // HAL_Delay(750); // for (int i = 0; i < devices_found; i++) // { // ds_reset(); // ds_write_byte(0x55); // for (int j = 0; j < 8; j++) // ds_write_byte(roms[i][j]); // ds_write_byte(0xBE); // uint8_t tl = ds_read_byte(); // uint8_t th = ds_read_byte(); // int16_t t = (th << 8) | tl; // float temp = t / 16.0; // printf("T[%d] = %.2f C\r\n", i, temp); // } // } // else if (strncmp(cmd, "temp ", 5) == 0) // { // int id = atoi(&cmd[5]); // if (id < 0 || id >= devices_found) // { // printf("unknown ID\r\n"); // return; // } // ds_reset(); // ds_write_byte(0x55); // for (int j = 0; j < 8; j++) // ds_write_byte(roms[id][j]); // ds_write_byte(0x44); // HAL_Delay(750); // ds_reset(); // ds_write_byte(0x55); // for (int j = 0; j < 8; j++) // ds_write_byte(roms[id][j]); // ds_write_byte(0xBE); // uint8_t tl = ds_read_byte(); // uint8_t th = ds_read_byte(); // int16_t t = (th << 8) | tl; // float temp = t / 16.0; // printf("T[%d] = %.2f C\r\n", id, temp); // } // else if (strncmp(cmd, "ts_1_open_minus",15 ) == 0) // { // temp_sense[0].t_open-=1; // // } // else if (strncmp(cmd, "ts_1_open_plus",14 ) == 0) // { // temp_sense[0].t_open+=1; // // } // else if (strncmp(cmd, "ts_1_close_minus",16 ) == 0) // { // temp_sense[0].t_close-=1; // // } // else if (strncmp(cmd, "ts_1_close_plus",15 ) == 0) // { // // temp_sense[0].t_close+=1; // } // else if (strncmp(cmd, "init",4 ) == 0) // { // init=1; // printf("init %s\r\n", "OK"); // } // else if // (strncmp(cmd, "set_temp ", 9) == 0) // { // uint8_t sense_num = (atoi(&cmd[9])&0x7c0)>>10; // int parse_uart=atoi(&cmd[10]); // // temp_sense[sense_num].t_set=(float)parse_uart/10.; // printf("temp_sense %i %s\r\n",sense_num, "OK"); // // // } // else if (strncmp(cmd, "temp ", 5) == 0) // { // // // } // else // { // printf("unknown CMD: %s\r\n", cmd); // for (int i=0;i<63;i++) // rx_buffer[i]=0; // // } //}