Re-Arm bugfixes (#7495)

* UBL_correction

* RGB Map function
2.0.x
Tannoo 7 years ago committed by Scott Lahteine
parent 622b80974c
commit 859fa35287

@ -134,14 +134,14 @@
extern char lcd_status_message[]; extern char lcd_status_message[];
#endif #endif
extern float destination[XYZE]; extern float destination[XYZE];
void set_destination_to_current(); extern void set_destination_to_current() { COPY(destination, current_position); }
void prepare_move_to_destination(); void prepare_move_to_destination();
#if AVR_AT90USB1286_FAMILY // Teensyduino & Printrboard IDE extensions have compile errors without this #if AVR_AT90USB1286_FAMILY // Teensyduino & Printrboard IDE extensions have compile errors without this
inline void sync_plan_position_e() { planner.set_e_position_mm(current_position[E_AXIS]); } inline void sync_plan_position_e() { planner.set_e_position_mm(current_position[E_AXIS]); }
inline void set_current_to_destination() { COPY(current_position, destination); } inline void set_current_to_destination() { COPY(current_position, destination); }
#else #else
void sync_plan_position_e(); extern void sync_plan_position_e() { planner.set_e_position_mm(current_position[E_AXIS]); }
void set_current_to_destination(); extern void set_current_to_destination() { COPY(current_position, destination); }
#endif #endif
#if ENABLED(NEWPANEL) #if ENABLED(NEWPANEL)
void lcd_setstatusPGM(const char* const message, const int8_t level); void lcd_setstatusPGM(const char* const message, const int8_t level);

@ -140,17 +140,27 @@ bool digitalRead(int pin) {
return LPC_GPIO(pin_map[pin].port)->FIOPIN & LPC_PIN(pin_map[pin].pin) ? 1 : 0; return LPC_GPIO(pin_map[pin].port)->FIOPIN & LPC_PIN(pin_map[pin].pin) ? 1 : 0;
} }
void analogWrite(int pin, int pin_status) { //todo: Hardware PWM void analogWrite(int pin, int pwm_value) {
/* /*
if (pin == P2_4) { if (!WITHIN(pin, 0, NUM_DIGITAL_PINS - 1) || pin_map[pin].port == 0xFF)
LPC_PWM1->MR5 = pin_status; // set value return;
LPC_PWM1->LER = _BV(5); // set latch
} int old_pin = pin;
else if (pin == P2_5) { int old_value = pwm_value;
LPC_PWM1->MR6 = pin_status;
LPC_PWM1->LER = _BV(6); if(old_value != 0) {
for(uint16_t x = 0; x <= 5000; x++) {
LPC_GPIO(pin_map[pin].port)->FIOSET = LPC_PIN(pin_map[pin].pin);
//digitalWrite(old_pin, HIGH);
delayMicroseconds(old_value);
LPC_GPIO(pin_map[pin].port)->FIOCLR = LPC_PIN(pin_map[pin].pin);
//pinMode(pin, OUTPUT);
//digitalWrite(old_pin, LOW);
delayMicroseconds(255 - old_value);
}
} }
*/ */
} }
extern bool HAL_adc_finished(); extern bool HAL_adc_finished();
@ -175,7 +185,6 @@ void eeprom_read_block (void *__dst, const void *__src, size_t __n) { }
void eeprom_update_block (const void *__src, void *__dst, size_t __n) { } void eeprom_update_block (const void *__src, void *__dst, size_t __n) { }
/***/
char *dtostrf (double __val, signed char __width, unsigned char __prec, char *__s) { char *dtostrf (double __val, signed char __width, unsigned char __prec, char *__s) {
char format_string[20]; char format_string[20];
snprintf(format_string, 20, "%%%d.%df", __width, __prec); snprintf(format_string, 20, "%%%d.%df", __width, __prec);
@ -195,4 +204,8 @@ void randomSeed(uint32_t value) {
srand(value); srand(value);
} }
int map(uint16_t x, uint16_t in_min, uint16_t in_max, uint16_t out_min, uint16_t out_max) {
return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}
#endif // TARGET_LPC1768 #endif // TARGET_LPC1768

@ -112,4 +112,6 @@ void randomSeed(uint32_t);
char *dtostrf (double __val, signed char __width, unsigned char __prec, char *__s); char *dtostrf (double __val, signed char __width, unsigned char __prec, char *__s);
int map(uint16_t x, uint16_t in_min, uint16_t in_max, uint16_t out_min, uint16_t out_max);
#endif // __ARDUINO_DEF_H__ #endif // __ARDUINO_DEF_H__

Loading…
Cancel
Save