Skip to content

Commit

Permalink
Revert "add the timer too close creality hack for MCU firmware only"
Browse files Browse the repository at this point in the history
This reverts commit 7080345.
  • Loading branch information
pellcorp committed Sep 15, 2024
1 parent d309fd6 commit 192b200
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 30 deletions.
2 changes: 1 addition & 1 deletion .config.mcu
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ CONFIG_MAIN_MCU_BOARD=y
# CONFIG_BED_MCU_BOARD is not set
CONFIG_MCU_BOARD_ID=0
CONFIG_MCU_BOARD_HW_VER=120
CONFIG_MCU_BOARD_FW_VER=012
CONFIG_MCU_BOARD_FW_VER=011
CONFIG_MCU_BOARD_FW_RESERVED=000
# end of Board Configure

Expand Down
2 changes: 1 addition & 1 deletion .config.noz
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ CONFIG_NOZZLE_MCU_BOARD=y
# CONFIG_BED_MCU_BOARD is not set
CONFIG_MCU_BOARD_ID=0
CONFIG_MCU_BOARD_HW_VER=120
CONFIG_MCU_BOARD_FW_VER=016
CONFIG_MCU_BOARD_FW_VER=015
CONFIG_MCU_BOARD_FW_RESERVED=000
# end of Board Configure

Expand Down
18 changes: 2 additions & 16 deletions src/basecmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@
* Low level allocation
****************************************************************/

static uint32_t allocMoveQueueCountMax = 0;
static uint32_t usedMoveQueueNumber = 0;
static uint32_t usedMoveQueueWaterLine = 0;

static void *alloc_end;

void
Expand Down Expand Up @@ -54,7 +50,6 @@ alloc_chunks(size_t size, size_t count, uint16_t *avail)
shutdown("alloc_chunks failed");
void *data = alloc_chunk(p - alloc_end);
*avail = can_alloc;
allocMoveQueueCountMax = can_alloc;
return data;
}

Expand Down Expand Up @@ -83,7 +78,6 @@ move_free(void *m)
struct move_node *mf = m;
mf->next = move_free_list;
move_free_list = mf;
usedMoveQueueNumber--;
}

// Allocate runtime storage
Expand All @@ -95,13 +89,6 @@ move_alloc(void)
if (!mf)
shutdown("Move queue overflow");
move_free_list = mf->next;
usedMoveQueueNumber++;

if(usedMoveQueueWaterLine < usedMoveQueueNumber)
{
usedMoveQueueWaterLine = usedMoveQueueNumber;
}

irq_restore(flag);
return mf;
}
Expand Down Expand Up @@ -176,7 +163,6 @@ move_reset(void)
struct move_node *mf = move_list + (move_count - 1)*move_item_size;
mf->next = NULL;
move_free_list = move_list;
output("allocMax=%u usedMax=%u",allocMoveQueueCountMax,usedMoveQueueWaterLine);
}
DECL_SHUTDOWN(move_reset);

Expand All @@ -187,7 +173,7 @@ move_finalize(void)
shutdown("Already finalized");
struct move_queue_head dummy;
move_queue_setup(&dummy, sizeof(*move_free_list));
move_list = alloc_chunks(move_item_size, 4096, &move_count);
move_list = alloc_chunks(move_item_size, 1024, &move_count);
move_reset();
}

Expand Down Expand Up @@ -259,7 +245,7 @@ void
command_get_config(uint32_t *args)
{
sendf("config is_config=%c crc=%u is_shutdown=%c move_count=%hu"
, is_finalized(), config_crc, sched_is_shutdown(), move_count - 10);
, is_finalized(), config_crc, sched_is_shutdown(), move_count);
}
DECL_COMMAND_FLAGS(command_get_config, HF_IN_SHUTDOWN, "get_config");

Expand Down
13 changes: 1 addition & 12 deletions src/sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,18 +86,12 @@ void
sched_add_timer(struct timer *add)
{
uint32_t waketime = add->waketime;
uint8_t flags = 0;
irqstatus_t flag = irq_save();
struct timer *tl = SchedStatus.timer_list;
if (unlikely(timer_is_before(waketime, tl->waketime))) {
// This timer is before all other scheduled timers
if (timer_is_before(waketime, timer_read_time()))
// try_shutdown("Timer too close");
{
flags = 1;
waketime = timer_read_time() + timer_from_us(2);
add->waketime = waketime;
}
try_shutdown("Timer too close");
if (tl == &deleted_timer)
add->next = deleted_timer.next;
else
Expand All @@ -110,11 +104,6 @@ sched_add_timer(struct timer *add)
insert_timer(tl, add, waketime);
}
irq_restore(flag);
if(flags)
{
output("Timer too close");
flags = 0;
}
}

// The deleted timer is used when deleting an active timer.
Expand Down

0 comments on commit 192b200

Please sign in to comment.