1
0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2024-11-30 15:26:18 +00:00

Merge branch 'Marlin_v1' of https://github.com/ErikZalm/Marlin into Marlin_v1

This commit is contained in:
Erik van der Zalm 2013-10-20 09:51:58 +02:00
commit 24c6b2ab35
4 changed files with 60 additions and 0 deletions

24
Marlin/BlinkM.cpp Normal file
View File

@ -0,0 +1,24 @@
/*
BlinkM.cpp - Library for controlling a BlinkM over i2c
Created by Tim Koster, August 21 2013.
*/
#if (ARDUINO >= 100)
# include "Arduino.h"
#else
# include "WProgram.h"
#endif
#include "BlinkM.h"
void SendColors(byte red, byte grn, byte blu)
{
Wire.begin();
Wire.beginTransmission(0x09);
Wire.write('o'); //to disable ongoing script, only needs to be used once
Wire.write('n');
Wire.write(red);
Wire.write(grn);
Wire.write(blu);
Wire.endTransmission();
}

14
Marlin/BlinkM.h Normal file
View File

@ -0,0 +1,14 @@
/*
BlinkM.h
Library header file for BlinkM library
*/
#if (ARDUINO >= 100)
# include "Arduino.h"
#else
# include "WProgram.h"
#endif
#include "Wire.h"
void SendColors(byte red, byte grn, byte blu);

View File

@ -561,6 +561,9 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
// Support for the BariCUDA Paste Extruder. // Support for the BariCUDA Paste Extruder.
//#define BARICUDA //#define BARICUDA
//define BlinkM/CyzRgb Support
//#define BLINKM
/*********************************************************************\ /*********************************************************************\
* R/C SERVO support * R/C SERVO support
* Sponsored by TrinityLabs, Reworked by codexmas * Sponsored by TrinityLabs, Reworked by codexmas

View File

@ -44,6 +44,9 @@
#include "language.h" #include "language.h"
#include "pins_arduino.h" #include "pins_arduino.h"
#include "BlinkM.h"
#include "Wire.h"
#if NUM_SERVOS > 0 #if NUM_SERVOS > 0
#include "Servo.h" #include "Servo.h"
#endif #endif
@ -115,6 +118,7 @@
// M128 - EtoP Open (BariCUDA EtoP = electricity to air pressure transducer by jmil) // M128 - EtoP Open (BariCUDA EtoP = electricity to air pressure transducer by jmil)
// M129 - EtoP Closed (BariCUDA EtoP = electricity to air pressure transducer by jmil) // M129 - EtoP Closed (BariCUDA EtoP = electricity to air pressure transducer by jmil)
// M140 - Set bed target temp // M140 - Set bed target temp
// M150 - Set BlinkM Colour Output R: Red<0-255> U(!): Green<0-255> B: Blue<0-255> over i2c, G for green does not work.
// M190 - Sxxx Wait for bed current temp to reach target temp. Waits only when heating // M190 - Sxxx Wait for bed current temp to reach target temp. Waits only when heating
// Rxxx Wait for bed current temp to reach target temp. Waits when heating and cooling // Rxxx Wait for bed current temp to reach target temp. Waits when heating and cooling
// M200 - Set filament diameter // M200 - Set filament diameter
@ -1935,6 +1939,21 @@ void process_commands()
#endif #endif
break; break;
//TODO: update for all axis, use for loop //TODO: update for all axis, use for loop
#ifdef BLINKM
case 150: // M150
{
byte red;
byte grn;
byte blu;
if(code_seen('R')) red = code_value();
if(code_seen('U')) grn = code_value();
if(code_seen('B')) blu = code_value();
SendColors(red,grn,blu);
}
break;
#endif //BLINKM
case 201: // M201 case 201: // M201
for(int8_t i=0; i < NUM_AXIS; i++) for(int8_t i=0; i < NUM_AXIS; i++)
{ {