bugfix upload to partition 0

This commit is contained in:
Harald Pichler 2017-08-24 13:55:21 +02:00
parent 3b56d718c6
commit d62fe15a26

View file

@ -70,11 +70,17 @@ res_put_handler(void *request, void *response, uint8_t *buffer, uint16_t preferr
coap_packet_t *const packet = (coap_packet_t *)request; coap_packet_t *const packet = (coap_packet_t *)request;
uint8_t *in_data = NULL; uint8_t *in_data = NULL;
size_t len = 0; size_t len = 0;
const uint32_t partition_start = bootloader_get_part_start (1); uint32_t partition_start = 0;
const uint32_t partition_size = bootloader_get_part_size (); const uint32_t partition_size = bootloader_get_part_size ();
unsigned int ct = -1; unsigned int ct = -1;
if(bootloader_get_boot_default()){
partition_start = bootloader_get_part_start (0);
}else{
partition_start = bootloader_get_part_start (1);
}
REST.get_header_content_type(request, &ct); REST.get_header_content_type(request, &ct);
/* Require content_type APPLICATION_OCTET_STREAM */ /* Require content_type APPLICATION_OCTET_STREAM */
@ -169,8 +175,13 @@ res_put_handler(void *request, void *response, uint8_t *buffer, uint16_t preferr
if (!packet->block1_more) { if (!packet->block1_more) {
// we are finished // we are finished
bootloader_backup_irq_table (1); // FIXME: 1 is hardcoded if(bootloader_get_boot_default()){
bootloader_set_boot_next (1); bootloader_backup_irq_table (0);
bootloader_set_boot_next (0);
}else{
bootloader_backup_irq_table (1);
bootloader_set_boot_next (1);
}
current_offset = 0; current_offset = 0;
} }