Skip to content

radio and tempradio should have an apply_at parameter that takes unix time #1175

Description

@mikecarper

https://github.com/meshcore-dev/MeshCore/blob/main/examples/simple_repeater/MyMesh.cpp#L749C1-L758C1

void MyMesh::applyTempRadioParams(float freq, float bw, uint8_t sf, uint8_t cr, int timeout_mins) {
  set_radio_at = futureMillis(2000); // give CLI reply some time to be sent back, before applying temp radio params
  pending_freq = freq;
  pending_bw = bw;
  pending_sf = sf;
  pending_cr = cr;

  revert_radio_at = futureMillis(2000 + timeout_mins * 60 * 1000); // schedule when to revert radio params
}

Do something like this so the radio change can be done at a given time in the future.

void MyMesh::applyTempRadioParams(float freq, float bw, uint8_t sf, uint8_t cr, int timeout_mins, int apply_delay_sec) {
    uint64_t apply_delay_ms = 2000
    if (apply_delay_sec > 2) {
        apply_delay_ms = static_cast<uint64_t>(apply_delay_sec) * 1000u;
    }

  set_radio_at = futureMillis(apply_delay_ms ); // give CLI reply some time to be sent back, before applying temp radio params
  pending_freq = freq;
  pending_bw = bw;
  pending_sf = sf;
  pending_cr = cr;

  revert_radio_at = futureMillis(apply_delay_ms + timeout_mins * 60 * 1000); // schedule when to revert radio params
}

Setting it to a unix timestamp is a better way to do this so a single command can be copied and the radio figures out the offset. Will also need to be done for radio; don't see an easy way to do this in the future though. Above is a simple proof of concept.

} else if (memcmp(config, "radio ", 6) == 0) {

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions