Keep "astyled" elements in misc files - small changes
This commit is contained in:
@@ -9,7 +9,7 @@
|
|||||||
#include "blinkm.h"
|
#include "blinkm.h"
|
||||||
|
|
||||||
void SendColors(byte red, byte grn, byte blu) {
|
void SendColors(byte red, byte grn, byte blu) {
|
||||||
Wire.begin();
|
Wire.begin();
|
||||||
Wire.beginTransmission(0x09);
|
Wire.beginTransmission(0x09);
|
||||||
Wire.write('o'); //to disable ongoing script, only needs to be used once
|
Wire.write('o'); //to disable ongoing script, only needs to be used once
|
||||||
Wire.write('n');
|
Wire.write('n');
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
#define BUZZER_H
|
#define BUZZER_H
|
||||||
|
|
||||||
#if HAS_BUZZER
|
#if HAS_BUZZER
|
||||||
void buzz(long duration,uint16_t freq);
|
void buzz(long duration, uint16_t freq);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif //BUZZER_H
|
#endif //BUZZER_H
|
@@ -16,7 +16,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
static byte current_to_wiper(float current) {
|
static byte current_to_wiper(float current) {
|
||||||
return byte(ceil(float((DIGIPOT_I2C_FACTOR*current))));
|
return byte(ceil(float((DIGIPOT_I2C_FACTOR * current))));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void i2c_send(byte addr, byte a, byte b) {
|
static void i2c_send(byte addr, byte a, byte b) {
|
||||||
@@ -28,13 +28,13 @@ static void i2c_send(byte addr, byte a, byte b) {
|
|||||||
|
|
||||||
// This is for the MCP4451 I2C based digipot
|
// This is for the MCP4451 I2C based digipot
|
||||||
void digipot_i2c_set_current(int channel, float current) {
|
void digipot_i2c_set_current(int channel, float current) {
|
||||||
current = min( (float) max( current, 0.0f ), DIGIPOT_I2C_MAX_CURRENT);
|
current = min((float) max(current, 0.0f), DIGIPOT_I2C_MAX_CURRENT);
|
||||||
// these addresses are specific to Azteeg X3 Pro, can be set to others,
|
// these addresses are specific to Azteeg X3 Pro, can be set to others,
|
||||||
// In this case first digipot is at address A0=0, A1= 0, second one is at A0=0, A1= 1
|
// In this case first digipot is at address A0=0, A1= 0, second one is at A0=0, A1= 1
|
||||||
byte addr = 0x2C; // channel 0-3
|
byte addr = 0x2C; // channel 0-3
|
||||||
if (channel >= 4) {
|
if (channel >= 4) {
|
||||||
addr = 0x2E; // channel 4-7
|
addr = 0x2E; // channel 4-7
|
||||||
channel -= 4;
|
channel -= 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initial setup
|
// Initial setup
|
||||||
@@ -50,9 +50,8 @@ void digipot_i2c_init() {
|
|||||||
const float digipot_motor_current[] = DIGIPOT_I2C_MOTOR_CURRENTS;
|
const float digipot_motor_current[] = DIGIPOT_I2C_MOTOR_CURRENTS;
|
||||||
Wire.begin();
|
Wire.begin();
|
||||||
// setup initial currents as defined in Configuration_adv.h
|
// setup initial currents as defined in Configuration_adv.h
|
||||||
for(int i = 0; i < COUNT(digipot_motor_current); i++) {
|
for (int i = 0; i < COUNT(digipot_motor_current); i++)
|
||||||
digipot_i2c_set_current(i, digipot_motor_current[i]);
|
digipot_i2c_set_current(i, digipot_motor_current[i]);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif //DIGIPOT_I2C
|
#endif //DIGIPOT_I2C
|
||||||
|
@@ -190,7 +190,7 @@
|
|||||||
#elif ENABLED(MAPPER_D0D1)
|
#elif ENABLED(MAPPER_D0D1)
|
||||||
uint8_t utf_hi_char; // UTF-8 high part
|
uint8_t utf_hi_char; // UTF-8 high part
|
||||||
bool seen_d5 = false;
|
bool seen_d5 = false;
|
||||||
char charset_mapper(char c){
|
char charset_mapper(char c) {
|
||||||
uint8_t d = c;
|
uint8_t d = c;
|
||||||
if ( d >= 0x80u ) { // UTF-8 handling
|
if ( d >= 0x80u ) { // UTF-8 handling
|
||||||
if ((d >= 0xd0u) && (!seen_d5)) {
|
if ((d >= 0xd0u) && (!seen_d5)) {
|
||||||
@@ -218,7 +218,7 @@
|
|||||||
bool seen_e3 = false;
|
bool seen_e3 = false;
|
||||||
bool seen_82_83 = false;
|
bool seen_82_83 = false;
|
||||||
char charset_mapper(char c){
|
char charset_mapper(char c){
|
||||||
uint8_t d = c;
|
uint8_t d = c;
|
||||||
if ( d >= 0x80 ) { // UTF-8 handling
|
if ( d >= 0x80 ) { // UTF-8 handling
|
||||||
if ( (d == 0xe3) && (seen_e3 == false)) {
|
if ( (d == 0xe3) && (seen_e3 == false)) {
|
||||||
seen_e3 = true;
|
seen_e3 = true;
|
||||||
|
@@ -16,8 +16,7 @@
|
|||||||
|
|
||||||
|
|
||||||
/// intialise watch dog with a 4 sec interrupt time
|
/// intialise watch dog with a 4 sec interrupt time
|
||||||
void watchdog_init()
|
void watchdog_init() {
|
||||||
{
|
|
||||||
#if ENABLED(WATCHDOG_RESET_MANUAL)
|
#if ENABLED(WATCHDOG_RESET_MANUAL)
|
||||||
//We enable the watchdog timer, but only for the interrupt.
|
//We enable the watchdog timer, but only for the interrupt.
|
||||||
//Take care, as this requires the correct order of operation, with interrupts disabled. See the datasheet of any AVR chip for details.
|
//Take care, as this requires the correct order of operation, with interrupts disabled. See the datasheet of any AVR chip for details.
|
||||||
@@ -30,9 +29,8 @@ void watchdog_init()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// reset watchdog. MUST be called every 1s after init or avr will reset.
|
/// reset watchdog. MUST be called every 1s after init or avr will reset.
|
||||||
void watchdog_reset()
|
void watchdog_reset() {
|
||||||
{
|
wdt_reset();
|
||||||
wdt_reset();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
@@ -41,12 +39,11 @@ void watchdog_reset()
|
|||||||
|
|
||||||
//Watchdog timer interrupt, called if main program blocks >1sec and manual reset is enabled.
|
//Watchdog timer interrupt, called if main program blocks >1sec and manual reset is enabled.
|
||||||
#if ENABLED(WATCHDOG_RESET_MANUAL)
|
#if ENABLED(WATCHDOG_RESET_MANUAL)
|
||||||
ISR(WDT_vect)
|
ISR(WDT_vect) {
|
||||||
{
|
SERIAL_ERROR_START;
|
||||||
SERIAL_ERROR_START;
|
SERIAL_ERRORLNPGM("Something is wrong, please turn off the printer.");
|
||||||
SERIAL_ERRORLNPGM("Something is wrong, please turn off the printer.");
|
kill(PSTR("ERR:Please Reset")); //kill blocks //16 characters so it fits on a 16x2 display
|
||||||
kill(PSTR("ERR:Please Reset")); //kill blocks //16 characters so it fits on a 16x2 display
|
while (1); //wait for user or serial reset
|
||||||
while(1); //wait for user or serial reset
|
|
||||||
}
|
}
|
||||||
#endif//RESET_MANUAL
|
#endif//RESET_MANUAL
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user