void renderer::draw_debug_lines( const debug_lines& logic_step_lines, const debug_lines& persistent_lines, const debug_lines& frame_lines, const augs::atlas_entry tex, const float interpolation_ratio ) { const auto output = augs::line_drawer_with_default({ get_line_buffer(), tex }); auto line_lambda = [&](const debug_line line) { output.line(line.a, line.b, line.col); }; if (interpolate_debug_logic_step_lines && logic_step_lines.size() == prev_logic_step_lines.size()) { std::vector<debug_line> interpolated_logic_step_lines; interpolated_logic_step_lines.resize(logic_step_lines.size()); for (size_t i = 0; i < logic_step_lines.size(); ++i) { interpolated_logic_step_lines[i].a = prev_logic_step_lines[i].a.lerp(logic_step_lines[i].a, interpolation_ratio); interpolated_logic_step_lines[i].b = prev_logic_step_lines[i].b.lerp(logic_step_lines[i].b, interpolation_ratio); interpolated_logic_step_lines[i].col = logic_step_lines[i].col; } for_each_in(interpolated_logic_step_lines, line_lambda); } else { for_each_in(logic_step_lines, line_lambda); } for_each_in(persistent_lines, line_lambda); for_each_in(frame_lines, line_lambda); }
int main(void) { int autorun; // double calcfreq; // double CurrentFreq = 144e6; /* MCU Configuration----------------------------------------------------------*/ /* Reset of all peripherals, Initializes the Flash interface and the Systick. */ HAL_Init(); /* Configure the system clock */ SystemClock_Config(); /* Initialize all configured peripherals */ MX_GPIO_Init(); //MX_SPI1_Init(); HAL_GPIO_WritePin(GPIOB, GPIO_PIN_1, GPIO_PIN_SET); MX_TIM3_Init(); MX_TIM14_Init(); MX_USB_DEVICE_Init(); Morse_Init(); // prepare_pll(); // UpdateFrequencyRegisters(CurrentFreq, 50000000.0, 5000, 1, 1, &calcfreq); // PLL_Sync(); autorun = cmd_isautorun() ; /* Infinite loop */ while (1) { if (is_line_received()) { // Process received line cmd_proc(get_line_buffer()); } HAL_Delay(10); ar_count++; if ((ar_count > 1000) & (autorun>0)) { // Start Autorun cmd_autorun(autorun); cw_autorunning = 1; while(cw_autorunning) HAL_Delay(10); } } }
static void send_commit (s4pp_ctx_t *ctx) { unsigned digest_len = ctx->digest.mech->digest_size; char *outbuf = get_line_buffer (ctx, 4 + digest_len * 2 + 1); // SIG:digest\n if (!outbuf) return; // rely on connection failing later; FIXME strcpy (outbuf, "SIG:"); char *digest = outbuf + 4; finalize_hmac (ctx, digest); crypto_encode_asciihex (digest, digest_len, digest); digest[digest_len * 2] = '\n'; ctx->state = S4PP_COMMITTING; process_out_buffer (ctx, true); }
static bool prepare_begin_seq (s4pp_ctx_t *ctx) { clear_dict (ctx); ctx->seq.last_time = 0; ctx->seq.n_sent = 0; // SEQ:<num>,0,1,0\n - time:0 timediv:1 datafmt:0 unsigned max_buf_len = 4 + 10 + 6; char *outbuf = get_line_buffer (ctx, max_buf_len); if (!outbuf) return false; unsigned overreach = max_buf_len - sprintf (outbuf, "SEQ:%u,0,1,0\n", ctx->seq.seq_no++); return_buffer (ctx, overreach); ctx->state = S4PP_BUFFERING; init_hmac (ctx); update_hmac (ctx, ctx->authtok, strlen (ctx->authtok)); update_hmac (ctx, outbuf, max_buf_len - overreach); return true; }
static void prepare_sample_entry (s4pp_ctx_t *ctx, const s4pp_sample_t *sample, unsigned dict_idx) { unsigned val_len = sample->type == S4PP_FORMATTED ? strlen (sample->val.formatted) : (unsigned)snprintf (NULL, 0, "%f", sample->val.numeric); unsigned max_buf_len = 10 + 1 + 11 + val_len + 1 + 1; char *outbuf = get_line_buffer (ctx, max_buf_len); if (!outbuf) return; int32_t delta = sample->timestamp - ctx->seq.last_time; unsigned n; if (sample->type == S4PP_FORMATTED) n = sprintf (outbuf, "%u,%d,%s\n", dict_idx, delta, sample->val.formatted); else n = sprintf (outbuf, "%u,%d,%f\n", dict_idx, delta, sample->val.numeric); return_buffer (ctx, max_buf_len - n); ctx->seq.last_time = sample->timestamp; ++ctx->seq.n_sent; update_hmac (ctx, outbuf, n); }
static bool prepare_dict_entry (s4pp_ctx_t *ctx, const char *name, unsigned *idx) { for (dict_entry_t *d = ctx->seq.dict; d; d = d->next) { if (strcmp (name, d->name) == 0) { *idx = d->idx; return true; } } unsigned len = strlen (name); dict_entry_t *d = malloc (sizeof (dict_entry_t) + len + 1); if (!d) { ctx->state = S4PP_ERRORED; ctx->err = S4PP_NO_MEMORY; return false; } strcpy (d->name, name); d->next = ctx->seq.dict; d->idx = d->next ? d->next->idx + 1 : 0; ctx->seq.dict = d; // DICT:<idx>,,1,<name>\n unsigned max_buf_len = 5 + 10 + 4 + len + 1; char *outbuf = get_line_buffer (ctx, max_buf_len); if (!outbuf) return false; unsigned overreach = max_buf_len - sprintf (outbuf, "DICT:%u,,1,%s\n", d->idx, name); return_buffer (ctx, overreach); update_hmac (ctx, outbuf, max_buf_len - overreach); *idx = d->idx; return true; }
for i in [0, 1, 2, ...] until it returns a non-string.\n\ It should return the next possible completion starting with 'text'.\ "; /* Exported function to read the current line buffer */ static PyObject * get_line_buffer(PyObject *self, PyObject *args) { if (!PyArg_NoArgs(args)) return NULL; return PyString_FromString(rl_line_buffer); } static char doc_get_line_buffer[] = "\ get_line_buffer() -> string\n\ return the current contents of the line buffer.\ "; /* Exported function to insert text into the line buffer */ static PyObject * insert_text(PyObject *self, PyObject *args) { char *s; if (!PyArg_ParseTuple(args, "s:insert_text", &s)) return NULL; rl_insert_text(s); Py_INCREF(Py_None); return Py_None; }