kopia lustrzana https://github.com/SP8EBC/ParaTNC
WARNING THIS COMIT DOESNT COMPILE!! Please previous or next one. Requesting engineering from GSM module and button handling
rodzic
9c329270bd
commit
2a75bb6eb5
|
@ -219,7 +219,9 @@ const config_data_basic_t __attribute__((section(".config_section_default.basic"
|
|||
#endif
|
||||
|
||||
.battery_scalling_a = VBAT_MEAS_A_COEFF,
|
||||
.battery_scalling_b = VBAT_MEAS_B_COEFF
|
||||
.battery_scalling_b = VBAT_MEAS_B_COEFF,
|
||||
|
||||
.button_one
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -15,4 +15,6 @@
|
|||
void gsm_sim800_poolers_ten_seconds(srl_context_t * srl_context, gsm_sim800_state_t * state);
|
||||
void gsm_sim800_poolers_one_second(srl_context_t * srl_context, gsm_sim800_state_t * state, const config_data_gsm_t * config);
|
||||
|
||||
void gsm_sim800_poolers_request_engineering(void);
|
||||
|
||||
#endif /* INCLUDE_GSM_SIM800C_POOLERS_H_ */
|
||||
|
|
|
@ -30,6 +30,8 @@ static const char * CENG0 = "+CENG: 0,\0";
|
|||
#define LAC_OFFSET 42
|
||||
#define LAC_LN 4
|
||||
|
||||
uint8_t gsm_sim800_engineering_is_requested = 0;
|
||||
|
||||
uint8_t gsm_sim800_engineering_is_enabled = 0;
|
||||
|
||||
// set to one if correct response has been received for engineering data request. This is reset back to zero
|
||||
|
@ -61,6 +63,16 @@ static uint16_t gsm_sim800_rewind_to_ceng_0(uint8_t *srl_rx_buf_pointer, uint16_
|
|||
|
||||
static void gsm_sim800_engineering_parse_ceng_0(uint8_t *srl_rx_buf_pointer, uint16_t ceng_0_payload_start) {
|
||||
|
||||
/**
|
||||
* Details:0x20000828 <srl_usart3_rx_buffer>
|
||||
* "AT+CENG?\r\r\n
|
||||
* +CENG: 4,0\r\n\r\n
|
||||
* +CENG: 0,\"0037,44,00,260,01,43,67f4,05,05,539d,255,-69,145,145,x,x,x,x,x,x,x\"\r\n
|
||||
* +CENG: 1,\"0009,25,61,260,01,539d,80,56\"\r\n
|
||||
* +CENG: 2,\"0008,25,15,260,01,539d,78,54\"\r\n+CENG: 3,\"0038"...
|
||||
*
|
||||
*/
|
||||
|
||||
// temporary buffer for strings
|
||||
char string_buffer[5];
|
||||
|
||||
|
@ -174,8 +186,6 @@ void gsm_sim800_engineering_response_callback(srl_context_t * srl_context, gsm_s
|
|||
gsm_sim800_engineering_parse_ceng_0(srl_context->srl_rx_buf_pointer, ceng_start);
|
||||
|
||||
gsm_sim800_engineering_successed = 1;
|
||||
|
||||
//gsm_sim800_engineering_disable(srl_context, state);
|
||||
}
|
||||
else {
|
||||
gsm_sim800_engineering_successed = 0;
|
||||
|
|
|
@ -14,42 +14,61 @@
|
|||
|
||||
#include <stdint.h>
|
||||
|
||||
uint8_t sim800_poolers_five = 3;
|
||||
//!< Set to one externally to request engineering, get one time at startup by default
|
||||
uint8_t sim800_poolers_request_engineering = 1;
|
||||
|
||||
void gsm_sim800_poolers_ten_seconds(srl_context_t * srl_context, gsm_sim800_state_t * state){
|
||||
|
||||
// if no engineering is currently processed, gprs is ready and APRS-IS connection
|
||||
// is not alive now.
|
||||
if ( gsm_sim800_engineering_is_enabled == 0 &&
|
||||
gsm_sim800_gprs_ready == 1 &&
|
||||
aprsis_connected == 0) {
|
||||
aprsis_connect_and_login_default(1);
|
||||
}
|
||||
|
||||
// gsm_sim800_tcpip_connect(TEST_IP, strlen(TEST_IP), TEST_PORT, strlen(TEST_PORT), srl_context, state);
|
||||
// //gsm_sim800_engineering_enable(srl_context, state);
|
||||
//
|
||||
// gsm_sim800_tcpip_close(srl_context, state);
|
||||
|
||||
}
|
||||
|
||||
void gsm_sim800_poolers_one_second(srl_context_t * srl_context, gsm_sim800_state_t * state, const config_data_gsm_t * config) {
|
||||
|
||||
if (*state == SIM800_ALIVE) {
|
||||
|
||||
// initialize GPRS if it is not initialized
|
||||
if (gsm_sim800_gprs_ready == 0) {
|
||||
sim800_gprs_initialize(srl_context, state, config);
|
||||
}
|
||||
|
||||
if (gsm_sim800_engineering_is_enabled == 1 && gsm_sim800_engineering_successed == 0) {
|
||||
gsm_sim800_engineering_request_data(srl_context, state);
|
||||
|
||||
return;
|
||||
}
|
||||
else {
|
||||
// if GPRS is ready an there is a request to obtain engineering information
|
||||
if (sim800_poolers_request_engineering == 1 && aprsis_connected == 0) {
|
||||
|
||||
if (gsm_sim800_engineering_successed == 1) {
|
||||
gsm_sim800_engineering_disable(srl_context, state);
|
||||
// initial state when engineering is not enabled and not finished
|
||||
if (gsm_sim800_engineering_is_enabled == 0 && gsm_sim800_engineering_successed == 0) {
|
||||
gsm_sim800_engineering_enable(srl_context, state);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (gsm_sim800_engineering_is_enabled == 1 && gsm_sim800_engineering_successed == 0) {
|
||||
gsm_sim800_engineering_request_data(srl_context, state);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (gsm_sim800_engineering_successed == 1) {
|
||||
gsm_sim800_engineering_disable(srl_context, state);
|
||||
|
||||
// engineering request is single shot
|
||||
sim800_poolers_request_engineering = 0;
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue